Oleg Guba
e13b274770
Allow Content-Length and Transfer-Encoding: chunked
...
Fixes: https://github.com/nodejs/http-parser/issues/517
PR-URL: https://github.com/nodejs/http-parser/pull/518
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Pierce Lopez <pierce.lopez@gmail.com >
2020-07-10 12:00:25 +02:00
Ben Noordhuis
5c5b3ac626
Update http_parser.content_length doc comment.
...
It's -1 when no Content-Length field is present, not 0.
Fixes: https://github.com/nodejs/http-parser/issues/512
PR-URL: https://github.com/nodejs/http-parser/pull/513
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2020-05-11 14:47:09 +02:00
Jacques Germishuys
55e736cd33
Solaris 9 doesn't have stdint.h, use inttypes.h
...
PR-URL: https://github.com/nodejs/http-parser/pull/184
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2020-05-04 12:01:54 +02:00
Ben Noordhuis
2343fd6b52
v2.9.4
2020-03-24 11:54:06 +01:00
Ben Noordhuis
714cbb2dfb
Fix ABI breakage
...
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: https://github.com/nodejs/http-parser/issues/502
PR-URL: https://github.com/nodejs/http-parser/pull/503
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2020-03-24 11:53:59 +01:00
Fedor Indutny
a0c034c0c7
v2.9.3
2020-02-06 10:04:53 +01:00
Fedor Indutny
7d5c99d09f
Support multi-coding Transfer-Encoding
...
`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: https://github.com/nodejs-private/http-parser-private/pull/4
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-02-06 10:04:04 +01:00
Ben Noordhuis
5c17dad400
v2.9.2
2019-04-16 08:33:39 +02:00
Fedor Indutny
c5c45636b8
v2.9.1
2019-04-10 17:00:29 -04:00
Ben Noordhuis
0d0a24e19e
v2.9.0
2018-12-28 08:28:50 +01:00
cjihrig
0ae8d93f73
support overriding HTTP_MAX_HEADER_SIZE at runtime
...
This commit adds http_parser_set_max_header_size(), which can
override the compile time HTTP_MAX_HEADER_SIZE value.
Fixes: https://github.com/nodejs/node/issues/24692
Refs: https://github.com/nodejs/node/pull/24811
PR-URL: https://github.com/nodejs/http-parser/pull/453
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2018-12-20 09:42:07 -05:00
Stefano Sambi
2ed7527795
Add http_status_str() function.
...
Fixes: https://github.com/nodejs/http-parser/issues/371
PR-URL: https://github.com/nodejs/http-parser/pull/429
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2018-05-30 16:57:03 +02:00
Ben Noordhuis
54f55a2f02
Bump version to 2.8.1
2018-03-31 08:07:55 +02:00
Fedor Indutny
dd74753cf5
Bump version to 2.8.0
2018-02-09 13:34:07 -05:00
Ben Noordhuis
921d558551
parser: add support for icecast SOURCE method
...
Fixes: https://github.com/nodejs/http-parser/issues/405
PR-URL: https://github.com/nodejs/http-parser/pull/407
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2018-02-09 00:38:24 +01:00
Stephan Gatzka
291a32cc51
Include stddef.h instead of sys/types.h.
...
The include is required for type size_t. stddef.h should be available
on every platform, sys/types.h is not.
PR-URL: https://github.com/nodejs/http-parser/pull/360
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-06-14 17:07:03 -04:00
Nathaniel McCallum
335850f6b8
parser: HTTP_STATUS_MAP(XX) and enum http_status
...
This patch provides an enum for the standardized HTTP status codes.
Additionally, the HTTP_STATUS_MAP(XX) can be used for other purposes as
well, such as code-to-name lookups and code-based switch statements.
PR-URL: https://github.com/nodejs/http-parser/pull/337
Reviewed-By: Fedor Indutny <fedor@indutny.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2016-10-18 18:53:31 -04:00
Fedor Indutny
feae95a3a6
Bump version to 2.7.1
2016-07-17 19:23:09 -04:00
Fedor Indutny
9b0d5b33eb
Bump version to 2.6.0
2016-04-19 10:41:48 -04:00
Fedor Indutny
04d28a7377
parser: returning 2 from on_headers_complete
...
Returning `2` from on_headers_complete will tell parser that it
should not expect neither a body nor any futher responses on
this connection. This is useful for handling responses to a
CONNECT request which may not contain `Upgrade` or
`Connection: upgrade` headers.
See: https://github.com/nodejs/node/pull/6198
PR-URL: https://github.com/nodejs/http-parser/pull/299
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-04-19 10:38:40 -04:00
Johan Bergström
dbcda1961c
Update http-parser to 2.6.2
...
Fixes a header parsing bug for obstext characters (> 0x80)
Adaption of nodejs/node@954a4b4b :
Author: James M Snell <jasnell@gmail.com >
Date: Mon Feb 15 09:40:58 2016 -0800
deps: update to http-parser 2.6.2
Fixes http-parser regression with IS_HEADER_CHAR check
Add test case for obstext characters (> 0x80) is header
PR-URL: https://github.com/nodejs/node/pull/5237
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
PR-URL: https://github.com/nodejs/http-parser/pull/287
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-03-04 12:27:05 -08:00
James M Snell
e2e467b912
Update http-parser to 2.6.1
...
Includes parsing improvements to ensure closer HTTP spec conformance
Adaption of nodejs/node@4f4c8ab3b4 :
Author: James M Snell <jasnell@gmail.com >
Date: Wed Feb 3 17:28:48 2016 -0800
deps: update http-parser to version 2.6.1
includes parsing improvements to ensure closer HTTP spec conformance
PR-URL: https://github.com/nodejs/node-private/pull/26
Reviewed-By: Rod Vagg <r@va.gg >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
PR-URL: https://github.com/nodejs/http-parser/pull/279
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-02-09 19:58:17 -08:00
James M Snell
bee4817ebe
Bump version to 2.6.0
2015-10-28 21:47:12 -07:00
Fedor Indutny
777ba4eded
src: introduce http_parser_url_init
...
The struct must be zero-initialized, but this wasn't explicitly stated
anywhere in headers. Introduce `http_parser_url_init` API method that
will do it.
Fixes : #209
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
PR-URL: https://github.com/nodejs/http-parser/pull/225
2015-10-27 08:03:33 -07:00
Olivier Mengué
e557b62744
src: support LINK/UNLINK (RFC 2068, draft-snell-link-method)
...
Add support for HTTP methods LINK and UNLINK originally defined in RFC2068
section 19.6.2.2, but with semantic added in a Internet draft.
https://tools.ietf.org/html/rfc2068#section-19.6.1.2
https://tools.ietf.org/html/draft-snell-link-method-12
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Fedor Induty <fedor@indutny.com >
PR-URL: https://github.com/nodejs/http-parser/pull/267
2015-10-26 13:41:46 -07:00
Andrew Udvare
b36c2a9ece
header: treat Wine like MinGW
...
PR-URL: https://github.com/joyent/http-parser/pull/259
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2015-07-22 19:12:02 -07:00
Ivan Enderlin
eb5e9928b4
src: support ACL (WebDAV, RFC3744, Section 8.1).
...
PR-URL: https://github.com/joyent/http-parser/pull/260
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2015-07-20 23:30:14 -07:00
Ivan Enderlin
8b1d652322
src: support BIND/REBIND/UNBIND (WebDAV, RFC5842)
...
Support BIND/REBIND/UNBIND methods, see sections 4, 5, 6 of
RFC5842.
PR-URL: https://github.com/joyent/http-parser/pull/242
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2015-07-15 20:22:56 -07:00
Fedor Indutny
39c2c1e573
Bump version to 2.5.0
2015-04-24 15:44:31 +02:00
Kjell Schubert
d7675453a6
src: callbacks chunk boundaries: header/complete
...
(Proxygen fork merge D508755 D521404, orig author simpkins@fb.com )
Fix : #231
PR-URL: https://github.com/joyent/http-parser/pull/233
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2015-04-23 11:54:47 +02:00
Fedor Indutny
7ba312397c
header: fix field sizes
...
The flags enum does not fit into 6 bits anymore.
Fix : #218
PR-URL: https://github.com/joyent/http-parser/pull/219
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-02-15 18:26:11 +01:00
Romain Giraud
53063b780b
Add function to initialize http_parser_settings
...
PR-URL: https://github.com/joyent/http-parser/pull/215
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2015-01-26 14:47:29 +03:00
Fedor Indutny
1b31580893
Bump version to 2.4.2
2015-01-25 21:22:01 +03:00
Fedor Indutny
36f107fa2e
Bump version to 2.4.1
2015-01-14 15:59:25 +03:00
Fedor Indutny
956c8a054a
Bump version to 2.4.0
2015-01-14 02:49:50 +03:00
Jon Kolb
091ebb8778
src: simple Connection header multi-value parsing
...
Reviewed-By: Fedor Indutny <fedor@indutny.com >
PR-URL: https://github.com/joyent/http-parser/pull/100
2014-12-05 17:00:06 +03:00
Marc O'Morain
11ecb42061
Docs fix
...
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2014-09-09 16:26:45 +01:00
Maciej Małecki
7bbb77467f
doc: add very basic docs for http_parser_execute
...
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2014-08-24 22:19:49 +04:00
George Miroshnykov
17ed7deb7c
header: typo fix in a comment
...
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2014-08-22 17:31:34 +04:00
Helge Heß
1317eeca43
Added support for MKCALENDAR
...
Signed-off-by: Fedor Indutny <fedor@indutny.com >
2014-06-27 13:28:56 +04:00
Vinnie Falco
24e2d2d43f
Allow HTTP_MAX_HEADER_SIZE to be defined externally
2014-03-17 14:31:29 +04:00
Fedor Indutny
56f7ad0e2e
Bump version to 2.3.0
2014-03-13 13:18:11 +04:00
Fedor Indutny
cba704cb2d
Bump version to 2.2.1
2014-01-29 03:17:31 +04:00
Fedor Indutny
fd609ab272
Bump version to 2.2
2013-12-20 17:32:41 +04:00
Patrik Stutz
d7b938bdca
Parse and emit status message of response
2013-12-19 15:56:06 +04:00
Charlie Somerville
11419c8e41
Use unsigned int as bitfield type.
2013-11-19 12:43:27 +01:00
Ben Noordhuis
d3264312e1
Add function http_parser_version().
...
Fixes #115 .
2013-08-21 02:48:14 +02:00
Ben Noordhuis
6df37aa52d
build: set SONAME in shared object file
...
Fixes #151 .
2013-06-13 21:38:32 +02:00
Ben Noordhuis
8081938445
Bump to version 2.1
2013-03-26 23:35:20 +01:00
Tóth Tamás
0938fe599f
Add on_status_complete callback.
...
Add a "status complete" callback to support Simple-Response handling with HTTP
version <= 1.0.
Patch by Tóth Tamás, tests by Corey Richardson.
2012-12-17 14:56:05 +01:00