GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Search::Elasticsearch::Cxn::LWP(3) User Contributed Perl Documentation Search::Elasticsearch::Cxn::LWP(3)

Search::Elasticsearch::Cxn::LWP - A Cxn implementation which uses LWP

version 6.00

Provides an HTTP Cxn class and based on LWP. The LWP backend uses pure Perl and persistent connections.

This class does Search::Elasticsearch::Role::Cxn, whose documentation provides more information, and Search::Elasticsearch::Role::Is_Sync.

From Search::Elasticsearch::Role::Cxn
  • node
  • max_content_length
  • deflate
  • deflate
  • request_timeout
  • ping_timeout
  • dead_timeout
  • max_dead_timeout
  • sniff_request_timeout
  • sniff_timeout
  • handle_args
  • handle_args

Search::Elasticsearch::Cxn::LWP uses IO::Socket::SSL to support HTTPS. By default, no validation of the remote host is performed.

This behaviour can be changed by passing the "ssl_options" parameter with any options accepted by IO::Socket::SSL. For instance, to check that the remote host has a trusted certificate, and to avoid man-in-the-middle attacks, you could do the following:

    use Search::Elasticsearch;

    my $es = Search::Elasticsearch->new(
        cxn   => 'LWP',
        nodes => [
            "https://node1.mydomain.com:9200",
            "https://node2.mydomain.com:9200",
        ],
        ssl_options => {
            verify_hostname     => 1,
            SSL_ca_file         => '/path/to/cacert.pem'
        }
    );

If the remote server cannot be verified, an Search::Elasticsearch::Error will be thrown - LWP does not allow us to detect that the connection error was due to invalid SSL.

If you want your client to present its own certificate to the remote server, then use:

    use Search::Elasticsearch;

    my $es = Search::Elasticsearch->new(
        cxn   => 'LWP',
        nodes => [
            "https://node1.mydomain.com:9200",
            "https://node2.mydomain.com:9200",
        ],
        ssl_options => {
            verify_hostname     => 1,
            SSL_ca_file         => '/path/to/cacert.pem',
            SSL_use_cert        => 1,
            SSL_cert_file       => '/path/to/client.pem',
            SSL_key_file        => '/path/to/client.pem',
        }
    );

    ($status,$body) = $self->perform_request({
        # required
        method      => 'GET|HEAD|POST|PUT|DELETE',
        path        => '/path/of/request',
        qs          => \%query_string_params,

        # optional
        data        => $body_as_string,
        mime_type   => 'application/json',
        timeout     => $timeout
    });

Sends the request to the associated Elasticsearch node and returns a $status code and the decoded response $body, or throws an error if the request failed.

From Search::Elasticsearch::Role::Cxn
  • scheme()
  • is_https()
  • userinfo()
  • default_headers()
  • max_content_length()
  • build_uri()
  • host()
  • port()
  • uri()
  • is_dead()
  • is_live()
  • next_ping()
  • ping_failures()
  • mark_dead()
  • mark_live()
  • force_ping()
  • pings_ok()
  • sniff()
  • process_response()

  • Search::Elasticsearch::Role::Cxn
  • Search::Elasticsearch::Cxn::HTTPTiny
  • Search::Elasticsearch::Cxn::Hijk
  • Search::Elasticsearch::Cxn::NetCurl

Clinton Gormley <drtech@cpan.org>

This software is Copyright (c) 2017 by Elasticsearch BV.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004
2017-11-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.