[hackers] [quark] header parsing: allow tabs are whitespace, compare case-insensitive || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 27 Jun 2017 23:31:29 +0200 (CEST)

commit d1589c96fa7b0f4a54340682937727013fee4c84
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Tue Jun 27 22:19:27 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
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
_AT_@ -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;
                         }
_AT_@ -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 */
Received on Tue Jun 27 2017 - 23:31:29 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 27 2017 - 23:36:51 CEST