ValueError when reading a wrong chunk size
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
BeeSeek |
Fix Released
|
High
|
vSC |
Bug Description
If a the body of a request sent using a chunked Transfer-Encoding contains an invalid chunk size, ValueError is raised. The bug is easily reproducible:
>>> import socket
>>> from bsnode.httpconn import HttpConnection
>>> def callback(handler):
... yield handler.
... yield handler.read()
>>> client, server = socket.socketpair()
>>> conn = HttpConnection(
>>> client.sendall(
... 'PUT / HTTP/1.1\n'
... 'Transfer-Encoding: chunked\n'
... '\n'
... 'k\n')
>>> conn.handle_
Traceback (most recent call last):
...
ValueError: invalid literal for int() with base 16: 'k'
Instead, it should raise HttpError and notify the client with a 400 (bad request) response.
Related branches
- Andrea Corbellini: Approve
-
Diff: 60 lines (+30/-2)2 files modifiednode/bsnode/http.py (+8/-2)
tests/node/http.py (+22/-0)
tags: | added: node |
Changed in beeseek: | |
assignee: | nobody → vSC (vijit.chauhan) |
status: | Triaged → In Progress |
Fixed in revision 75.