Skip to content

Commit

Permalink
Fix bug with requesting chunked data
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinL10 committed Aug 26, 2023
1 parent 4728956 commit 4572113
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions browser/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
if len(sys.argv) == 2:
browser.load(sys.argv[1])
else:
browser.load("file:///home/vever/cs/browser/browser/tests/index.html")
# browser.load("https://browser.engineering/layout.html")
browser.load("https://browser.engineering/styles.html")

# browser.load("https://www.w3.org/Style/CSS/Test/CSS1/current/test5526c.htm")

Expand Down
4 changes: 2 additions & 2 deletions browser/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ def request(url, num_redirects=0):
pos = 0
while True:
start = body.find(b"\r\n", pos)
length = int(body[pos:start].decode())
length = int(body[pos:start].decode(), 16)

if length == 0:
break

end = body.find(b"\r\n", start + 2)
end = start + length + 2
new_body += body[start + 2 : end]
pos = end + 2

Expand Down

0 comments on commit 4572113

Please sign in to comment.