Parser¶
Functions¶
-
ssize_t ymo_parse_http_request_line(ymo_http_exchange_t *request_in, const char *buffer, size_t len)¶
Used to parse HTTP exchange line.
- Parameters
request_in – HTTP exchange being parsed
buffer – input buffer from socket
len – number of bytes in the buffer from the last read event
- Returns
number of bytes parsed on success, -1 on failure.
-
ssize_t ymo_parse_http_crlf(ymo_http_exchange_t *request_in, const char *buffer, size_t len)¶
Used to parse CRLF between headers or at end of headers.
- Parameters
request_in – HTTP exchange being parsed
buffer – input buffer from socket
len – number of bytes in the buffer from the last read event
- Returns
number of bytes parsed on success, -1 on failure.
-
ssize_t ymo_parse_http_headers(ymo_http_session_t *session, ymo_http_exchange_t *request_in, const char *buffer, size_t len)¶
Used to parse HTTP headers.
- Parameters
request_in – HTTP exchange being parsed
buffer – input buffer from socket
len – number of bytes in the buffer from the last read event
- Returns
number of bytes parsed on success, -1 on failure.
-
ssize_t ymo_parse_http_body(ymo_http_body_cb_t body_cb, ymo_http_session_t *session, ymo_http_exchange_t *exchange, const char *buffer, size_t len)¶
Used to parse HTTP body.
- Parameters
body_cb – userspace body-data callabck (optional)
session – http session object (required if body_cb != NULL)
request_in – HTTP exchange being parsed
buffer – input buffer from socket
len – number of bytes in the buffer from the last read event
- Returns
number of bytes parsed on success, -1 on failure.