On 9/7/21 2:18 PM, Yann Ylavic wrote:
> Index: server/protocol.c
> ===================================================================
> --- server/protocol.c (revision 1893001)
> +++ server/protocol.c (working copy)
> @@ -716,6 +716,13 @@ static int read_request_line(request_rec *r, apr_b
>          if (rv != APR_SUCCESS) {
>              r->request_time = apr_time_now();
>  
> +            /* Fall through with an invalid (non NULL) request */
> +            r->method = "-";

In line 1484 of server/protocol.c we check for r->method being NULL to 
determine and log that we had a malformed request line
(AH00566). Hence this line would need to be adjusted as well.

> +            r->method_number = M_INVALID;
> +            r->uri = r->unparsed_uri = apr_pstrdup(r->pool, "-");

I would leave this NULL as in the normal path we don't need it and thus we are 
wasting pool memory with each request.

> +            r->proto_num = HTTP_VERSION(1,0);
> +            r->protocol  = "HTTP/1.0";
> +
>              /* ap_rgetline returns APR_ENOSPC if it fills up the
>               * buffer before finding the end-of-line.  This is only going to
>               * happen if it exceeds the configured limit for a request-line.
> @@ -732,8 +739,6 @@ static int read_request_line(request_rec *r, apr_b
>              else if (APR_STATUS_IS_EINVAL(rv)) {
>                  r->status = HTTP_BAD_REQUEST;
>              }
> -            r->proto_num = HTTP_VERSION(1,0);
> -            r->protocol  = "HTTP/1.0";
>              return 0;
>          }
>      } while ((len <= 0) && (--num_blank_lines >= 0));

Regards

RĂ¼diger

Reply via email to