From 96ef9bcda0583ac46b2e896090f06c0642718724 Mon Sep 17 00:00:00 2001 From: zhaojh329 Date: Mon, 7 Sep 2020 14:31:21 +0800 Subject: [PATCH] Don't const for 'struct uh_str' Signed-off-by: zhaojh329 --- example/example.c | 8 ++++---- src/connection.c | 8 ++++---- src/connection.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/example/example.c b/example/example.c index 378ec68..49ada62 100644 --- a/example/example.c +++ b/example/example.c @@ -36,10 +36,10 @@ static const char *index_page = "index.html"; static void on_request(struct uh_connection *conn) { if (!serve_file) { - const struct uh_str path = conn->get_path(conn); - const struct uh_str query = conn->get_query(conn); - const struct uh_str ua = conn->get_header(conn, "User-Agent"); - const struct uh_str body = conn->get_body(conn); + struct uh_str path = conn->get_path(conn); + struct uh_str query = conn->get_query(conn); + struct uh_str ua = conn->get_header(conn, "User-Agent"); + struct uh_str body = conn->get_body(conn); conn->send_head(conn, HTTP_STATUS_OK, -1, NULL); conn->chunk_printf(conn, "I'm Libuhttpd: %s\n", UHTTPD_VERSION_STRING); diff --git a/src/connection.c b/src/connection.c index 796ffbc..4191d63 100644 --- a/src/connection.c +++ b/src/connection.c @@ -173,7 +173,7 @@ static const char *conn_get_method_str(struct uh_connection *conn) return http_method_str(conn->parser.method); } -static const struct uh_str conn_get_path(struct uh_connection *conn) +static struct uh_str conn_get_path(struct uh_connection *conn) { struct http_parser_url *u = &conn->url_parser; struct uh_request *req = &conn->req; @@ -185,7 +185,7 @@ static const struct uh_str conn_get_path(struct uh_connection *conn) return path; } -static const struct uh_str conn_get_query(struct uh_connection *conn) +static struct uh_str conn_get_query(struct uh_connection *conn) { struct http_parser_url *u = &conn->url_parser; struct uh_request *req = &conn->req; @@ -200,7 +200,7 @@ static const struct uh_str conn_get_query(struct uh_connection *conn) return query; } -static const struct uh_str conn_get_header(struct uh_connection *conn, const char *name) +static struct uh_str conn_get_header(struct uh_connection *conn, const char *name) { struct uh_request *req = &conn->req; int name_len = strlen(name); @@ -222,7 +222,7 @@ static const struct uh_str conn_get_header(struct uh_connection *conn, const cha return value; } -static const struct uh_str conn_get_body(struct uh_connection *conn) +static struct uh_str conn_get_body(struct uh_connection *conn) { return conn->req.body; } diff --git a/src/connection.h b/src/connection.h index 8a02f91..3230983 100644 --- a/src/connection.h +++ b/src/connection.h @@ -98,10 +98,10 @@ struct uh_connection { void (*chunk_end)(struct uh_connection *conn); enum http_method (*get_method)(struct uh_connection *conn); const char *(*get_method_str)(struct uh_connection *conn); - const struct uh_str (*get_path)(struct uh_connection *conn); - const struct uh_str (*get_query)(struct uh_connection *conn); - const struct uh_str (*get_header)(struct uh_connection *conn, const char *name); - const struct uh_str (*get_body)(struct uh_connection *conn); + struct uh_str (*get_path)(struct uh_connection *conn); + struct uh_str (*get_query)(struct uh_connection *conn); + struct uh_str (*get_header)(struct uh_connection *conn, const char *name); + struct uh_str (*get_body)(struct uh_connection *conn); }; struct uh_connection *uh_new_connection(struct uh_server *srv, int sock, struct sockaddr_in *addr);