http-parser.c

Small C library to parse HTTP requests
Log | Files | Refs | README | LICENSE

commit bff11372aa811645511d4d93ae559b335af1d86d
parent dabb5410e763c372dfb7c05306c2a44c1c35b597
Author: finwo <finwo@pm.me>
Date:   Sat,  8 Jul 2023 22:30:43 +0200

Mark data ingest as const, as we're copying the data

Diffstat:
Msrc/http-parser.c | 8++++----
Msrc/http-parser.h | 8++++----
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/http-parser.c b/src/http-parser.c @@ -449,7 +449,7 @@ char * http_parser_sprint_request(struct http_parser_message *request) { * * Triggers onRequest if set */ -void http_parser_pair_request_data(struct http_parser_pair *pair, char *data, int size) { +void http_parser_pair_request_data(struct http_parser_pair *pair, const char *data, int size) { struct http_parser_event *ev; http_parser_request_data(pair->request, data, size); if (pair->request->ready && pair->onRequest) { @@ -469,7 +469,7 @@ void http_parser_pair_request_data(struct http_parser_pair *pair, char *data, in * * Triggers onRequest if set */ -void http_parser_pair_response_data(struct http_parser_pair *pair, char *data, int size) { +void http_parser_pair_response_data(struct http_parser_pair *pair, const char *data, int size) { struct http_parser_event *ev; http_parser_response_data(pair->request, data, size); if (pair->request->ready && pair->onResponse) { @@ -487,7 +487,7 @@ void http_parser_pair_response_data(struct http_parser_pair *pair, char *data, i /** * Insert data into a http_message, acting as if it's a request */ -void http_parser_request_data(struct http_parser_message *request, char *data, int size) { +void http_parser_request_data(struct http_parser_message *request, const char *data, int size) { char *index; char *aContentLength; int iContentLength; @@ -618,7 +618,7 @@ void http_parser_request_data(struct http_parser_message *request, char *data, i /** * Insert data into a http_message, acting as if it's a request */ -void http_parser_response_data(struct http_parser_message *response, char *data, int size) { +void http_parser_response_data(struct http_parser_message *response, const char *data, int size) { char *index; char *aStatus; int iContentLength; diff --git a/src/http-parser.h b/src/http-parser.h @@ -62,11 +62,11 @@ struct http_parser_message * http_parser_request_init(); struct http_parser_message * http_parser_response_init(); -void http_parser_request_data(struct http_parser_message *request, char *data, int size); -void http_parser_response_data(struct http_parser_message *response, char *data, int size); +void http_parser_request_data(struct http_parser_message *request, const char *data, int size); +void http_parser_response_data(struct http_parser_message *response, const char *data, int size); -void http_parser_pair_request_data(struct http_parser_pair *pair, char *data, int size); -void http_parser_pair_response_data(struct http_parser_pair *pair, char *data, int size); +void http_parser_pair_request_data(struct http_parser_pair *pair, const char *data, int size); +void http_parser_pair_response_data(struct http_parser_pair *pair, const char *data, int size); void http_parser_pair_free(struct http_parser_pair *pair); void http_parser_message_free(struct http_parser_message *subject);