bliako has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed Archontes of Perl Wisdom,
I am sorry that this is a very vague question because I can not share the details of the request but also because I can test this only once a day.
In a particular scraping exercise I observe that my browser (Firefox 48 and firebug) sends a GET to the server and receives a "302 Found" server response. However, when I do the same programmatically with LWP I get a 200 OK server response back.
More details:
The whole exercice consists of: POST, GET, GET.
The POST returns a 302 and a "Location" header (RLOC1). This succeeds in LWP.
RLOC1 is relative URL in the form of "../../ABC/xyz.jsp" and so I make it absolute by inserting protocol and server name and replacing "../../" with absolute path. I assume absolute path is correct because I can verify with what I see in browser/firebug. And so I now have absolute url LOC1.
Next, I GET to LOC1 using LWP, expecting to get 302, like I get in my browser, but I get 200 OK. (and no "Location" in headers to continue with my next and final GET).
I am quite sure the request headers (including cookies, referer and user-agent string) are the same in both although I am now using LWP::ConsoleLogger::Easy in order to verify that exactly.
I am very sure that the GET params sent to the server with LWP and browser are identical (and there are no character escape issues).
Assuming request headers and GET params are identical between LWP and browser, are there other factors that can cause the remote server to behave differently when using LWP?
Any ideas?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: GET request using LWP::UserAgent returns 200 OK but Firefox 302 Found
by 7stud (Deacon) on Mar 10, 2018 at 13:00 UTC | |
by haukex (Archbishop) on Mar 10, 2018 at 17:35 UTC | |
Re: GET request using LWP::UserAgent returns 200 OK but Firefox 302 Found
by haukex (Archbishop) on Mar 10, 2018 at 11:23 UTC | |
Re: GET request using LWP::UserAgent returns 200 OK but Firefox 302 Found
by rizzo (Curate) on Mar 10, 2018 at 18:06 UTC | |
by bliako (Abbot) on Mar 11, 2018 at 01:23 UTC | |
by bliako (Abbot) on Mar 20, 2018 at 17:35 UTC |