Skip to content

合并主线#1

Open
willingbug wants to merge 16 commits into
willingbug:masterfrom
nodejs:master
Open

合并主线#1
willingbug wants to merge 16 commits into
willingbug:masterfrom
nodejs:master

Conversation

@willingbug
Copy link
Copy Markdown
Owner

No description provided.

ffontaine and others added 15 commits September 24, 2019 19:44
This allows "make install; make install" to work properly.

Retrieved from: https://git.buildroot.net/buildroot/tree/package/libhttpparser/0001-Use-f-option-when-calling-ln-at-install-time.patch

PR-URL: #492
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Renaud AUBIN <root@renaud.io>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
`Transfer-Encoding` header might have multiple codings in it. Even
though llhttp cares only about `chunked`, it must check that `chunked`
is the last coding (if present).

ABNF from RFC 7230:

```
Transfer-Encoding = *( "," OWS ) transfer-coding *( OWS "," [ OWS
    transfer-coding ] )
transfer-coding = "chunked" / "compress" / "deflate" / "gzip" /
    transfer-extension
   transfer-extension = token *( OWS ";" OWS transfer-parameter )
   transfer-parameter = token BWS "=" BWS ( token / quoted-string )
```

However, if `chunked` is not last - llhttp must assume that the encoding
and size of the body is unknown (according to 3.3.3 of RFC 7230) and
read the response until EOF. For request - the error must be raised for
an unknown `Transfer-Encoding`.

Furthermore, 3.3.3 of RFC 7230 explicitly states that presence of both
`Transfer-Encoding` and `Content-Length` indicates the smuggling attack
and "ought to be handled as an error".

For the lenient mode:

* Unknown `Transfer-Encoding` in requests is not an error and request
  body is simply read until EOF (end of connection)
* Only `Transfer-Encoding: chunked` together with `Content-Length` would
  result an error (just like before the patch)

PR-URL: nodejs-private/http-parser-private#4
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
It doesn't matter yet, but two tests had the same name, and same test
position macro.

PR-URL: #497
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Fix ABI breakage introduced in commit 7d5c99d ("Support multi-coding
Transfer-Encoding") by undoing the change in `sizeof(http_parser)`.

Restore the size of the `flags` field and shrink the `index` field from
7 to 5 bits. It track strings up to `strlen("Transfer-Encoding")` bytes
so 2^5 == 32 is wide enough.

Fixes: #502
PR-URL: #503
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
PR-URL: #506
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
PR-URL: #508
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
PR-URL: #184
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #511
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
It's -1 when no Content-Length field is present, not 0.

Fixes: #512
PR-URL: #513
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
The operands to `+` are promoted from `uint16_t` to `int` before
addition, making the expression `off + len <= buflen` emit a
warning because `buflen` is unsigned.

Fixes: #514
PR-URL: #515
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
The test suite did very little validation of the Content-Length field
until now. Verify for each request and response that the parsed numeric
value matches the value from the header field.

PR-URL: #519
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Fixes: #517
PR-URL: #518
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Pierce Lopez <pierce.lopez@gmail.com>
The result should be 32 on both 32 bits and 64 bits x86 because of
struct padding.

Fixes: #507
PR-URL: #510
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
I'm moving on and as the last (semi-)active maintainer, that means
http-parser is now effectively unmaintained.

Refs: #522
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@mhdawson mhdawson deleted the branch willingbug:master May 31, 2021 15:22
@mhdawson mhdawson deleted the master branch May 31, 2021 15:22
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.

10 participants