llhttp icon indicating copy to clipboard operation
llhttp copied to clipboard

http_status

Open misery opened this issue 3 years ago • 4 comments

Hi,

we tried to move from http_parser to llhttp. Is it possible to provide a http_status, too?

misery avatar Apr 21 '21 13:04 misery

Hello!

Do you mean the methods for converting status code to string?

indutny avatar Apr 21 '21 19:04 indutny

FWIW, llhttp_get_status_code can be used to get the status code out of the parser.

indutny avatar Apr 21 '21 19:04 indutny

Yes, I mean the enum to provide STATUS::OK instead of 200 and so on to avoid mistake with a wrong int.

misery avatar Apr 21 '21 19:04 misery

How can I do something like this? There is no HTTP_STATUS_ anymore.

int statusCode = llhttp_get_status_code();
if (statusCode == HTTP_STATUS_OK)
{
...
}

misery avatar Dec 21 '21 08:12 misery

We can import statuses from https://github.com/nodejs/http-parser/blob/main/http_parser.h - Will send a PR soon!

ShogunPanda avatar Aug 22 '22 13:08 ShogunPanda

LMK if you'd like any help with that!

pallas avatar Aug 22 '22 17:08 pallas

@pallas Can you review the PR above?

ShogunPanda avatar Aug 23 '22 10:08 ShogunPanda