xml - Send HTTP POST followed by GET using same socket -


i trying create perl script should send http post request xml data followed http request using same socket.

i tried using lwp::useragent seems it's creating new socket each request.

i tried using io::socket i'm not sure how use send xml data.

my code:

#!/usr/bin/perl  use strict; use warnings;  use lwp::useragent; use http::request::common;  $message = <<'xml'; <includefiltersets>   <filterset>     <filter>       <filtername>version_name</filtername>       <operator>         <name>in</name>       </operator>       <value>10.0u</value>     </filter>   </filterset> </includefiltersets> xml  $webpage = "https://www.test.com/abc/cde.xml"; $url     = "https://www.test.com";  $ua        = lwp::useragent->new; $response1 = $ua->post($webpage, content_type => 'text/xml', content => $message); $response2 = $ua->get($url); 

as @steffenullrich has suggested in comment, can force lwp re-use single tcp connection if specify keep_alive option in constructor. this

my $ua = lwp::useragent->new(keep_alive => 1); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -