class MyURLopener(urllib.URLopener):
- # Error 302 -- relocated (temporarily)
- def http_error_302(self, url, fp, errcode, errmsg, headers, data=None):
+ # Error 301 -- relocated (temporarily)
+ def http_error_301(self, url, fp, errcode, errmsg, headers, data=None):
if headers.has_key('location'):
newurl = headers['location']
elif headers.has_key('uri'):
newurl = "Nowhere"
raise RedirectException(errcode, newurl)
- # Error 301 -- also relocated (permanently)
- http_error_301 = http_error_302
+ # Error 302 -- also relocated (permanently)
+ http_error_302 = http_error_301
+ # Error 303 -- also relocated (permanently)
+ http_error_303 = http_error_301
# Error 307 -- also relocated (temporary)
- http_error_307 = http_error_302
+ http_error_307 = http_error_301
# Error 401 -- authentication required
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None):
content = infile.read()
infile.close()
- return headers, content
+ return headers, content, None
except IOError, msg:
if (msg[0] == "http error") and (msg[1] == -1):
+ error = None
bookmark.no_error = "The server did not return any header - it is not an error, actually"
self.log(' no headers: %s' % bookmark.no_error)
else:
- bookmark.error = get_error(msg)
- self.log(' Error: %s' % bookmark.error)
+ error = get_error(msg)
+ self.log(' Error: %s' % error)
- return None, None
+ return None, None, error
def get_ftp_welcome(self):
global ftpcache_key