10000 revert "refactor(net): pass request header" by j2rong4cn · Pull Request #8269 · AlistGo/alist · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

revert "refactor(net): pass request header" #8269

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

Merged
merged 1 commit into from
Apr 3, 2025
Merged

Conversation

j2rong4cn
Copy link
Contributor

stream.GetRangeReadCloserFromLink只在内部使用,传递请求头好像不是个好选择😢

@xhofe xhofe requested a review from Copilot April 2, 2025 01:53
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reverts the previous changes made to passing the request header, ensuring that only internal components receive header modifications. The key changes include:

  • Reverting the creation of a new header from the context value in server/common/proxy.go by using a value instead of a pointer.
  • Removing header retrieval from context in internal/stream/util.go and passing nil to net.ProcessHeader.
  • Adjusting the addition of the header into the context in internal/net/serve.go to store the header by value.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
server/common/proxy.go Reverts header retrieval changes by directly using http.Header, ensuring compatibility with context.
internal/stream/util.go Removes usage of context header; net.ProcessHeader is now called with nil as the first parameter.
internal/net/serve.go Updates context assignment to store r.Header by value rather than a pointer.
Comments suppressed due to low confidence (2)

internal/stream/util.go:22

  • Ensure that net.ProcessHeader safely handles a nil request header. This is critical now that header retrieval from context has been removed.
header := net.ProcessHeader(nil, link.Header)

internal/stream/util.go:63

  • Verify that net.ProcessHeader is robust against a nil header input to prevent unintended issues in header processing.
header := net.ProcessHeader(nil, link.Header)

@xhofe xhofe merged commit a630428 into AlistGo:main Apr 3, 2025
12 checks passed
@j2rong4cn j2rong4cn deleted the revert branch April 3, 2025 13:50
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.

2 participants
0