Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: LWP 400 Bad Request on POST

by afoken (Parson)
on Nov 14, 2013 at 18:05 UTC ( #1062632=note: print w/ replies, xml ) Need Help??


in reply to Re^4: LWP 400 Bad Request on POST
in thread LWP 400 Bad Request on POST

First thing I noticed is that the browser is doing a CONNECT request, not a POST.

A browser issuing a CONNECT request is typical for access to a HTTPS URL (instead of a HTTP URL). CONNECT bypasses most of the proxy (especially the filter logic), so it is usually restricted. Typically you are only allowed to connect to the HTTPS standard port 443, and no other port.

When I switched to a CONNECT method in the script I immediately got a 200 return code. Still no content though.

You should not have to change your code from POST to CONNECT, in fact, this should not work. LWP::UserAgent should issue a CONNECT request to the proxy, make a SSL connection to the HTTPS server, and issue your POST request through the SSL encrypted connection. When you issue a CONNECT manually, the proxy just answers 200 OK and switches to forwarding all data between your script and the destination server.

If you can access HTTPS URLs from a browser through the proxy, LWP::UserAgent should be able to do so, too. Try something simple first, like a GET request for https://www.google.com/. If that does not work, talk with the proxy admin, make him/her look into the proxy logfiles. Talk with the network admins, try to get a way out around the proxy (directly through the firewall).

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)


Comment on Re^5: LWP 400 Bad Request on POST

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1062632]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2014-10-02 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (65 votes), past polls