Merge branch 'insp3' into master.

This commit is contained in:
Sadie Powell 2023-02-22 19:09:36 +00:00
commit ff686c5a78
6 changed files with 41 additions and 16 deletions

View File

@ -16,6 +16,8 @@ jobs:
- name: Setup Conan - name: Setup Conan
uses: turtlebrowser/get-conan@v1.2 uses: turtlebrowser/get-conan@v1.2
with:
version: 1.59.0
- name: Install libraries - name: Install libraries
working-directory: ${{ github.workspace }}/win/build working-directory: ${{ github.workspace }}/win/build

4
vendor/README.md vendored
View File

@ -28,9 +28,9 @@ This directory contains vendored dependencies that are shipped with InspIRCd to
**License** — MIT License **License** — MIT License
**Version** — v2.9.4 **Version** — debian/2.9.4-5
**Website** — [https://github.com/nodejs/http-parser](https://github.com/nodejs/http-parser) **Website** — [https://git.in-ulm.de/cbiedl/http-parser](https://git.in-ulm.de/cbiedl/http-parser)
## lyra ## lyra

View File

@ -653,6 +653,8 @@ size_t http_parser_execute (http_parser *parser,
const char *status_mark = 0; const char *status_mark = 0;
enum state p_state = (enum state) parser->state; enum state p_state = (enum state) parser->state;
const unsigned int lenient = parser->lenient_http_headers; const unsigned int lenient = parser->lenient_http_headers;
const unsigned int allow_chunked_length = parser->allow_chunked_length;
uint32_t nread = parser->nread; uint32_t nread = parser->nread;
/* We're in an error state. Don't bother doing anything. */ /* We're in an error state. Don't bother doing anything. */
@ -731,7 +733,7 @@ reexecute:
if (ch == CR || ch == LF) if (ch == CR || ch == LF)
break; break;
parser->flags = 0; parser->flags = 0;
parser->extra_flags = 0; parser->uses_transfer_encoding = 0;
parser->content_length = ULLONG_MAX; parser->content_length = ULLONG_MAX;
if (ch == 'H') { if (ch == 'H') {
@ -769,7 +771,7 @@ reexecute:
if (ch == CR || ch == LF) if (ch == CR || ch == LF)
break; break;
parser->flags = 0; parser->flags = 0;
parser->extra_flags = 0; parser->uses_transfer_encoding = 0;
parser->content_length = ULLONG_MAX; parser->content_length = ULLONG_MAX;
if (ch == 'H') { if (ch == 'H') {
@ -927,7 +929,7 @@ reexecute:
if (ch == CR || ch == LF) if (ch == CR || ch == LF)
break; break;
parser->flags = 0; parser->flags = 0;
parser->extra_flags = 0; parser->uses_transfer_encoding = 0;
parser->content_length = ULLONG_MAX; parser->content_length = ULLONG_MAX;
if (UNLIKELY(!IS_ALPHA(ch))) { if (UNLIKELY(!IS_ALPHA(ch))) {
@ -1341,7 +1343,14 @@ reexecute:
parser->header_state = h_general; parser->header_state = h_general;
} else if (parser->index == sizeof(TRANSFER_ENCODING)-2) { } else if (parser->index == sizeof(TRANSFER_ENCODING)-2) {
parser->header_state = h_transfer_encoding; parser->header_state = h_transfer_encoding;
parser->extra_flags |= F_TRANSFER_ENCODING >> 8; parser->uses_transfer_encoding = 1;
/* Multiple `Transfer-Encoding` headers should be treated as
* one, but with values separate by a comma.
*
* See: https://tools.ietf.org/html/rfc7230#section-3.2.2
*/
parser->flags &= ~F_CHUNKED;
} }
break; break;
@ -1801,14 +1810,19 @@ reexecute:
REEXECUTE(); REEXECUTE();
} }
/* Cannot us transfer-encoding and a content-length header together /* Cannot use transfer-encoding and a content-length header together
per the HTTP specification. (RFC 7230 Section 3.3.3) */ per the HTTP specification. (RFC 7230 Section 3.3.3) */
if ((parser->extra_flags & (F_TRANSFER_ENCODING >> 8)) && if ((parser->uses_transfer_encoding == 1) &&
(parser->flags & F_CONTENTLENGTH)) { (parser->flags & F_CONTENTLENGTH)) {
/* Allow it for lenient parsing as long as `Transfer-Encoding` is /* Allow it for lenient parsing as long as `Transfer-Encoding` is
* not `chunked` * not `chunked` or allow_length_with_encoding is set
*/ */
if (!lenient || (parser->flags & F_CHUNKED)) { if (parser->flags & F_CHUNKED) {
if (!allow_chunked_length) {
SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH);
goto error;
}
} else if (!lenient) {
SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH); SET_ERRNO(HPE_UNEXPECTED_CONTENT_LENGTH);
goto error; goto error;
} }
@ -1889,7 +1903,7 @@ reexecute:
/* chunked encoding - ignore Content-Length header, /* chunked encoding - ignore Content-Length header,
* prepare for a chunk */ * prepare for a chunk */
UPDATE_STATE(s_chunk_size_start); UPDATE_STATE(s_chunk_size_start);
} else if (parser->extra_flags & (F_TRANSFER_ENCODING >> 8)) { } else if (parser->uses_transfer_encoding == 1) {
if (parser->type == HTTP_REQUEST && !lenient) { if (parser->type == HTTP_REQUEST && !lenient) {
/* RFC 7230 3.3.3 */ /* RFC 7230 3.3.3 */
@ -2165,7 +2179,7 @@ http_message_needs_eof (const http_parser *parser)
} }
/* RFC 7230 3.3.3, see `s_headers_almost_done` */ /* RFC 7230 3.3.3, see `s_headers_almost_done` */
if ((parser->extra_flags & (F_TRANSFER_ENCODING >> 8)) && if ((parser->uses_transfer_encoding == 1) &&
(parser->flags & F_CHUNKED) == 0) { (parser->flags & F_CHUNKED) == 0) {
return 1; return 1;
} }
@ -2517,7 +2531,7 @@ http_parser_parse_url(const char *buf, size_t buflen, int is_connect,
end = buf + off + len; end = buf + off + len;
/* NOTE: The characters are already validated and are in the [0-9] range */ /* NOTE: The characters are already validated and are in the [0-9] range */
assert(off + len <= buflen && "Port number overflow"); assert((size_t) (off + len) <= buflen && "Port number overflow");
v = 0; v = 0;
for (p = buf + off; p < end; p++) { for (p = buf + off; p < end; p++) {
v *= 10; v *= 10;

View File

@ -225,7 +225,6 @@ enum flags
, F_UPGRADE = 1 << 5 , F_UPGRADE = 1 << 5
, F_SKIPBODY = 1 << 6 , F_SKIPBODY = 1 << 6
, F_CONTENTLENGTH = 1 << 7 , F_CONTENTLENGTH = 1 << 7
, F_TRANSFER_ENCODING = 1 << 8 /* Never set in http_parser.flags */
}; };
@ -300,7 +299,10 @@ struct http_parser {
unsigned int state : 7; /* enum state from http_parser.c */ unsigned int state : 7; /* enum state from http_parser.c */
unsigned int header_state : 7; /* enum header_state from http_parser.c */ unsigned int header_state : 7; /* enum header_state from http_parser.c */
unsigned int index : 5; /* index into current matcher */ unsigned int index : 5; /* index into current matcher */
unsigned int extra_flags : 2; unsigned int uses_transfer_encoding : 1; /* Transfer-Encoding header is present */
unsigned int allow_chunked_length : 1; /* Allow headers with both
* `Content-Length` and
* `Transfer-Encoding: chunked` set */
unsigned int lenient_http_headers : 1; unsigned int lenient_http_headers : 1;
uint32_t nread; /* # bytes read in various scenarios */ uint32_t nread; /* # bytes read in various scenarios */

6
vendor/update vendored
View File

@ -55,6 +55,12 @@ while (my ($name, $info) = each %{$data}) {
chomp(my $tag = `git -C $unpackdir describe --abbrev=0 --tags HEAD 2>/dev/null`) unless $success; chomp(my $tag = `git -C $unpackdir describe --abbrev=0 --tags HEAD 2>/dev/null`) unless $success;
$success ||= execute 'git', '-C', $unpackdir, 'checkout', $tag if $tag; $success ||= execute 'git', '-C', $unpackdir, 'checkout', $tag if $tag;
chomp($info->{version} = `git -C $unpackdir describe --always --tags HEAD 2>/dev/null`); chomp($info->{version} = `git -C $unpackdir describe --always --tags HEAD 2>/dev/null`);
if (defined $info->{patches}) {
my $patches = catfile($unpackdir, $info->{patches});
for my $patch (glob $patches) {
$success |= execute 'git', '-C', $unpackdir, 'apply', $patch;
}
}
} elsif (defined $info->{tarball}) { } elsif (defined $info->{tarball}) {
my $tarball = catfile $unpackdir, basename $info->{tarball}; my $tarball = catfile $unpackdir, basename $info->{tarball};
$success ||= execute 'wget', '--output-document', $tarball, $info->{tarball}; $success ||= execute 'wget', '--output-document', $tarball, $info->{tarball};

3
vendor/update.toml vendored
View File

@ -17,8 +17,9 @@ license = "MIT License"
[http_parser] [http_parser]
author = "Joyent, Inc. and other Node contributors" author = "Joyent, Inc. and other Node contributors"
files = "{http_parser.[ch],LICENSE-MIT}" files = "{http_parser.[ch],LICENSE-MIT}"
git = "https://github.com/nodejs/http-parser" git = "https://git.in-ulm.de/cbiedl/http-parser"
license = "MIT License" license = "MIT License"
patches = "debian/patches/*.patch"
[lyra] [lyra]
author = "Build Frameworks Group" author = "Build Frameworks Group"