1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

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 <ogolosovskiy@unison.com>
This commit is contained in:
Oleg Golosovskiy 2011-10-04 20:20:14 +08:00 committed by Andy Green
parent 7b11fec7ca
commit 2ef75057cd
2 changed files with 3 additions and 1 deletions

View file

@ -37,6 +37,8 @@ extern "C" {
#include "gettimeofday.h"
#define strcasecmp stricmp
#ifdef LWS_DLL
#ifdef LWS_INTERNAL
#define LWS_EXTERN extern __declspec(dllexport)

View file

@ -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;