kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 31eac77cd2b55b2b946c6f0e7d5780f2424f91a2
parent 51e1b14271061e78f054622f24e5fce70cd7189a
Author: Joris Vink <joris@coders.se>
Date:   Mon,  4 Aug 2014 09:48:41 +0200

sprinkle const char where appropriate

Diffstat:
includes/http.h | 11+++++++----
includes/kore.h | 2+-
src/http.c | 23+++++++++++++----------
src/spdy.c | 3++-
4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/includes/http.h b/includes/http.h @@ -199,10 +199,13 @@ void http_request_sleep(struct http_request *); void http_request_wakeup(struct http_request *); void http_process_request(struct http_request *, int); void http_response(struct http_request *, int, void *, u_int32_t); -int http_request_header_get(struct http_request *, char *, char **); -void http_response_header_add(struct http_request *, char *, char *); +int http_request_header_get(struct http_request *, + const char *, char **); +void http_response_header_add(struct http_request *, + const char *, const char *); int http_request_new(struct connection *, struct spdy_stream *, - char *, char *, char *, char *, struct http_request **); + const char *, const char *, const char *, const char *, + struct http_request **); int http_argument_urldecode(char *); int http_header_recv(struct netbuf *); @@ -211,7 +214,7 @@ int http_populate_arguments(struct http_request *); int http_populate_multipart_form(struct http_request *, int *); int http_argument_get(struct http_request *, const char *, void **, void *, u_int32_t *, int); -int http_file_lookup(struct http_request *, char *, char **, +int http_file_lookup(struct http_request *, const char *, char **, u_int8_t **, u_int32_t *); void kore_accesslog(struct http_request *); diff --git a/includes/kore.h b/includes/kore.h @@ -466,7 +466,7 @@ void kore_buf_replace_string(struct kore_buf *, char *, void *, size_t); struct spdy_header_block *spdy_header_block_create(int); struct spdy_stream *spdy_stream_lookup(struct connection *, u_int32_t); int spdy_stream_get_header(struct spdy_header_block *, - char *, char **); + const char *, char **); void spdy_update_wsize(struct connection *, struct spdy_stream *, u_int32_t); diff --git a/src/http.c b/src/http.c @@ -38,10 +38,10 @@ static void http_error_response(struct connection *, struct spdy_stream *, int); static u_int8_t *http_post_data_bytes(struct http_request *, u_int32_t *); -static void http_argument_add(struct http_request *, char *, +static void http_argument_add(struct http_request *, const char *, void *, u_int32_t, int); -static void http_file_add(struct http_request *, char *, char *, - u_int8_t *, u_int32_t); +static void http_file_add(struct http_request *, const char *, + const char *, u_int8_t *, u_int32_t); static void http_response_normal(struct http_request *, struct connection *, int, void *, u_int32_t); static void http_response_spdy(struct http_request *, @@ -77,8 +77,9 @@ http_init(void) } int -http_request_new(struct connection *c, struct spdy_stream *s, char *host, - char *method, char *path, char *version, struct http_request **out) +http_request_new(struct connection *c, struct spdy_stream *s, const char *host, + const char *method, const char *path, const char *version, + struct http_request **out) { char *p; struct http_request *req; @@ -283,7 +284,8 @@ http_process_request(struct http_request *req, int retry_only) } void -http_response_header_add(struct http_request *req, char *header, char *value) +http_response_header_add(struct http_request *req, + const char *header, const char *value) { struct http_header *hdr; @@ -392,7 +394,8 @@ http_response(struct http_request *req, int status, void *d, u_int32_t l) } int -http_request_header_get(struct http_request *req, char *header, char **out) +http_request_header_get(struct http_request *req, const char *header, + char **out) { int r; struct http_header *hdr; @@ -712,7 +715,7 @@ http_argument_urldecode(char *arg) } int -http_file_lookup(struct http_request *req, char *name, char **fname, +http_file_lookup(struct http_request *req, const char *name, char **fname, u_int8_t **data, u_int32_t *len) { struct http_file *f; @@ -890,7 +893,7 @@ http_generic_404(struct http_request *req) } static void -http_argument_add(struct http_request *req, char *name, +http_argument_add(struct http_request *req, const char *name, void *value, u_int32_t len, int type) { struct http_arg *q; @@ -933,7 +936,7 @@ http_argument_add(struct http_request *req, char *name, } static void -http_file_add(struct http_request *req, char *name, char *filename, +http_file_add(struct http_request *req, const char *name, const char *filename, u_int8_t *data, u_int32_t len) { struct http_file *f; diff --git a/src/spdy.c b/src/spdy.c @@ -288,7 +288,8 @@ spdy_header_block_release(struct connection *c, } int -spdy_stream_get_header(struct spdy_header_block *s, char *header, char **out) +spdy_stream_get_header(struct spdy_header_block *s, + const char *header, char **out) { char *cmp; u_int8_t *p, *end;