commit d1589c96fa7b0f4a54340682937727013fee4c84
Author:     Hiltjo Posthuma <[email protected]>
AuthorDate: Tue Jun 27 22:19:27 2017 +0200
Commit:     Laslo Hunhold <[email protected]>
CommitDate: Tue Jun 27 23:31:08 2017 +0200

    header parsing: allow tabs are whitespace, compare case-insensitive
    
    this is more conforming the HTTP spec

diff --git a/quark.c b/quark.c
index 0560d1b..d25bf1d 100644
--- a/quark.c
+++ b/quark.c
@@ -271,7 +271,7 @@ getrequest(int fd, struct request *r)
        /* match field type */
        for (; *p != '\0';) {
                for (i = 0; i < NUM_REQ_FIELDS; i++) {
-                       if (!strncmp(p, req_field_str[i],
+                       if (!strncasecmp(p, req_field_str[i],
                                     strlen(req_field_str[i]))) {
                                break;
                        }
@@ -293,7 +293,7 @@ getrequest(int fd, struct request *r)
                }
 
                /* skip whitespace */
-               for (++p; *p == ' '; p++)
+               for (++p; *p == ' ' || *p == '\t'; p++)
                        ;
 
                /* extract field content */

Reply via email to