X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=comstack%2Fcomstack.c;h=1488704de5ce7e7853175572799d1a9033cb3cd5;hb=6588b4176290d756fa422b9b93e297ddba3e22d8;hp=583817acf85858d96df49ebe352cfc20eee25438;hpb=4b849a9cafeb427c261a7f0e52d28edd3043ae27;p=yaz-moved-to-github.git diff --git a/comstack/comstack.c b/comstack/comstack.c index 583817a..1488704 100644 --- a/comstack/comstack.c +++ b/comstack/comstack.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: comstack.c,v 1.14 2003-04-24 13:04:45 adam Exp $ + * $Id: comstack.c,v 1.16 2003-10-20 18:21:45 adam Exp $ */ #include @@ -99,10 +99,10 @@ COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp) host = type_and_host + 6; if (host[0] == '/' && host[1] == '/') host = host + 2; + proto = PROTO_HTTP; #else return 0; #endif - proto = PROTO_HTTP; } else { @@ -129,10 +129,6 @@ int cs_look (COMSTACK cs) int cs_complete_auto(const unsigned char *buf, int len) { - if (!len) - return 0; - if (!buf[0] && !buf[1]) - return 0; if (len > 5 && buf[0] >= 0x20 && buf[0] < 0x7f && buf[1] >= 0x20 && buf[1] < 0x7f && buf[2] >= 0x20 && buf[2] < 0x7f) @@ -142,6 +138,8 @@ int cs_complete_auto(const unsigned char *buf, int len) while (i <= len-4) { + if (i > 8192) + return i; /* do not allow more than 8K HTTP header */ if (buf[i] == '\r' && buf[i+1] == '\n') { i += 2; @@ -153,7 +151,6 @@ int cs_complete_auto(const unsigned char *buf, int len) { int chunk_len = 0; i += 2; - #if 0 /* debugging */ if (i = (i+2)+ content_len)