Re^5: LWP 400 Bad Request on POSTby afoken (Parson)
|on Nov 14, 2013 at 18:05 UTC||Need Help??|
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).
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)