llhttp 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/ext/llhttp/api.c +8 -2
- data/ext/llhttp/llhttp.c +4 -4
- data/ext/llhttp/llhttp.h +1 -1
- data/ext/llhttp/llhttp_ext.c +13 -0
- data/lib/llhttp/parser.rb +4 -0
- data/lib/llhttp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ee045e3bd145819a128933ba6e2bdc42493055e523afb6f96eb1b19e7efe5f9
|
4
|
+
data.tar.gz: 2143e6db1b7ff74e412b7839e1584380040d61f680596ed427b759638c1f837c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43be9c7c4858ae2e5862f0ae20f42a53f4bf2d526fb95bb879c108422f8cc5da1865e6a05037fc47eae4d4c0c7522046bbfc192e0204ee96478278cec623e3f7
|
7
|
+
data.tar.gz: '09049aaa065e7467a4a570b231273412eb3d66b9a3be342422eaf779e32b19a87e950a45e1b4720f50f179ce0c17f62295c67f86e10d360d5cc21a9d653f2a19'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## v0.4.0
|
2
|
+
|
3
|
+
*released on 2021-09-09*
|
4
|
+
|
5
|
+
* `add` [#25](https://github.com/metabahn/llhttp/pull/25) Add support for resetting the parser ([bryanp](https://github.com/bryanp))
|
6
|
+
* `chg` [#24](https://github.com/metabahn/llhttp/pull/24) Update mri to llhttp 6.0.5 ([bryanp](https://github.com/bryanp))
|
7
|
+
|
1
8
|
## v0.3.0
|
2
9
|
|
3
10
|
*released on 2021-05-06*
|
data/README.md
CHANGED
data/ext/llhttp/api.c
CHANGED
@@ -69,17 +69,23 @@ extern int wasm_on_url(llhttp_t* p, const char* at, size_t length);
|
|
69
69
|
extern int wasm_on_status(llhttp_t* p, const char* at, size_t length);
|
70
70
|
extern int wasm_on_header_field(llhttp_t* p, const char* at, size_t length);
|
71
71
|
extern int wasm_on_header_value(llhttp_t* p, const char* at, size_t length);
|
72
|
-
extern int wasm_on_headers_complete(llhttp_t * p
|
72
|
+
extern int wasm_on_headers_complete(llhttp_t * p, int status_code,
|
73
|
+
uint8_t upgrade, int should_keep_alive);
|
73
74
|
extern int wasm_on_body(llhttp_t* p, const char* at, size_t length);
|
74
75
|
extern int wasm_on_message_complete(llhttp_t * p);
|
75
76
|
|
77
|
+
static int wasm_on_headers_complete_wrap(llhttp_t* p) {
|
78
|
+
return wasm_on_headers_complete(p, p->status_code, p->upgrade,
|
79
|
+
llhttp_should_keep_alive(p));
|
80
|
+
}
|
81
|
+
|
76
82
|
const llhttp_settings_t wasm_settings = {
|
77
83
|
wasm_on_message_begin,
|
78
84
|
wasm_on_url,
|
79
85
|
wasm_on_status,
|
80
86
|
wasm_on_header_field,
|
81
87
|
wasm_on_header_value,
|
82
|
-
|
88
|
+
wasm_on_headers_complete_wrap,
|
83
89
|
wasm_on_body,
|
84
90
|
wasm_on_message_complete,
|
85
91
|
NULL,
|
data/ext/llhttp/llhttp.c
CHANGED
@@ -1126,7 +1126,7 @@ static llparse_state_t llhttp__internal__run(
|
|
1126
1126
|
case s_n_llhttp__internal__n_consume_content_length:
|
1127
1127
|
s_n_llhttp__internal__n_consume_content_length: {
|
1128
1128
|
size_t avail;
|
1129
|
-
|
1129
|
+
uint64_t need;
|
1130
1130
|
|
1131
1131
|
avail = endp - p;
|
1132
1132
|
need = state->content_length;
|
@@ -1481,7 +1481,7 @@ static llparse_state_t llhttp__internal__run(
|
|
1481
1481
|
case s_n_llhttp__internal__n_consume_content_length_1:
|
1482
1482
|
s_n_llhttp__internal__n_consume_content_length_1: {
|
1483
1483
|
size_t avail;
|
1484
|
-
|
1484
|
+
uint64_t need;
|
1485
1485
|
|
1486
1486
|
avail = endp - p;
|
1487
1487
|
need = state->content_length;
|
@@ -8700,7 +8700,7 @@ static llparse_state_t llhttp__internal__run(
|
|
8700
8700
|
case s_n_llhttp__internal__n_consume_content_length:
|
8701
8701
|
s_n_llhttp__internal__n_consume_content_length: {
|
8702
8702
|
size_t avail;
|
8703
|
-
|
8703
|
+
uint64_t need;
|
8704
8704
|
|
8705
8705
|
avail = endp - p;
|
8706
8706
|
need = state->content_length;
|
@@ -9048,7 +9048,7 @@ static llparse_state_t llhttp__internal__run(
|
|
9048
9048
|
case s_n_llhttp__internal__n_consume_content_length_1:
|
9049
9049
|
s_n_llhttp__internal__n_consume_content_length_1: {
|
9050
9050
|
size_t avail;
|
9051
|
-
|
9051
|
+
uint64_t need;
|
9052
9052
|
|
9053
9053
|
avail = endp - p;
|
9054
9054
|
need = state->content_length;
|
data/ext/llhttp/llhttp.h
CHANGED
data/ext/llhttp/llhttp_ext.c
CHANGED
@@ -154,6 +154,18 @@ VALUE rb_llhttp_finish(VALUE self) {
|
|
154
154
|
return Qtrue;
|
155
155
|
}
|
156
156
|
|
157
|
+
VALUE rb_llhttp_reset(VALUE self) {
|
158
|
+
llhttp_t *parser;
|
159
|
+
|
160
|
+
Data_Get_Struct(self, llhttp_t, parser);
|
161
|
+
|
162
|
+
llhttp_settings_t *settings = parser->settings;
|
163
|
+
|
164
|
+
llhttp_reset(parser);
|
165
|
+
|
166
|
+
return Qtrue;
|
167
|
+
}
|
168
|
+
|
157
169
|
VALUE rb_llhttp_content_length(VALUE self) {
|
158
170
|
llhttp_t *parser;
|
159
171
|
|
@@ -301,6 +313,7 @@ void Init_llhttp_ext(void) {
|
|
301
313
|
rb_define_method(cParser, "<<", rb_llhttp_parse, 1);
|
302
314
|
rb_define_method(cParser, "parse", rb_llhttp_parse, 1);
|
303
315
|
rb_define_method(cParser, "finish", rb_llhttp_finish, 0);
|
316
|
+
rb_define_method(cParser, "reset", rb_llhttp_reset, 0);
|
304
317
|
|
305
318
|
rb_define_method(cParser, "content_length", rb_llhttp_content_length, 0);
|
306
319
|
rb_define_method(cParser, "method_name", rb_llhttp_method_name, 0);
|
data/lib/llhttp/parser.rb
CHANGED
@@ -30,6 +30,10 @@ module LLHttp
|
|
30
30
|
#
|
31
31
|
# Call `LLHttp::Parser#finish` when processing is complete for the current request or response.
|
32
32
|
#
|
33
|
+
# Resetting
|
34
|
+
#
|
35
|
+
# Call `LLHttp::Parser#reset` to reset the parser for the next request or response.
|
36
|
+
#
|
33
37
|
class Parser
|
34
38
|
LLHTTP_TYPES = {both: 0, request: 1, response: 2}.freeze
|
35
39
|
|
data/lib/llhttp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llhttp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby bindings for llhttp.
|
14
14
|
email: bryan@metabahn.com
|