--------------------- PatchSet 4679 Date: 2002/08/15 01:22:18 Author: rbcollins Branch: esi Tag: (none) Log: clean up clientHttpRequest a little Members: src/client_side.c:1.65.2.9->1.65.2.10 src/client_side_reply.c:1.1.2.7->1.1.2.8 src/client_side_request.c:1.1.2.6->1.1.2.7 src/structs.h:1.61.2.2->1.61.2.3 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.65.2.9 retrieving revision 1.65.2.10 diff -u -r1.65.2.9 -r1.65.2.10 --- squid/src/client_side.c 15 Aug 2002 01:19:31 -0000 1.65.2.9 +++ squid/src/client_side.c 15 Aug 2002 01:22:18 -0000 1.65.2.10 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.65.2.9 2002/08/15 01:19:31 rbcollins Exp $ + * $Id: client_side.c,v 1.65.2.10 2002/08/15 01:22:18 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -305,9 +305,9 @@ requestUnlink(http->request); /* ESI TODO: push refcount class through to head */ { - clientStreamNode *temp = http->stream_head.head->data; + clientStreamNode *temp = http->client_stream.head->data; cbdataReferenceDone (temp); - cbdataFree (http->stream_head.head->data); + cbdataFree (http->client_stream.head->data); } assert(http != http->next); if (conn) { @@ -614,7 +614,7 @@ case 3: /* More data will be coming from the stream. */ http->reqofs = 0; - clientStreamRead (http->stream_head.tail->data, http, http->out.offset, + clientStreamRead (http->client_stream.tail->data, http, http->out.offset, HTTP_REQBUF_SZ, http->reqbuf); @@ -636,7 +636,7 @@ http->uri = xstrdup(uri); http->log_uri = xstrndup(uri, MAX_URL); http->reqbuf = http->norm_reqbuf; - clientStreamInit (&http->stream_head, clientGetMoreData, clientReplyNewContext (http), clientSocketRecipient, NULL); + clientStreamInit (&http->client_stream, clientGetMoreData, clientReplyNewContext (http), clientSocketRecipient, NULL); dlinkAdd(http, &http->active, &ClientActiveRequests); return http; } @@ -794,7 +794,7 @@ http->start = current_time; http->req_sz = prefix_sz; http->reqbuf = http->norm_reqbuf; - clientStreamInit (&http->stream_head, clientGetMoreData, clientReplyNewContext (http), clientSocketRecipient, NULL); + clientStreamInit (&http->client_stream, clientGetMoreData, clientReplyNewContext (http), clientSocketRecipient, NULL); *prefix_p = xmalloc(prefix_sz + 1); xmemcpy(*prefix_p, conn->in.buf, prefix_sz); *(*prefix_p + prefix_sz) = '\0'; @@ -1120,24 +1120,24 @@ conn->nrequests++; commSetTimeout(fd, Config.Timeout.lifetime, clientLifetimeTimeout, http); if (parser_return_code < 0) { - clientStreamNode *node = http->stream_head.tail->prev->data; + clientStreamNode *node = http->client_stream.tail->prev->data; debug(33, 1) ("clientReadRequest: FD %d Invalid Request\n", fd); clientSetReplyToError (node->data, ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, NULL, &conn->peer.sin_addr, NULL, conn->in.buf, NULL); - clientStreamRead (http->stream_head.tail->data, http, 0, + clientStreamRead (http->client_stream.tail->data, http, 0, HTTP_REQBUF_SZ, http->reqbuf); safe_free(prefix); break; } if ((request = urlParse(method, http->uri)) == NULL) { - clientStreamNode *node = http->stream_head.tail->prev->data; + clientStreamNode *node = http->client_stream.tail->prev->data; debug(33, 5) ("Invalid URL: %s\n", http->uri); clientSetReplyToError (node->data, ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, &conn->peer.sin_addr, NULL, NULL, NULL); - clientStreamRead (http->stream_head.tail->data, http, 0, + clientStreamRead (http->client_stream.tail->data, http, 0, HTTP_REQBUF_SZ, http->reqbuf); safe_free(prefix); @@ -1178,19 +1178,19 @@ request->http_ver = http->http_ver; if (!urlCheckRequest(request) || httpHeaderHas(&request->header, HDR_TRANSFER_ENCODING)) { - clientStreamNode *node = http->stream_head.tail->prev->data; + clientStreamNode *node = http->client_stream.tail->prev->data; clientSetReplyToError (node->data,ERR_UNSUP_REQ, HTTP_NOT_IMPLEMENTED, request->method, NULL, &conn->peer.sin_addr, request, NULL, NULL); - clientStreamRead (http->stream_head.tail->data, http, 0, + clientStreamRead (http->client_stream.tail->data, http, 0, HTTP_REQBUF_SZ, http->reqbuf); break; } if (!clientCheckContentLength(request)) { - clientStreamNode *node = http->stream_head.tail->prev->data; + clientStreamNode *node = http->client_stream.tail->prev->data; clientSetReplyToError (node->data,ERR_INVALID_REQ, HTTP_LENGTH_REQUIRED, request->method, NULL, &conn->peer.sin_addr, request, NULL, NULL); - clientStreamRead (http->stream_head.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); + clientStreamRead (http->client_stream.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); break; } http->request = requestLink(request); @@ -1201,10 +1201,10 @@ request->body_connection = conn; /* Is it too large? */ if (clientRequestBodyTooLarge(request->content_length)) { - clientStreamNode *node = http->stream_head.tail->prev->data; + clientStreamNode *node = http->client_stream.tail->prev->data; clientSetReplyToError (node->data,ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE,METHOD_NONE, NULL, &conn->peer.sin_addr, http->request, NULL, NULL); - clientStreamRead (http->stream_head.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); + clientStreamRead (http->client_stream.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); break; } } @@ -1219,7 +1219,7 @@ /* The request is too large to handle */ clientStreamNode *node; http = parseHttpRequestAbort(conn, "error:request-too-large"); - node = http->stream_head.tail->prev->data; + node = http->client_stream.tail->prev->data; debug(33, 1) ("Request header is too large (%d bytes)\n", (int) conn->in.offset); debug(33, 1) ("Config 'request_header_max_size'= %ld bytes.\n", @@ -1229,7 +1229,7 @@ /* add to the client request queue */ for (H = &conn->chr; *H; H = &(*H)->next); *H = http; - clientStreamRead (http->stream_head.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); + clientStreamRead (http->client_stream.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); return; } break; @@ -1382,7 +1382,7 @@ clientHttpRequest **H; clientStreamNode *node; clientHttpRequest *http = parseHttpRequestAbort(conn, "error:Connection%20lifetime%20expired"); - node = http->stream_head.tail->prev->data; + node = http->client_stream.tail->prev->data; clientSetReplyToError (node->data,ERR_LIFETIME_EXP, HTTP_REQUEST_TIMEOUT,METHOD_NONE, "N/A", &conn->peer.sin_addr, NULL, NULL, NULL); /* No requests can be outstanded */ @@ -1390,7 +1390,7 @@ /* add to the client request queue */ for (H = &conn->chr; *H; H = &(*H)->next); *H = http; - clientStreamRead (http->stream_head.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); + clientStreamRead (http->client_stream.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); /* * if we don't close() here, we still need a timeout handler! */ Index: squid/src/client_side_reply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_reply.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- squid/src/client_side_reply.c 15 Aug 2002 01:19:31 -0000 1.1.2.7 +++ squid/src/client_side_reply.c 15 Aug 2002 01:22:18 -0000 1.1.2.8 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.c,v 1.1.2.7 2002/08/15 01:19:31 rbcollins Exp $ + * $Id: client_side_reply.c,v 1.1.2.8 2002/08/15 01:22:18 rbcollins Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -541,7 +541,7 @@ */ /* now write this back to the requester */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, e, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); } @@ -603,7 +603,7 @@ http->entry = clientCreateStoreEntry(context, r->method, null_request_flags); errorAppendEntry(http->entry, err); /* and trigger a read of the resulting object */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, http->entry, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); return; @@ -612,7 +612,7 @@ assert(http->out.offset == 0); http->entry = clientCreateStoreEntry(context, r->method, r->flags); /* And trigger a read of the resultant object */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, http->entry, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); if (http->redirect.status) { @@ -659,7 +659,7 @@ } http->entry = clientCreateStoreEntry(context, r->method, null_request_flags); /* And trigger a read of the resultant object */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, http->entry, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); errorAppendEntry(http->entry, err); @@ -682,7 +682,7 @@ http->request); http->entry = clientCreateStoreEntry(context, http->request->method, null_request_flags); /* And trigger a read of the resultant object */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, http->entry, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); errorAppendEntry(http->entry, err); @@ -757,7 +757,7 @@ */ http->entry = clientCreateStoreEntry(context, http->request->method, null_request_flags); /* And trigger a read of the resultant object */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, http->entry, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); httpReplyReset(r = http->entry->mem_obj->reply); @@ -1177,7 +1177,7 @@ if (context->http->request->max_forwards == 0) { HttpReply *rep; http_version_t version; - clientStreamNode *node = http->stream_head.tail->prev->data; + clientStreamNode *node = http->client_stream.tail->prev->data; http->entry = clientCreateStoreEntry(node->data, context->http->request->method, null_request_flags); storeClientCopy(http->sc, http->entry, next->readoff + context->headers_sz, @@ -1249,7 +1249,7 @@ assert(size <= HTTP_REQBUF_SZ); assert(http->request != NULL); /* ESI TODO: remove this assert once everything is stable */ - assert(http->stream_head.head->data && cbdataReferenceValid(http->stream_head.head->data)); + assert(http->client_stream.head->data && cbdataReferenceValid(http->client_stream.head->data)); dlinkDelete(&http->active, &ClientActiveRequests); dlinkAdd(http, &http->active, &ClientActiveRequests); debug(88, 5) ("clientSendMoreData: FD %d '%s', out.offset=%ld \n", @@ -1268,7 +1268,7 @@ /* We call into the stream, because we don't know that there is a * client socket! */ - clientStreamCallback (http->stream_head.head->data, http, NULL, NULL, 0); + clientStreamCallback (http->client_stream.head->data, http, NULL, NULL, 0); /* clientWriteComplete(fd, NULL, 0, COMM_OK, http); */ return; } @@ -1276,7 +1276,7 @@ * HEAD and may not be true for pipelining. * */ if (http->out.offset != 0) { - clientStreamCallback (http->stream_head.head->data, http, NULL, buf, size); + clientStreamCallback (http->client_stream.head->data, http, NULL, buf, size); return; } /* handle headers */ @@ -1303,7 +1303,7 @@ http->entry = clientCreateStoreEntry(context, http->request->method, null_request_flags); /* And trigger a read of the resultant object */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, http->entry, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); errorAppendEntry(http->entry, err); @@ -1340,7 +1340,7 @@ http->entry = clientCreateStoreEntry(context, http->request->method, null_request_flags); /* And trigger a read of the resultant object */ - next = http->stream_head.head->next->data; + next = http->client_stream.head->next->data; storeClientCopy(http->sc, http->entry, next->readoff, next->readlen, next->readbuf, clientSendMoreData, context); errorAppendEntry(http->entry, err); @@ -1351,7 +1351,7 @@ if (http->flags.accel && rep->sline.status != HTTP_FORBIDDEN && !clientAlwaysAllowResponse(rep->sline.status) && strstr (http->uri, "esi")) { debug(88, 0) ("Enabling ESI processing for %s\n", http->uri); - clientStreamInsertHead (&http->stream_head, esiStreamRead, esiProcessStream, NULL); + clientStreamInsertHead (&http->client_stream, esiStreamRead, esiProcessStream, NULL); } } else if (size < HTTP_REQBUF_SZ && entry->store_status == STORE_PENDING) { /* wait for more to arrive */ @@ -1386,7 +1386,7 @@ } assert(rep || (body_buf && body_size)); /* TODO: move the data in the buffer back by the request header size */ - clientStreamCallback (http->stream_head.head->data, http, rep, body_buf, body_size); + clientStreamCallback (http->client_stream.head->data, http, rep, body_buf, body_size); } int Index: squid/src/client_side_request.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_request.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -r1.1.2.6 -r1.1.2.7 --- squid/src/client_side_request.c 15 Aug 2002 01:19:31 -0000 1.1.2.6 +++ squid/src/client_side_request.c 15 Aug 2002 01:22:18 -0000 1.1.2.7 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.c,v 1.1.2.6 2002/08/15 01:19:31 rbcollins Exp $ + * $Id: client_side_request.c,v 1.1.2.7 2002/08/15 01:22:18 rbcollins Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originall Duane Wessels in client_side.c) @@ -80,7 +80,7 @@ http->req_sz = 0; http->reqbuf = http->norm_reqbuf; /* client stream setup */ - clientStreamInit (&http->stream_head, clientGetMoreData, clientReplyNewContext (http), streamcallback, streamdata); + clientStreamInit (&http->client_stream, clientGetMoreData, clientReplyNewContext (http), streamcallback, streamdata); /* make it visible in the 'current acctive requests list' */ dlinkAdd(http, &http->active, &ClientActiveRequests); /* Set flags */ @@ -202,7 +202,7 @@ http->redirect_state = REDIRECT_PENDING; redirectStart(http, clientRedirectDone, http); } else { - clientStreamNode *node = http->stream_head.tail->prev->data; + clientStreamNode *node = http->client_stream.tail->prev->data; debug(85, 5) ("Access Denied: %s\n", http->uri); debug(85, 5) ("AclMatchedName = %s\n", AclMatchedName ? AclMatchedName : ""); @@ -235,7 +235,7 @@ http->conn ? &http->conn->peer.sin_addr : &no_addr, http->request, NULL, http->conn && http->conn->auth_user_request ? http->conn->auth_user_request : http->request->auth_user_request); - clientStreamRead (http->stream_head.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); + clientStreamRead (http->client_stream.tail->data, http, 0,HTTP_REQBUF_SZ,http->reqbuf); } } @@ -518,6 +518,6 @@ /* no one should have touched this */ assert (http->out.offset == 0); /* Use the Stream Luke */ - clientStreamRead (http->stream_head.tail->data, http, 0, HTTP_REQBUF_SZ, + clientStreamRead (http->client_stream.tail->data, http, 0, HTTP_REQBUF_SZ, http->reqbuf); } Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.61.2.2 retrieving revision 1.61.2.3 diff -u -r1.61.2.2 -r1.61.2.3 --- squid/src/structs.h 14 Aug 2002 11:16:06 -0000 1.61.2.2 +++ squid/src/structs.h 15 Aug 2002 01:22:18 -0000 1.61.2.3 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.61.2.2 2002/08/14 11:16:06 rbcollins Exp $ + * $Id: structs.h,v 1.61.2.3 2002/08/15 01:22:18 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1109,9 +1109,7 @@ char *reqbuf; int reqofs; int reqsize; - /* ESI TODO: build an appropriate management struct and link here */ - int remaining_esi_requests; - dlink_list stream_head; + dlink_list client_stream; }; struct _ConnStateData {