summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-02-10 03:07:05 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2019-02-10 03:10:11 -0500
commitdaa5f7c576538b1fe711e81f08bb7da618370c17 (patch)
treeed2809b8048254ef00e2cae0c51d67506e72e4b3
parent950832af67d6e9bb0a0f22766cd52edb50fc7895 (diff)
downloadlighttpd1.4-daa5f7c576538b1fe711e81f08bb7da618370c17.tar.gz
lighttpd1.4-daa5f7c576538b1fe711e81f08bb7da618370c17.zip
[mod_accesslog] attempt to reconstruct req line
cease http_request_parse_reqline() unconditionally copying request line, as request line is currently used only by mod_accesslog 'r' format
-rw-r--r--src/base.h2
-rw-r--r--src/connections.c3
-rw-r--r--src/mod_accesslog.c9
-rw-r--r--src/request.c2
-rw-r--r--src/t/test_request.c3
5 files changed, 6 insertions, 13 deletions
diff --git a/src/base.h b/src/base.h
index 1f56303b..833856d6 100644
--- a/src/base.h
+++ b/src/base.h
@@ -32,8 +32,6 @@ typedef struct {
http_method_t http_method;
http_version_t http_version;
- buffer *request_line;
-
/* strings to the header */
buffer *http_host; /* not alloced */
diff --git a/src/connections.c b/src/connections.c
index bdd4e19d..1c33ca1f 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -534,7 +534,6 @@ static connection *connection_init(server *srv) {
con->x = buffer_init();
CLEAN(request.uri);
- CLEAN(request.request_line);
CLEAN(request.request);
CLEAN(request.pathinfo);
@@ -599,7 +598,6 @@ void connections_free(server *srv) {
buffer_free(con->x);
CLEAN(request.uri);
- CLEAN(request.request_line);
CLEAN(request.request);
CLEAN(request.pathinfo);
@@ -652,7 +650,6 @@ static int connection_reset(server *srv, connection *con) {
buffer_reset(con->x);
CLEAN(request.uri);
- CLEAN(request.request_line);
CLEAN(request.pathinfo);
/* CLEAN(request.orig_uri); */
diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c
index 5a64cf1d..753cdb4b 100644
--- a/src/mod_accesslog.c
+++ b/src/mod_accesslog.c
@@ -946,9 +946,12 @@ REQUESTDONE_FUNC(log_access_write) {
}
break;
case FORMAT_REQUEST_LINE:
- if (!buffer_string_is_empty(con->request.request_line)) {
- accesslog_append_escaped(b, con->request.request_line);
- }
+ /*(attempt to reconstruct request line)*/
+ buffer_append_string(b, get_http_method_name(con->request.http_method));
+ buffer_append_string_len(b, CONST_STR_LEN(" "));
+ accesslog_append_escaped(b, con->request.orig_uri);
+ buffer_append_string_len(b, CONST_STR_LEN(" "));
+ buffer_append_string(b, get_http_version_name(con->request.http_version));
break;
case FORMAT_STATUS:
buffer_append_int(b, con->http_status);
diff --git a/src/request.c b/src/request.c
index c9b5bc9f..191840c2 100644
--- a/src/request.c
+++ b/src/request.c
@@ -612,8 +612,6 @@ static size_t http_request_parse_reqline(server *srv, connection *con, buffer *h
return http_request_header_line_invalid(srv, 400, "missing CR before LF in header -> 400");
}
- buffer_copy_string_len(con->request.request_line, ptr, i);
-
if (NULL == proto) {
return http_request_header_line_invalid(srv, 400, "incomplete request line -> 400");
}
diff --git a/src/t/test_request.c b/src/t/test_request.c
index 0e940ac6..644c2e6b 100644
--- a/src/t/test_request.c
+++ b/src/t/test_request.c
@@ -21,7 +21,6 @@ static void test_request_connection_reset(connection *con)
con->http_status = 0;
buffer_reset(con->proto);
buffer_reset(con->request.request);
- buffer_reset(con->request.request_line);
buffer_reset(con->request.orig_uri);
buffer_reset(con->request.uri);
array_reset(con->request.headers);
@@ -462,7 +461,6 @@ int main (void)
memset(&con, 0, sizeof(connection));
con.proto = buffer_init();
con.request.request = buffer_init();
- con.request.request_line = buffer_init();
con.request.orig_uri = buffer_init();
con.request.uri = buffer_init();
con.request.headers = array_init();
@@ -475,7 +473,6 @@ int main (void)
buffer_free(con.proto);
buffer_free(con.request.request);
- buffer_free(con.request.request_line);
buffer_free(con.request.orig_uri);
buffer_free(con.request.uri);
array_free(con.request.headers);