At Thu, 14 Nov 2013 17:03:53 +0800,
Liu Yuan wrote:
> 
> This will remove the unnecessary setting conent length for 'get' operation
> 
> Signed-off-by: Liu Yuan <[email protected]>
> ---
>  sheep/http/http.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/sheep/http/http.c b/sheep/http/http.c
> index 8532378..644cdc5 100644
> --- a/sheep/http/http.c
> +++ b/sheep/http/http.c
> @@ -158,10 +158,12 @@ static int request_init_operation(struct http_request 
> *req)
>       }
>  
>       p = FCGX_GetParam("CONTENT_LENGTH", env);
> -     req->data_length = strtoll(p, &endp, 10);
> -     if (p == endp) {
> -             sd_err("invalid content_length %s", p);
> -             return BAD_REQUEST;
> +     if (strlen(p)) {

Checking p[0] != '\0' is enough and faster for a long string.

Thanks,

Kazutaka
-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to