Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Proxy: proxy_pass_trailers directive. #153

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
Sep 13, 2024
Merged

Conversation

pluknet
Copy link
Contributor

@pluknet pluknet commented Sep 10, 2024

The directive allows to pass upstream response trailers to client.

The directive allows to pass upstream response trailers to client.
@arut arut self-assigned this Sep 10, 2024

/* a whole header has been parsed successfully */

buf->pos += len - (b->last - b->pos);
Copy link
Contributor

Choose a reason for hiding this comment

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

If trailers come in several buffers, (b->last - b->pos) can be larger than len. We need to subtract exactly the number of bytes processed during the current call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I get you (and the code) right, you mean that b->last - b->pos may contain the result of copying several input buffers?
This should not happen though, because only a single input buffer is processed per call and ngx_http_parse_header_line() updates b->pos to b->last.
In other words,b->last == b->pos should be always true on a call entry after completing a previous call either with NGX_AGAIN or NGX_OK (considering several requests through a keepalive connection), and b should not contain remaining unprocessed data left from the previous call.
If you're about something else, please correct me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed you're right.

Copy link
Contributor

@arut arut left a comment

Choose a reason for hiding this comment

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

LGTM

@arut arut merged commit 1a64c19 into nginx:master Sep 13, 2024
1 check passed
@pluknet pluknet deleted the trailers branch January 17, 2025 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants