Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Recreate upgrade headers for websocket request #1592
Recreate upgrade headers for websocket request #1592
Changes from 3 commits
b3e04fe
23d3e9b
73f894c
1ce0b5d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I understand this. It seems this is about https://datatracker.ietf.org/doc/html/rfc7230#section-6.7
This piece of code is for response with something extra plus to
websocket
inUpgrader
header. Since we can only generateUpgrade: websocket
in adjusted client request and server MUST NOT add anything non-requested, then what could be in the response for the extra? Can't we just always sendUpgrade: websocket
from the server to the client?If I'm wrong, then a good comment with the RFC cite is required in the place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention was as follows:
We always strip upgrade header from response and re-add it when needed. So we do not just pass it through tempesta as is. But when we recreate headers would be beneficially to do simple sane check because we essentially hide backend and act on behalf on it.
Imaging erroneous backend that we on our discretion silently transform into compliant backend. That would be destructive if you ask me.
But this intention is, i understand, subtle and subjective. It is up to you if we need just alway send
Upgrade: websocket
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have
Connection: close, upgrade
, then it seems we should send justConnection: close
. Also could you please check whether a connection is considered keep-alive by default (there is neitherclose
norkeep-alive
)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default passed 0 in the function for responses,
BIT(TFW_HTTP_B_CONN_KA)
passed to function for responses only if paired request hasTFW_HTTP_B_CONN_KA
bit.But for requests by default passed
BIT(TFW_HTTP_B_CONN_KA)
.And semantically connection is keep-alive by default for
HTTP/1.1
and later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have
Connection: close, upgrade
in response than now result depends on status. If status is4XX
than connection is closed without upgrade. If101
than upgrade is finished and connection state than depends on actual closing on no-closing from backend.May be that is right enough.