Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Jul 8, 2024
1 parent 6f183b9 commit 836c747
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions LunaTranslator/LunaTranslator/network/libcurl/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,14 @@ def ___perform():
cnt -= 1
if cnt == 0:
break
else:
# 有proxy时,proxy也有可能有header.
headerb = ""
else:
headerb += _headerb

resp.headers = self._update_header_cookie(headerb)

if proxy:
resp.status_code = int(headerb[:-2].split(" ")[1])
else:
resp.status_code = self._getStatusCode(curl)
resp.status_code = self._getStatusCode(curl)
else:

def WriteMemoryCallback(saver, contents, size, nmemb, userp):
Expand Down
2 changes: 2 additions & 0 deletions LunaTranslator/LunaTranslator/network/requests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def _parseheader2dict(self, headerstr):
cookie = {}
for line in headerstr.split("\r\n")[1:]:
idx = line.find(": ")
if idx == -1:
continue
if line[:idx].lower() == "set-cookie":
_c = line[idx + 2 :].split("; ")[0]
_idx = _c.find("=")
Expand Down

0 comments on commit 836c747

Please sign in to comment.