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

httpParserOnStatusCallback() is not called #171

Closed
TakCodeIT opened this issue Jan 9, 2024 · 6 comments
Closed

httpParserOnStatusCallback() is not called #171

TakCodeIT opened this issue Jan 9, 2024 · 6 comments

Comments

@TakCodeIT
Copy link

httpParserOnStatusCallback() is not called if a server returns a status code without a reason string such as following.

HTTP/1.1 400
Server: nginx
Date: Fri, 05 Jan 2024 05:25:21 GMT
Content-Type: application/json
Content-Length: 30
Connection: keep-alive
・・・

If a server returns "HTTP/1.1 400 Bad Request" instead of "HTTP/1.1 400", httpParserOnStatusCallback() is called.

@aggarg
Copy link
Member

aggarg commented Jan 9, 2024

It seems that the underlying parser does not invoke on_status callback in this specific case. It still invokes on_status_complete callback though. Would you please try the patch below and let me know if it fixes your issue?

status.patch

@aggarg
Copy link
Member

aggarg commented Jan 10, 2024

@TakCodeIT Also, can you share which server returns this response?

@TakCodeIT
Copy link
Author

It seems that the underlying parser does not invoke on_status callback in this specific case. It still invokes on_status_complete callback though. Would you please try the patch below and let me know if it fixes your issue?

status.patch

Thank you for the patch. It works!

@TakCodeIT
Copy link
Author

@TakCodeIT Also, can you share which server returns this response?

I'll get back to you when I know the details.

@TakCodeIT
Copy link
Author

@TakCodeIT Also, can you share which server returns this response?

@aggarg Apparently, Tomcat is used for the server.

aggarg added a commit to aggarg/coreHTTP that referenced this issue Jan 24, 2024
on_status callback is not called for a response with a status code but
without a reason string such as following:
```
HTTP/1.1 400
Server: nginx
Date: Fri, 05 Jan 2024 05:25:21 GMT
Content-Type: application/json
Content-Length: 30
Connection: keep-alive
・・・
```

It was reported here - FreeRTOS#171

Signed-off-by: Gaurav Aggarwal <[email protected]>
aggarg added a commit that referenced this issue Jan 24, 2024
on_status callback is not called for a response with a status code but
without a reason string such as following:
```
HTTP/1.1 400
Server: nginx
Date: Fri, 05 Jan 2024 05:25:21 GMT
Content-Type: application/json
Content-Length: 30
Connection: keep-alive
・・・
```

It was reported here - #171

Signed-off-by: Gaurav Aggarwal <[email protected]>
@aggarg
Copy link
Member

aggarg commented Jan 24, 2024

Fix has been merged in this PR - #173. Closing this issue.

@aggarg aggarg closed this as completed Jan 24, 2024
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

2 participants