@@ -486,11 +486,13 @@ class Parser : public AsyncWrap, public StreamListener {
486
486
487
487
static void Initialize (const FunctionCallbackInfo<Value>& args) {
488
488
Environment* env = Environment::GetCurrent (args);
489
+ bool lenient = args[3 ]->IsTrue ();
489
490
490
491
uint64_t max_http_header_size = 0 ;
491
492
492
493
CHECK (args[0 ]->IsInt32 ());
493
494
CHECK (args[1 ]->IsObject ());
495
+
494
496
if (args.Length () > 2 ) {
495
497
CHECK (args[2 ]->IsNumber ());
496
498
max_http_header_size = args[2 ].As <Number>()->Value ();
@@ -515,7 +517,7 @@ class Parser : public AsyncWrap, public StreamListener {
515
517
516
518
parser->set_provider_type (provider);
517
519
parser->AsyncReset (args[1 ].As <Object>());
518
- parser->Init (type, max_http_header_size);
520
+ parser->Init (type, max_http_header_size, lenient );
519
521
}
520
522
521
523
template <bool should_pause>
@@ -762,8 +764,9 @@ class Parser : public AsyncWrap, public StreamListener {
762
764
}
763
765
764
766
765
- void Init (llhttp_type_t type, uint64_t max_http_header_size) {
767
+ void Init (llhttp_type_t type, uint64_t max_http_header_size, bool lenient ) {
766
768
llhttp_init (&parser_, type, &settings);
769
+ llhttp_set_lenient (&parser_, lenient);
767
770
header_nread_ = 0 ;
768
771
url_.Reset ();
769
772
status_message_.Reset ();
0 commit comments