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)) {
+               req->data_length = strtoll(p, &endp, 10);
+               if (p == endp) {
+                       sd_err("invalid content_length %s", p);
+                       return BAD_REQUEST;
+               }
        }
        req->uri = FCGX_GetParam("REQUEST_URI", env);
        if (!req->uri)
-- 
1.7.9.5

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

Reply via email to