.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Search::Elasticsearch::Cxn::LWP 3pm" .TH Search::Elasticsearch::Cxn::LWP 3pm 2024-02-04 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Search::Elasticsearch::Cxn::LWP \- A Cxn implementation which uses LWP .SH VERSION .IX Header "VERSION" version 8.12 .SH DESCRIPTION .IX Header "DESCRIPTION" Provides an HTTP Cxn class and based on LWP. The LWP backend uses pure Perl and persistent connections. .PP This class does Search::Elasticsearch::Role::Cxn, whose documentation provides more information, and Search::Elasticsearch::Role::Is_Sync. .SH CONFIGURATION .IX Header "CONFIGURATION" .SS "Inherited configuration" .IX Subsection "Inherited configuration" From Search::Elasticsearch::Role::Cxn .IP \(bu 4 node .IP \(bu 4 max_content_length .IP \(bu 4 deflate .IP \(bu 4 deflate .IP \(bu 4 request_timeout .IP \(bu 4 ping_timeout .IP \(bu 4 dead_timeout .IP \(bu 4 max_dead_timeout .IP \(bu 4 sniff_request_timeout .IP \(bu 4 sniff_timeout .IP \(bu 4 handle_args .IP \(bu 4 handle_args .SH SSL/TLS .IX Header "SSL/TLS" Search::Elasticsearch::Cxn::LWP uses IO::Socket::SSL to support HTTPS. By default, no validation of the remote host is performed. .PP This behaviour can be changed by passing the \f(CW\*(C`ssl_options\*(C'\fR 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: .PP .Vb 1 \& use Search::Elasticsearch; \& \& my $es = Search::Elasticsearch\->new( \& cxn => \*(AqLWP\*(Aq, \& nodes => [ \& "https://node1.mydomain.com:9200", \& "https://node2.mydomain.com:9200", \& ], \& ssl_options => { \& verify_hostname => 1, \& SSL_ca_file => \*(Aq/path/to/cacert.pem\*(Aq \& } \& ); .Ve .PP 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. .PP If you want your client to present its own certificate to the remote server, then use: .PP .Vb 1 \& use Search::Elasticsearch; \& \& my $es = Search::Elasticsearch\->new( \& cxn => \*(AqLWP\*(Aq, \& nodes => [ \& "https://node1.mydomain.com:9200", \& "https://node2.mydomain.com:9200", \& ], \& ssl_options => { \& verify_hostname => 1, \& SSL_ca_file => \*(Aq/path/to/cacert.pem\*(Aq, \& SSL_use_cert => 1, \& SSL_cert_file => \*(Aq/path/to/client.pem\*(Aq, \& SSL_key_file => \*(Aq/path/to/client.pem\*(Aq, \& } \& ); .Ve .SH METHODS .IX Header "METHODS" .ie n .SS perform_request() .el .SS \f(CWperform_request()\fP .IX Subsection "perform_request()" .Vb 5 \& ($status,$body) = $self\->perform_request({ \& # required \& method => \*(AqGET|HEAD|POST|PUT|DELETE\*(Aq, \& path => \*(Aq/path/of/request\*(Aq, \& qs => \e%query_string_params, \& \& # optional \& data => $body_as_string, \& mime_type => \*(Aqapplication/json\*(Aq, \& timeout => $timeout \& }); .Ve .PP Sends the request to the associated Elasticsearch node and returns a \f(CW$status\fR code and the decoded response \f(CW$body\fR, or throws an error if the request failed. .SS "Inherited methods" .IX Subsection "Inherited methods" From Search::Elasticsearch::Role::Cxn .IP \(bu 4 \&\fBscheme()\fR .IP \(bu 4 \&\fBis_https()\fR .IP \(bu 4 \&\fBuserinfo()\fR .IP \(bu 4 \&\fBdefault_headers()\fR .IP \(bu 4 \&\fBmax_content_length()\fR .IP \(bu 4 \&\fBbuild_uri()\fR .IP \(bu 4 \&\fBhost()\fR .IP \(bu 4 \&\fBport()\fR .IP \(bu 4 \&\fBuri()\fR .IP \(bu 4 \&\fBis_dead()\fR .IP \(bu 4 \&\fBis_live()\fR .IP \(bu 4 \&\fBnext_ping()\fR .IP \(bu 4 \&\fBping_failures()\fR .IP \(bu 4 \&\fBmark_dead()\fR .IP \(bu 4 \&\fBmark_live()\fR .IP \(bu 4 \&\fBforce_ping()\fR .IP \(bu 4 \&\fBpings_ok()\fR .IP \(bu 4 \&\fBsniff()\fR .IP \(bu 4 \&\fBprocess_response()\fR .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 Search::Elasticsearch::Role::Cxn .IP \(bu 4 Search::Elasticsearch::Cxn::HTTPTiny .IP \(bu 4 Search::Elasticsearch::Cxn::NetCurl .SH AUTHOR .IX Header "AUTHOR" Enrico Zimuel .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2024 by Elasticsearch BV. .PP This is free software, licensed under: .PP .Vb 1 \& The Apache License, Version 2.0, January 2004 .Ve