1
1
#ifndef INCLUDE_LLHTTP_H_
2
2
#define INCLUDE_LLHTTP_H_
3
3
4
- #define LLHTTP_VERSION_MAJOR 1
5
- #define LLHTTP_VERSION_MINOR 1
6
- #define LLHTTP_VERSION_PATCH 4
4
+ #define LLHTTP_VERSION_MAJOR 2
5
+ #define LLHTTP_VERSION_MINOR 0
6
+ #define LLHTTP_VERSION_PATCH 1
7
7
8
8
#ifndef INCLUDE_LLHTTP_ITSELF_H_
9
9
#define INCLUDE_LLHTTP_ITSELF_H_
@@ -29,7 +29,7 @@ struct llhttp__internal_s {
29
29
uint8_t http_major ;
30
30
uint8_t http_minor ;
31
31
uint8_t header_state ;
32
- uint8_t flags ;
32
+ uint16_t flags ;
33
33
uint8_t upgrade ;
34
34
uint16_t status_code ;
35
35
uint8_t finish ;
@@ -85,7 +85,8 @@ enum llhttp_flags {
85
85
F_UPGRADE = 0x10 ,
86
86
F_CONTENT_LENGTH = 0x20 ,
87
87
F_SKIPBODY = 0x40 ,
88
- F_TRAILING = 0x80
88
+ F_TRAILING = 0x80 ,
89
+ F_LENIENT = 0x100
89
90
};
90
91
typedef enum llhttp_flags llhttp_flags_t ;
91
92
@@ -297,7 +298,7 @@ llhttp_errno_t llhttp_finish(llhttp_t* parser);
297
298
int llhttp_message_needs_eof (const llhttp_t * parser );
298
299
299
300
/* Returns `1` if there might be any other messages following the last that was
300
- * successfuly parsed.
301
+ * successfully parsed.
301
302
*/
302
303
int llhttp_should_keep_alive (const llhttp_t * parser );
303
304
@@ -353,6 +354,18 @@ const char* llhttp_errno_name(llhttp_errno_t err);
353
354
/* Returns textual name of HTTP method */
354
355
const char * llhttp_method_name (llhttp_method_t method );
355
356
357
+
358
+ /* Enables/disables lenient header value parsing (disabled by default).
359
+ *
360
+ * Lenient parsing disables header value token checks, extending llhttp's
361
+ * protocol support to highly non-compliant clients/server. No
362
+ * `HPE_INVALID_HEADER_TOKEN` will be raised for incorrect header values when
363
+ * lenient parsing is "on".
364
+ *
365
+ * **(USE AT YOUR OWN RISK)**
366
+ */
367
+ void llhttp_set_lenient (llhttp_t * parser , int enabled );
368
+
356
369
#ifdef __cplusplus
357
370
} /* extern "C" */
358
371
#endif
0 commit comments