Here is a patch that fixes the URL redirection bugs
Bug fix number 1) URL Redirection in HTTPS requests.
There is a typo in the regex where a Location: redirect
isn't captured correct due to an extra space. The
regex matched 'Location: \s+' rather than 'Location:\s+'
That's the orginal bug I found. When I found it I came
to see if it'd be reported and found a couple other
redirect-related bugs (Bug #1217162, and Bug# 1156473)
I wrote a new function _resolve_uri() to take a
relative path and a base path and create the fully
qualified path. _expandlinks didn't seem to work right
for me, but I might have just been mis-understanding
it, too much regex to try and follow.
Then I changed the _httpsrequest and _httprequest
functions to use this new _resolve_uri function to
expand the redirect.
Also, I added a default of port 80 for http and port
443 for https in the fetch/submit functions. The
reason for this is because before if you redirected
from a site that specified a port to one that didn't,
it would try to use the old port on the new site. Example:
url: http://www.aoeex.com:8008/extras/snoopyredir.php
<?php
header('Location: http://www.hotmail.com/');
?>
Snoopy would attempt to fetch
http://www.hotmail.com:8008/ as the redirect URL.
Patch for described bugs