[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
personal/stbuehler/fix-fdevent
Glenn Strauss 4 years ago
parent 950832af67
commit daa5f7c576
  1. 2
      src/base.h
  2. 3
      src/connections.c
  3. 9
      src/mod_accesslog.c
  4. 2
      src/request.c
  5. 3
      src/t/test_request.c

@ -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 */

@ -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); */

@ -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);

@ -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");
}

@ -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);

Loading…
Cancel
Save