httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: what to do about CGI and chunked
Date Sat, 23 Nov 1996 19:18:29 GMT
Roy T. Fielding wrote:
>   int setup_client_block (request_rec *r)
>   {
> !     char *tenc = table_get(r->headers_in, "Transfer-Encoding");
> !     char *lenp = table_get(r->headers_in, "Content-length");
>   
>       if (tenc) {
> !         if (strcasecmp(tenc, "chunked")) {
> !             log_printf(r->server, "Unknown Transfer-Encoding %s", tenc);
> !             return HTTP_BAD_REQUEST;
> !         }
> !         if (r->read_body == REQUEST_CHUNKED_ERROR) {
> !             log_reason("chunked Transfer-Encoding forbidden", r->uri, r);
> !             return HTTP_LENGTH_REQUIRED;

Doesn't seem right... HTTP_BAD_REQUEST seems the most appropriate. But
shouldn't there also be a test for length here?

> !         }
> ! 
> !         r->read_chunked = 1;
> !         r->remaining = 0;
>       }
> !     else if (lenp) {
> !         char *pos = lenp;
> ! 
> !         while (isdigit(*pos) || isspace(*pos)) ++pos;
> !         if (*pos != '\0') {
> !             log_printf(r->server, "Invalid Content-Length %s", lenp);
> !             return HTTP_BAD_REQUEST;
> !         }
> ! 
> !         r->remaining = atol(lenp);
> !     }
> ! 
> !     if ((r->read_body == REQUEST_NO_BODY) &&
> !         (r->read_chunked || (r->remaining > 0))) {
> !         log_printf(r->server, "%s with body is not allowed for %s",
> !                    r->method, r->uri);
> !         return HTTP_REQUEST_ENTITY_TOO_LARGE;
>       }
>   
>       return OK;

-- 
Ben Laurie                Phone: +44 (181) 994 6435  Email: ben@algroup.co.uk
Freelance Consultant and  Fax:   +44 (181) 994 6472
Technical Director        URL: http://www.algroup.co.uk/Apache-SSL
A.L. Digital Ltd,         Apache Group member (http://www.apache.org)
London, England.          Apache-SSL author

Mime
View raw message