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 error status codes in HTTP server #1011

Closed
confluence opened this issue Jan 26, 2022 · 0 comments · Fixed by #1117
Closed

Fix error status codes in HTTP server #1011

confluence opened this issue Jan 26, 2022 · 0 comments · Fixed by #1117
Assignees
Labels
bug Something isn't working
Milestone

Comments

@confluence
Copy link
Collaborator

You can only set a status on a uWebSockets response once, and you have to set status first, then headers, then a body. To ensure that a status is set before headers are set, the uWebSockets function for setting headers automatically sets the status to 200 first. This means that any subsequent attempt to set a different status will have no effect.

In our server code, there are several places where we first set headers (through AddNoCacheHeaders or otherwise) and then attempt to set a status, which is silently failing. If the status is supposed to be 200 anyway, this makes no difference, but it's impossible for these functions ever to return an error status.

I found this while moving the scripting interface into the HTTP server, but I think that this needs to be fixed and tested in a separate PR -- it's possible that other parts of CARTA are depending on these functions always returning a 200 status, and that something will break once the error codes are restored.

@confluence confluence added the bug Something isn't working label Jan 26, 2022
@confluence confluence self-assigned this May 18, 2022
@veggiesaurus veggiesaurus added this to the v3.0-stable milestone Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants