Skip to content

Commit

Permalink
Merge pull request #92 from Crypt0-M3lon/master
Browse files Browse the repository at this point in the history
Fix socket timeout on HTTP POST requests
  • Loading branch information
lgandx committed May 26, 2019
2 parents 7339411 + 32be7a1 commit e1d1657
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions servers/HTTP.py
Expand Up @@ -278,21 +278,20 @@ def handle(self):
break
data += buff
remaining -= len(buff)
if remaining <= 0:
break
#check if we recieved the full header
if data.find('\r\n\r\n') != -1:
#we did, now to check if there was anything else in the request besides the header
if data.find('Content-Length') == -1:
#request contains only header
break
else:
#searching for that content-length field in the header
for line in data.split('\r\n'):
if line.find('Content-Length') != -1:
line = line.strip()
remaining = int(line.split(':')[1].strip()) - len(data)

else:
#searching for that content-length field in the header
for line in data.split('\r\n'):
if line.find('Content-Length') != -1:
line = line.strip()
remaining = int(line.split(':')[1].strip()) - len(data)
if remaining <= 0:
break
if data == "":
break
#now the data variable has the full request
Expand Down

0 comments on commit e1d1657

Please sign in to comment.