You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dump the Content-Length the pipeline client now sends - #8367
Mirrors projectdiscovery/rawhttp#568 in newPipelinedRequest: a body the caller did not frame gets Content-Length, from req.ContentLength when set. Dev CI is red on TestPipelinedRequestDumpMatchesWire until this lands.
Summary by CodeRabbit
Bug Fixes
Corrected Content-Length handling for pipelined HTTP requests with a body. The header is now included only when neither Content-Length nor Transfer-Encoding is already present, and a supplied positive content length is preserved. This prevents conflicting length information and keeps request dumps consistent with the headers sent by the client.
No actionable comments were generated in the recent review.
Walkthrough
Pipelined request dumps now include Content-Length for non-empty bodies when neither Content-Length nor Transfer-Encoding is set. The expected request in the test includes this header.
Changes
Pipelined request dump
Layer / File(s)
Summary
Content-Length in pipelined request dumps pkg/protocols/http/utils.go, pkg/protocols/http/utils_test.go
For a non-empty body without Content-Length or Transfer-Encoding, the dump uses positive req.ContentLength when set, or the body length otherwise. The comment and test reflect the header in the dumped request.
projectdiscovery/nuclei#8297: Changes the pipelined-request dump to include the Content-Length added by rawhttp.
Suggested reviewers: dwisiswant0, mzack9999
Merge Risk: Minimal · up to 7069a
This change makes the pipelined request dump include Content-Length for bodies the caller has not framed, matching what the HTTP client sends on the wire. No actionable merge risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: the pipelined request dump now includes the Content-Length that the pipeline client sends. The raw summary says newPipelinedRequest now adds Content-Length for a nonem…
Linked Issues check
[#8366] The issue requires the pipelined request dump to include the Content-Length that rawhttp v0.3.2+ sends for a body. At head, newPipelinedRequest in pkg/protocols/http/utils.go appends a `Cont…
Out of Scope Changes check
The changed code stays within the scope of #8366. The utils.go change adds the Content-Length framing logic and the strconv import it needs. The doc comments on dumpPipelinedRequest and `newPipeli…
Full details: Title check
Explanation
The title names the main change: the pipelined request dump now includes the Content-Length that the pipeline client sends. The raw summary says newPipelinedRequest now adds Content-Length for a nonempty body when neither Content-Length nor Transfer-Encoding is present, using req.ContentLength when set. The objectives match this, as they aim to make the dump match the rawhttp wire output. The title is specific and short, and it is free of file lists or vague wording.
Full details: Linked Issues check
Explanation
[#8366] The issue requires the pipelined request dump to include the Content-Length that rawhttp v0.3.2+ sends for a body. At head, newPipelinedRequest in pkg/protocols/http/utils.go appends a Content-Length header when the body is non-empty and neither Content-Length nor Transfer-Encoding is set by the caller (checked with hasHeaderFold). The value is req.ContentLength when positive, otherwise len(body). Headers are then sorted for a stable order. TestDumpPipelinedRequestWritesWhatTheClientSends expects Content-Length: 32 for a 32-byte body, and also checks that no Content-Length appears for a body-less request. The code and the test agree. Limits: the whole-PR diff could not be read (changed blobs unavailable), so the base version of the test was not compared. I did not run the test suite, and I did not check rawhttp v0.3.3 source, so the CI result is not confirmed by execution. The Transfer-Encoding skip is inferred from the code, not from the rawhttp source.
Full details: Out of Scope Changes check
Explanation
The changed code stays within the scope of #8366. The utils.go change adds the Content-Length framing logic and the strconv import it needs. The doc comments on dumpPipelinedRequest and newPipelinedRequest describe the same behavior. The utils_test.go change covers the same dump path. The test assertion message mentions 'the client's own Content-Length', which is slightly inaccurate because nuclei adds the header, not the caller. This wording does not affect behavior or the verdict. The whole-PR diff could not be read, so this check relies on the file contents at head and the summaries.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
A rabbit checks the headers in a row, A body’s length is set before they go. When no length or transfer mark is there, The dump records the bytes with care. Then off the pipelined requests flow.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Essentials
Run ID: 17bfc51b-f880-471e-8afc-acc2b440e0ea
Commits
Reviewing files that changed from the base of the PR and between 5e89712 and 7069ae4.
Files selected for processing: 2
pkg/protocols/http/utils.go
pkg/protocols/http/utils_test.go
Files skipped from review as they are similar to previous changes: 1
pkg/protocols/http/utils_test.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
This file contains hidden or 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
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.
Fixes #8366
Mirrors projectdiscovery/rawhttp#568 in
newPipelinedRequest: a body the caller did not frame gets Content-Length, from req.ContentLength when set. Dev CI is red on TestPipelinedRequestDumpMatchesWire until this lands.Summary by CodeRabbit
Content-Lengthhandling for pipelined HTTP requests with a body. The header is now included only when neitherContent-LengthnorTransfer-Encodingis already present, and a supplied positive content length is preserved. This prevents conflicting length information and keeps request dumps consistent with the headers sent by the client.