This repository has been archived by the owner on Jul 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Fix bugs when transfer chunked result #37
Merged
jschwinger233
merged 1 commit into
projecteru2:master
from
nyanpassu:bugfix/forward-chunked
Sep 2, 2021
Merged
Fix bugs when transfer chunked result #37
jschwinger233
merged 1 commit into
projecteru2:master
from
nyanpassu:bugfix/forward-chunked
Sep 2, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
utils/utils.go
Outdated
return | ||
} | ||
log.Error("[ForwardChunked] can't Hijack ServerResponseWriter") | ||
if err := WriteBadGateWayResponse( |
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.
utils/utils.go
Outdated
// first we send response to non overrided client, make sure it's ready for new protocol | ||
if err = writeChunkedResponseHeader( | ||
response, | ||
http.StatusSwitchingProtocols, |
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.
为啥要 101, 这个 API 本身就是直接返回 200 吧, barrel proxy 的行为应该是完全透明的吧
utils/utils.go
Outdated
log.Errorf("[doForwardChunked] Hijack ServerResponseWriter failed %v", err) | ||
return | ||
} | ||
defer forwardChunked(conn, resp.Body) |
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.
为什么是 defer?
nyanpassu
force-pushed
the
bugfix/forward-chunked
branch
from
September 2, 2021 14:33
e19b07b
to
2ad4f77
Compare
nyanpassu
force-pushed
the
bugfix/forward-chunked
branch
from
September 2, 2021 14:42
2ad4f77
to
d118481
Compare
nyanpassu
changed the title
[WIP]fix bugs when transfer chunked result
Fix bugs when transfer chunked result
Sep 2, 2021
nyanpassu
force-pushed
the
bugfix/forward-chunked
branch
from
September 2, 2021 15:04
d118481
to
a565edd
Compare
jschwinger233
approved these changes
Sep 2, 2021
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.
看起来不错, 你自己测过了就好.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
this PR fix bugs when transfering chunked result
when request is get and response is trunked, http response from dockerd will be write to proxy response and flush right away.
this only applys to get request and chunked response in order to fix /events api, do not invovle other circumstances in order not to involve too many test to catch up with 9.9