From: Oleg Golosovskiy Date: Tue, 4 Oct 2011 12:20:14 +0000 (+0800) Subject: http charsets have case insensitive tokens X-Git-Tag: 1.2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ef75057cd39dd013db9bac1ee7ef70b4cbe8f0b;p=profile%2Fivi%2Flibwebsockets.git http charsets have case insensitive tokens Andy, According http://www.ietf.org/rfc/rfc2616.txt HTTP character sets are identified by case-insensitive tokens. Please replase if (strcmp(lws_tokens[n].token, wsi->name_buffer)) continue; to if (stricmp(lws_tokens[n].token, wsi->name_buffer)) continue; Oleg Also introduce strcasecmp definition for win32 Signed-off-by: Oleg Golosovskiy --- diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index cab2eb3..bb41428 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -37,6 +37,8 @@ extern "C" { #include "gettimeofday.h" +#define strcasecmp stricmp + #ifdef LWS_DLL #ifdef LWS_INTERNAL #define LWS_EXTERN extern __declspec(dllexport) diff --git a/lib/parsers.c b/lib/parsers.c index 01d360b..fb36323 100644 --- a/lib/parsers.c +++ b/lib/parsers.c @@ -179,7 +179,7 @@ int libwebsocket_parse(struct libwebsocket *wsi, unsigned char c) for (n = 0; n < WSI_TOKEN_COUNT; n++) { if (wsi->name_buffer_pos != lws_tokens[n].token_len) continue; - if (strcmp(lws_tokens[n].token, wsi->name_buffer)) + if (strcasecmp(lws_tokens[n].token, wsi->name_buffer)) continue; debug("known hdr '%s'\n", wsi->name_buffer); wsi->parser_state = WSI_TOKEN_GET_URI + n;