Prechádzať zdrojové kódy

Fixed MHD_get_response_header(): used case-insensitive match for header name, use only headers

Evgeny Grin (Karlson2k) 8 rokov pred
rodič
commit
6894504f51
2 zmenil súbory, kde vykonal 10 pridanie a 4 odobranie
  1. 5 1
      ChangeLog
  2. 5 3
      src/microhttpd/response.c

+ 5 - 1
ChangeLog

@@ -1,4 +1,8 @@
-Tue May  5 20:57:00 MSK 2017
+Mon May  8 19:30:00 MSK 2017
+	Fixed: use case-insensitive matching for header name in
+	MHD_get_response_header(), match only headers (not footers). -EG
+
+Fri May  5 20:57:00 MSK 2017
 	Fixed null dereference when connection has "Upgrade" request and 
 	connection is not upgraded.  -JB/EG
 	Better handle Keep-Alive/Close. -EG

+ 5 - 3
src/microhttpd/response.c

@@ -240,9 +240,11 @@ MHD_get_response_header (struct MHD_Response *response,
   if (NULL == key)
     return NULL;
   for (pos = response->first_header; NULL != pos; pos = pos->next)
-    if (0 == strcmp (key,
-                     pos->header))
-      return pos->value;
+    {
+      if ( (pos->kind == MHD_HEADER_KIND) &&
+           MHD_str_equal_caseless_ (pos->header, key) )
+        return pos->value;
+    }
   return NULL;
 }