Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected input checks #2

Open
Torxed opened this issue Apr 3, 2019 · 2 comments
Open

Expected input checks #2

Torxed opened this issue Apr 3, 2019 · 2 comments

Comments

@Torxed
Copy link
Owner

Torxed commented Apr 3, 2019

Would be nice if we checked input against specific lengths etc.
For instance:

Traceback (most recent call last):
  File "test.py", line 85, in <module>
    resposne = client.parse()
  File "/home/torxed/github/slimHTTP/slimhttpd.py", line 97, in parse
    return http_request(self).parse()
  File "/home/torxed/github/slimHTTP/slimhttpd.py", line 243, in parse
    method, header = header.split(b'\r\n',1)
ValueError: not enough values to unpack (expected 2, got 1)

Should probably have a sanity check before-hand. Even tho this is never meant to be in a production environment unless it's behind a proper HTTP reverse proxy.

@Torxed
Copy link
Owner Author

Torxed commented Feb 27, 2020

Still an issue..

Traceback (most recent call last):
  File "main.py", line 219, in <module>
    response = client.parse()
  File "/srv/http/customer/backend/slimHTTP/slimhttpd.py", line 101, in parse
    return http_request(self).parse()
  File "/srv/http/customer/backend/slimHTTP/slimhttpd.py", line 346, in parse
    method, header = header.split(b'\r\n',1)
ValueError: not enough values to unpack (expected 2, got 1)

@Torxed
Copy link
Owner Author

Torxed commented Mar 1, 2020

Traceback (most recent call last):
  File "obtain.life.py", line 638, in <module>
    response = client.parse()
  File "/srv/http/obtain.life/slimHTTP/slimhttpd.py", line 104, in parse
    return http_request(self).parse()
  File "/srv/http/obtain.life/slimHTTP/slimhttpd.py", line 421, in parse
    response = self.methods[method](request=self, headers=self.headers, payload=self.payload, root=web_root)
  File "/srv/http/obtain.life/slimHTTP/slimhttpd.py", line 332, in GET
    return self.local_file(root=root, path=headers[b'path'], headers=headers, payload=payload)
  File "/srv/http/obtain.life/slimHTTP/slimhttpd.py", line 303, in local_file
    data = get_file(root, path, headers=headers, ignore_read=ignore_read)
  File "/srv/http/obtain.life/slimHTTP/slimhttpd.py", line 215, in get_file
    _, data_range = headers[b'range'].split(b'=',1)
ValueError: not enough values to unpack (expected 2, got 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant