Skip to content

Commit 8b3939e

Browse files
committed
release: 2.2.0
1 parent 6da49eb commit 8b3939e

3 files changed

Lines changed: 3900 additions & 2579 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ were tried. However, all of them failed due to resulting significant performance
2222
degradation.
2323

2424
This project is a port of [http_parser][0] to TypeScript. [llparse][1] is used
25-
to generate the output C and/or bitcode artifacts, which could be compiled and
25+
to generate the output C source file, which could be compiled and
2626
linked with the embedder's program (like [Node.js][7]).
2727

2828
## Performance
@@ -31,7 +31,7 @@ So far llhttp outperforms http_parser:
3131

3232
| | input size | bandwidth | reqs/sec | time |
3333
|:----------------|-----------:|-------------:|-----------:|--------:|
34-
| **llhttp** _(C)_ | 8192.00 mb | 1777.24 mb/s | 3583799.39 ops/sec | 4.61 s |
34+
| **llhttp** | 8192.00 mb | 1777.24 mb/s | 3583799.39 ops/sec | 4.61 s |
3535
| **http_parser** | 8192.00 mb | 694.66 mb/s | 1406180.33 req/sec | 11.79 s |
3636

3737
llhttp is faster by approximately **156%**.

include/llhttp.h

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define INCLUDE_LLHTTP_H_
33

44
#define LLHTTP_VERSION_MAJOR 2
5-
#define LLHTTP_VERSION_MINOR 1
6-
#define LLHTTP_VERSION_PATCH 3
5+
#define LLHTTP_VERSION_MINOR 2
6+
#define LLHTTP_VERSION_PATCH 0
77

88
#ifndef LLHTTP_STRICT_MODE
99
# define LLHTTP_STRICT_MODE 0
@@ -145,7 +145,18 @@ enum llhttp_method {
145145
HTTP_LINK = 31,
146146
HTTP_UNLINK = 32,
147147
HTTP_SOURCE = 33,
148-
HTTP_PRI = 34
148+
HTTP_PRI = 34,
149+
HTTP_DESCRIBE = 35,
150+
HTTP_ANNOUNCE = 36,
151+
HTTP_SETUP = 37,
152+
HTTP_PLAY = 38,
153+
HTTP_PAUSE = 39,
154+
HTTP_TEARDOWN = 40,
155+
HTTP_GET_PARAMETER = 41,
156+
HTTP_SET_PARAMETER = 42,
157+
HTTP_REDIRECT = 43,
158+
HTTP_RECORD = 44,
159+
HTTP_FLUSH = 45
149160
};
150161
typedef enum llhttp_method llhttp_method_t;
151162

@@ -212,6 +223,17 @@ typedef enum llhttp_method llhttp_method_t;
212223
XX(32, UNLINK, UNLINK) \
213224
XX(33, SOURCE, SOURCE) \
214225
XX(34, PRI, PRI) \
226+
XX(35, DESCRIBE, DESCRIBE) \
227+
XX(36, ANNOUNCE, ANNOUNCE) \
228+
XX(37, SETUP, SETUP) \
229+
XX(38, PLAY, PLAY) \
230+
XX(39, PAUSE, PAUSE) \
231+
XX(40, TEARDOWN, TEARDOWN) \
232+
XX(41, GET_PARAMETER, GET_PARAMETER) \
233+
XX(42, SET_PARAMETER, SET_PARAMETER) \
234+
XX(43, REDIRECT, REDIRECT) \
235+
XX(44, RECORD, RECORD) \
236+
XX(45, FLUSH, FLUSH) \
215237

216238

217239

@@ -266,7 +288,12 @@ struct llhttp_settings_s {
266288
llhttp_cb on_chunk_complete;
267289
};
268290

269-
/* Initialize the parser with specific type and user settings */
291+
/* Initialize the parser with specific type and user settings.
292+
*
293+
* NOTE: lifetime of `settings` has to be at least the same as the lifetime of
294+
* the `parser` here. In practice, `settings` has to be either a static
295+
* variable or be allocated with `malloc`, `new`, etc.
296+
*/
270297
void llhttp_init(llhttp_t* parser, llhttp_type_t type,
271298
const llhttp_settings_t* settings);
272299

0 commit comments

Comments
 (0)