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

Fix for handling request without headers #238

Merged
merged 1 commit into from Apr 19, 2018
Merged

Fix for handling request without headers #238

merged 1 commit into from Apr 19, 2018

Conversation

kwangswei
Copy link
Contributor

  • Circuits couldn't receive a request which doesn't have any headers
  • None of the HTTP headers are required in a HTTP/1.0 request.
  • For example, "GET / HTTP/1.0\r\n\r\n"
  • This commit fixed this issue

@prologic
Copy link
Member

Can you confirm there was no regression in the test suite with this diff?

@kwangswei
Copy link
Contributor Author

Ooops... I'm sorry.
I will check it again.

@prologic
Copy link
Member

I approve the change obviously; but just want to be sure there are no regressions!

Thanks also for adding a new test case to cover this.

- None of the HTTP headers are required in a HTTP/1.0 request.
- Circuits couldn't receive a request which doesn't have any headers
- For example, "GET / HTTP/1.0\r\n\r\n"
- This commit fixed this issue
@kwangswei
Copy link
Contributor Author

@prologic Could you check the result of CI build? It failed with test_tcp and test_udp and I don't think my code caused that error.

@prologic prologic merged commit ecfbe00 into circuits:master Apr 19, 2018
@spaceone
Copy link
Contributor

I approve the change obviously; but just want to be sure there are no regressions!

This change had a regression, it requires chunked Transfer encoding to provide any trailer header otherwise:

Traceback (most recent call last):
  File "/home/fbest/git/circuits/circuits/core/manager.py", line 679, in _dispatcher
    value = event_handler(*eargs, **ekwargs)
  File "/home/fbest/git/circuits/circuits/web/http.py", line 233, in _on_read
    parser.execute(data, len(data))
  File "/home/fbest/git/circuits/circuits/web/parsers/http.py", line 212, in execute
    ret = self._parse_body()
  File "/home/fbest/git/circuits/circuits/web/parsers/http.py", line 391, in _parse_body
    size, rest = self._parse_chunk_size(data)
  File "/home/fbest/git/circuits/circuits/web/parsers/http.py", line 431, in _parse_chunk_size
    self._parse_trailers(rest_chunk)
  File "/home/fbest/git/circuits/circuits/web/parsers/http.py", line 439, in _parse_trailers
    self._trailers = self._parse_headers(data[:idx])
  File "/home/fbest/git/circuits/circuits/web/parsers/http.py", line 313, in _parse_headers
    raise InvalidHeader("No host header defined")
InvalidHeader: No host header defined

spaceone added a commit that referenced this pull request Aug 20, 2021
spaceone added a commit that referenced this pull request Aug 20, 2021
spaceone added a commit that referenced this pull request Aug 20, 2021
spaceone added a commit that referenced this pull request Aug 20, 2021
@spaceone
Copy link
Contributor

Fixed via ac30ad0 and 09125da.

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

Successfully merging this pull request may close these issues.

None yet

3 participants