fix parse_request_line not detecting the uri correctly in some cases webdav

Wed, 11 May 2022 20:31:26 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 11 May 2022 20:31:26 +0200
branch
webdav
changeset 351
5533db9b64e2
parent 350
abba342112c2
child 352
d0a7ef49db0f

fix parse_request_line not detecting the uri correctly in some cases

src/server/daemon/httpparser.c file | annotate | diff | comparison | revisions
--- a/src/server/daemon/httpparser.c	Tue May 10 19:13:01 2022 +0200
+++ b/src/server/daemon/httpparser.c	Wed May 11 20:31:26 2022 +0200
@@ -187,7 +187,6 @@
     for(;i<line.length;i++) {
         if(!ns && line.ptr[i] == ' ') {
             ns = 1;
-            //line.ptr[i] = 0; // TODO: remove
             parser->request->method.length = i;
         } else if(ns) {
             if(line.ptr[i] != ' ') {
@@ -200,9 +199,8 @@
     ns = 0;
     int s = i;
     for(;i<line.length;i++) {
-        if(!ns && line.ptr[i] < 33) {
+        if(!ns && isspace(line.ptr[i])) {
             ns = 1;
-            //line.ptr[i] = 0; // TODO: remove
             parser->request->uri.length = i - s;
         } else if(ns) {
             if(line.ptr[i] > 32) {
@@ -215,9 +213,8 @@
     ns = 0;
     s = i;
     for(;i<line.length;i++) {
-        if(!ns && line.ptr[i] < 33) {
+        if(!ns && isspace(line.ptr[i])) {
             ns = 1;
-            //line.ptr[i] = 0; // TODO: remove
             parser->request->httpv.length = i - s;
         } else if(ns) {
             if(line.ptr[i] > 32) {

mercurial