/*
- * $Id: http.cc,v 1.183 1997/08/11 02:29:08 wessels Exp $
+ * $Id: http.cc,v 1.184 1997/08/24 00:37:03 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
/* return 1 if we got the last of the data on a persistent connection */
MemObject *mem = httpState->entry->mem_obj;
struct _http_reply *reply = mem->reply;
- debug(0, 0) ("httpPconnTransferDone: FD %d\n", httpState->fd);
+ debug(11, 3) ("httpPconnTransferDone: FD %d\n", httpState->fd);
if (!BIT_TEST(httpState->flags, HTTP_KEEPALIVE))
return 0;
- debug(0, 0) ("httpPconnTransferDone: content_length=%d\n",
+ debug(11, 5) ("httpPconnTransferDone: content_length=%d\n",
reply->content_length);
/*
* !200 replies maybe don't have content-length, so
* If there is a content_length, see if we've got all of it. If so,
* then we can recycle this connection.
*/
- debug(0, 0) ("httpPconnTransferDone: hdr_sz=%d\n", reply->hdr_sz);
- debug(0, 0) ("httpPconnTransferDone: e_current_len=%d\n",
+ debug(11, 5) ("httpPconnTransferDone: hdr_sz=%d\n", reply->hdr_sz);
+ debug(11, 5) ("httpPconnTransferDone: e_current_len=%d\n",
mem->e_current_len);
if (mem->e_current_len < reply->content_length + reply->hdr_sz)
return 0;
storeStartDeleteBehind(entry);
#endif
if ((fd = pconnPop(e->host, e->http_port)) >= 0) {
- debug(0, 0) ("httpStart: reusing pconn FD %d\n", fd);
+ debug(11, 3) ("httpStart: reusing pconn FD %d\n", fd);
httpState = httpBuildState(fd, entry, request, e);
commSetTimeout(httpState->fd,
Config.Timeout.connect,
}
} else {
if ((fd = pconnPop(request->host, request->port)) >= 0) {
- debug(0, 0) ("httpStart: reusing pconn FD %d\n", fd);
+ debug(11, 3) ("httpStart: reusing pconn FD %d\n", fd);
httpState = httpBuildState(fd, entry, request, e);
commSetTimeout(httpState->fd,
Config.Timeout.connect,
httpRestart(HttpStateData * httpState)
{
/* restart a botched request from a persistent connection */
- debug(0, 0) ("Retrying HTTP request for %s\n", httpState->entry->url);
+ debug(11, 1) ("Retrying HTTP request for %s\n", httpState->entry->url);
if (httpState->fd >= 0) {
comm_remove_close_handler(httpState->fd, httpStateFree, httpState);
comm_close(httpState->fd);
+/*
+ * $Id: pconn.cc,v 1.3 1997/08/24 00:37:04 wessels Exp $
+ *
+ * DEBUG: section 48 Persistent Connections
+ * AUTHOR: Duane Wessels
+ *
+ * SQUID Internet Object Cache http://squid.nlanr.net/Squid/
+ * --------------------------------------------------------
+ *
+ * Squid is the result of efforts by numerous individuals from the
+ * Internet community. Development is led by Duane Wessels of the
+ * National Laboratory for Applied Network Research and funded by
+ * the National Science Foundation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
#include "squid.h"
{
struct _pconn *p = xcalloc(1, sizeof(struct _pconn));
p->key = xstrdup(key);
- debug(0, 0) ("pconnNew: adding %s\n", p->key);
+ debug(48, 3) ("pconnNew: adding %s\n", p->key);
hash_join(table, (hash_link *) p);
return p;
}
{
hash_link *hptr = hash_lookup(table, p->key);
assert(hptr != NULL);
- debug(0, 0) ("pconnDelete: deleting %s\n", p->key);
+ debug(48, 3) ("pconnDelete: deleting %s\n", p->key);
hash_remove_link(table, hptr);
}
break;
}
assert(i < p->nfds);
- debug(0, 0) ("pconnRemoveFD: found FD %d at index %d\n", fd, i);
+ debug(48, 3) ("pconnRemoveFD: found FD %d at index %d\n", fd, i);
for (; i < p->nfds - 1; i++)
p->fds[i] = p->fds[i + 1];
if (--p->nfds == 0)
{
struct _pconn *p = data;
assert(table != NULL);
- debug(0, 0) ("pconnTimeout: FD %d %s\n", fd, p->key);
+ debug(48, 3) ("pconnTimeout: FD %d %s\n", fd, p->key);
pconnRemoveFD(p, fd);
comm_close(fd);
}
int n;
assert(table != NULL);
n = read(fd, buf, 256);
- debug(0, 0) ("pconnRead: %d bytes from FD %d, %s\n", n, fd, p->key);
+ debug(48, 3) ("pconnRead: %d bytes from FD %d, %s\n", n, fd, p->key);
pconnRemoveFD(p, fd);
comm_close(fd);
}
{
assert(table == NULL);
table = hash_create((HASHCMP *) strcmp, 229, hash_string);
- debug(0, 0) ("persistent connection module initialized\n");
+ debug(48, 3) ("persistent connection module initialized\n");
}
void
if (p == NULL)
p = pconnNew(key);
if (p->nfds == PCONN_MAX_FDS) {
- debug(0, 0) ("pconnPush: %s already has %d unused connections\n",
+ debug(48, 3) ("pconnPush: %s already has %d unused connections\n",
key, p->nfds);
close(fd);
xfree(key);
p->fds[p->nfds++] = fd;
commSetSelect(fd, COMM_SELECT_READ, pconnRead, p, 0);
commSetTimeout(fd, Config.Timeout.pconn, pconnTimeout, p);
- debug(0, 0) ("pconnPush: pushed FD %d for %s\n", fd, key);
+ debug(48, 3) ("pconnPush: pushed FD %d for %s\n", fd, key);
}
int