K
Karra
I am doing a POST to a webserver and get a 302 Found response
(redirect). urllib2's default behaviour is to do a GET on the new url
from the Location: URI in the 302 response.
This is different from what I have found with LWP::UserAgent-
conformance to the relevant RFCs. Therefore, I believe urllib2's
behaviour appears to be non-conformant (as, I believe are many
browsers).
Now, regardless of what is the "correct" approach to handling the 302,
there is some information in the returned html of the 302 which I am
losing because of the subsequent GET. I tried to raise a HTTPError
from redirect_request() but that just kills the connection with the
server. I tried returning None, same result.
Can someone point me to how I can get the default LWP:UserAgent
behaviour of handling this scenario using urllib2?
(redirect). urllib2's default behaviour is to do a GET on the new url
from the Location: URI in the 302 response.
This is different from what I have found with LWP::UserAgent-
that automatic redirection for a 302 in response to a POST is not inrequest() in perl. After much searching I understand there is a view
conformance to the relevant RFCs. Therefore, I believe urllib2's
behaviour appears to be non-conformant (as, I believe are many
browsers).
Now, regardless of what is the "correct" approach to handling the 302,
there is some information in the returned html of the 302 which I am
losing because of the subsequent GET. I tried to raise a HTTPError
from redirect_request() but that just kills the connection with the
server. I tried returning None, same result.
Can someone point me to how I can get the default LWP:UserAgent
behaviour of handling this scenario using urllib2?