ghttp_parser_received()

ghttp_parser_received()#

Parses an HTTP message from the given buffer using the ghttp_parser_create() instance.

Prototype

int ghttp_parser_received(
    GHTTP_PARSER *parser,
    char *buf,
    size_t received
);

Parameters

Key

Type

Description

parser

GHTTP_PARSER *

Pointer to the GHTTP_PARSER instance handling the HTTP parsing.

buf

char *

Pointer to the buffer containing the HTTP message data.

received

size_t

Number of bytes available in buf for parsing.


Return Value

Returns the number of bytes successfully parsed. Returns -1 if an error occurs during parsing.

Notes

[‘This function uses http_parser_execute() to process the HTTP message.’, ‘If the parser encounters an error, it logs the issue and returns -1.’, ‘The function checks for upgrade requests and handles them accordingly.’]

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples