Retry with truncated URL on error 500 in HTTP response.
This commit is contained in:
parent
056a83f013
commit
d7b0f2483b
10
buku
10
buku
@ -271,6 +271,7 @@ def fetchTitle(url):
|
|||||||
global titleData
|
global titleData
|
||||||
titleData = None
|
titleData = None
|
||||||
urlconn = None
|
urlconn = None
|
||||||
|
retry = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
urlconn, resp = getPageResp(url, False)
|
urlconn, resp = getPageResp(url, False)
|
||||||
@ -301,6 +302,15 @@ def fetchTitle(url):
|
|||||||
url = redirurl
|
url = redirurl
|
||||||
urlconn.close()
|
urlconn.close()
|
||||||
urlconn, resp = getPageResp(url, True)
|
urlconn, resp = getPageResp(url, True)
|
||||||
|
if resp.status == 500 and retry == False:
|
||||||
|
"""Retry on status 500 (Internal Server Error) with truncated
|
||||||
|
URL. Some servers support truncated request URL on redirection.
|
||||||
|
"""
|
||||||
|
urlconn.close()
|
||||||
|
if debug:
|
||||||
|
print("Received status 500: retrying.")
|
||||||
|
urlconn, resp = getPageResp(url, False)
|
||||||
|
retry = True
|
||||||
else:
|
else:
|
||||||
printmsg(("[" + str(resp.status) + "] " + resp.reason), "ERROR")
|
printmsg(("[" + str(resp.status) + "] " + resp.reason), "ERROR")
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user