From: wessels <> Date: Mon, 1 Apr 1996 11:30:32 +0000 (+0000) Subject: misc cleanup and comments X-Git-Tag: SQUID_3_0_PRE1~6323 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e1a5fa76f4c19ed38217d78890df3a8d85405b4;p=thirdparty%2Fsquid.git misc cleanup and comments --- diff --git a/src/http.cc b/src/http.cc index 18294b3873..9fd728a3cd 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,4 +1,4 @@ -/* $Id: http.cc,v 1.18 1996/04/01 03:49:30 wessels Exp $ */ +/* $Id: http.cc,v 1.19 1996/04/01 04:30:32 wessels Exp $ */ /* * DEBUG: Section 11 http: HTTP @@ -149,8 +149,11 @@ static void httpProcessReplyHeader(data, buf) HttpData *data; char *buf; /* chunk just read by httpReadReply() */ { + char *s = NULL; char *t = NULL; StoreEntry *entry = data->entry; + char *headers = NULL; + int l; if (data->reply_hdr == NULL) { data->reply_hdr = get_free_8k_page(); @@ -169,14 +172,15 @@ static void httpProcessReplyHeader(data, buf) } } if (data->reply_hdr_state == 1) { - char *headers = xstrdup(data->reply_hdr); + headers = xstrdup(data->reply_hdr); data->reply_hdr_state++; debug(11, 9, "GOT HTTP REPLY HDR:\n---------\n%s\n----------\n", data->reply_hdr); t = strtok(headers, "\n"); while (t) { - while (t[strlen(t)] == '\r') - t[strlen(t)] = 0; + s = t+strlen(t); + while (*s == '\r') + *s-- = '\0'; if (!strncasecmp(t, "HTTP", 4)) { if ((t = strchr(t, ' '))) { t++; @@ -196,9 +200,9 @@ static void httpProcessReplyHeader(data, buf) t = strtok(NULL, "\n"); } if (data->http_code) - debug(11, 1, "httpReadReply: HTTP CODE: %d\n", data->http_code); + debug(11, 3, "httpReadReply: HTTP CODE: %d\n", data->http_code); if (data->content_length) - debug(11, 1, "httpReadReply: Content Length: %d\n", data->content_length); + debug(11, 3, "httpReadReply: Content Length: %d\n", data->content_length); /* If we know this is cachable we can unchange the key */ switch (data->http_code) { case 200: /* OK */ @@ -282,12 +286,10 @@ static void httpReadReply(fd, data) debug(11, 2, "httpReadReply: FD %d: read failure: %s.\n", fd, xstrerror()); if (errno == ECONNRESET) { - /* Connection reset by peer */ - /* consider it as a EOF */ + /* Connection reset by peer, junk the object */ + /* XXX this line we add assumes HTML. Should we lose it? -DPW */ sprintf(tmp_error_buf, "\n
Warning: The Remote Server sent RESET at the end of transmission.\n"); storeAppend(entry, tmp_error_buf, strlen(tmp_error_buf)); - /* The object is not cacheable */ - /* I am not sure if this is the right way to do it / Henrik */ BIT_RESET(entry->flag, CACHABLE); BIT_SET(entry->flag, RELEASE_REQUEST); storeComplete(entry);