From LiveHTTPHeaders, I get that I need to do this:
GET https://somesite.com/foo/bar;jsessionid=0001CxASgCKob1dDFdsSDSDF:- +1?requestor=AGE&doctype=Statement&docid=NTczMyT1LTc5LTMtMS0wLQ%3D%3D& +token=df99a322563f
So I coded it up like so:
$url = URI->new("https://somesite.com/foo/bar;jsessionid=$jsession +Id"); $url->query_form( requestor => 'AGE', doctype => 'Statement', docid => $docid, token => $token, ); $response = $agent->get($url);
But I get "400 Bad Request".

The above code is the last step of a five stage process where I log in, navigate, collect cookies and headers and whatnot to fill in the variables.

I have verified that all the previous steps work great with nice return codes and the HTML content is just as it should be, matching what I get with a browser.

Since you can't really test your answers, wild guesses are OK in this thread :)

UPDATE:
Amazing Fact: The HTML error page that is returned with my 400 actually contains a URL. The error page says that the URL is no good, but if I paste it into a web browser location line, it works and pulls the pdf file down.


In reply to LWP GET: '400 Bad Request' by andyford

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.