nodejs/llhttp

on_status_complete doesn't respect return HPE_PAUSED

MunifTanjim opened this issue · 0 comments

The api.h says on_status_complete can return HPE_PAUSED to pause the parser:

llhttp/src/native/api.h

Lines 44 to 47 in fdc5e1c

/* Possible return values 0, -1, `HPE_PAUSED` */
llhttp_cb on_message_complete;
llhttp_cb on_url_complete;
llhttp_cb on_status_complete;

But the return values from on_status_complete is not respected.

The test is broken too:

### on_status_complete
<!-- meta={"type": "response", "pause": "on_status_complete"} -->
```http
HTTP/1.1 200 OK
Content-Length: 3
abc
```
```log
off=0 message begin
off=13 len=2 span[status]="OK"
off=17 status complete
off=17 len=14 span[header_field]="Content-Length"
off=32 header_field complete
off=33 len=1 span[header_value]="3"
off=36 header_value complete
off=38 headers complete status=200 v=1/1 flags=20 content_length=3
off=38 len=3 span[body]="abc"
off=41 message complete
```

It's passing because of wrong assertion. There's not pause line in the log.