X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fcomstack.c;h=7ed6665e99e2ce22d401306f33ecde5f8d8da577;hb=83ac63cea12d7b176008739ac5fdafd01f628bef;hp=640b09b50b5a444d4210aa4af1edd289385b1e7f;hpb=078ac9ebd245ab061726b49c41218549665dc61e;p=yaz-moved-to-github.git diff --git a/src/comstack.c b/src/comstack.c index 640b09b..7ed6665 100644 --- a/src/comstack.c +++ b/src/comstack.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 1995-2003, Index Data + * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: comstack.c,v 1.2 2003-11-17 10:40:56 mike Exp $ + * $Id: comstack.c,v 1.4 2004-01-06 20:21:37 adam Exp $ */ #include @@ -14,6 +14,10 @@ #include #include +#ifdef WIN32 +#define strncasecmp _strnicmp +#endif + static const char *cs_errlist[] = { "No error or unspecified error", @@ -222,21 +226,21 @@ int cs_complete_auto(const unsigned char *buf, int len) } break; } - else if (i < len - 21 && - !memcmp(buf+i, "Transfer-Encoding: ", 18)) + else if (i < len - 20 && + !strncasecmp(buf+i, "Transfer-Encoding:", 18)) { i+=18; - if (buf[i] == ' ') + while (buf[i] == ' ') i++; if (i < len - 8) - if (!memcmp(buf+i, "chunked", 7)) + if (!strncasecmp(buf+i, "chunked", 7)) chunked = 1; } - else if (i < len - 18 && - !memcmp(buf+i, "Content-Length: ", 15)) + else if (i < len - 17 && + !strncasecmp(buf+i, "Content-Length:", 15)) { i+= 15; - if (buf[i] == ' ') + while (buf[i] == ' ') i++; content_len = 0; while (i <= len-4 && isdigit(buf[i]))