[backfire] merge r22602 & r22607
[openwrt-10.03/.git] / package / uhttpd / src / uhttpd.c
index be882470ad0b0988605a8e695c3e44488b3f1165..764ff7d5703b332ddfdbc4bd2e9f5eb63265dcc7 100644 (file)
@@ -266,7 +266,8 @@ static struct http_request * uh_http_header_parse(struct client *cl, char *buffe
                }
 
                /* check version */
-               if( strcmp(version, "HTTP/0.9") && strcmp(version, "HTTP/1.0") && strcmp(version, "HTTP/1.1") )
+               if( (version == NULL) || (strcmp(version, "HTTP/0.9") &&
+                   strcmp(version, "HTTP/1.0") && strcmp(version, "HTTP/1.1")) )
                {
                        /* unsupported version */
                        uh_http_response(cl, 400, "Bad Request");
@@ -1001,13 +1002,6 @@ int main (int argc, char **argv)
                                                }
                                        }
 
-                                       /* 400 */
-                                       else
-                                       {
-                                               uh_http_sendhf(cl, 400, "Bad Request",
-                                                       "Malformed request received");
-                                       }
-
 #ifdef HAVE_TLS
                                        /* free client tls context */
                                        if( conf.tls )