--------------------- PatchSet 5053 Date: 2002/09/19 21:55:42 Author: rbcollins Branch: fixrange Tag: (none) Log: extract some common store reading code in client_side_reply, and introduce parameter object to storeClientCopy Members: src/StoreClient.h:1.1.2.4->1.1.2.5 src/asn.c:1.17.14.5->1.17.14.6 src/client_side.c:1.72.2.41->1.72.2.42 src/client_side_reply.c:1.4.6.18->1.4.6.19 src/store_client.c:1.14.2.8->1.14.2.9 src/urn.c:1.17.2.5->1.17.2.6 Index: squid/src/StoreClient.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/StoreClient.h,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- squid/src/StoreClient.h 16 Sep 2002 21:47:53 -0000 1.1.2.4 +++ squid/src/StoreClient.h 19 Sep 2002 21:55:42 -0000 1.1.2.5 @@ -1,6 +1,6 @@ /* - * $Id: StoreClient.h,v 1.1.2.4 2002/09/16 21:47:53 rbcollins Exp $ + * $Id: StoreClient.h,v 1.1.2.5 2002/09/19 21:55:42 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -63,7 +63,6 @@ dlink_node node; }; -extern void storeClientCopyOld(store_client *, StoreEntry *, off_t, off_t, size_t, char *, STCB *, void *); -extern void storeClientCopy(store_client *, StoreEntry *, off_t, size_t, char *, STCB *, void *); +extern void storeClientCopy(store_client *, StoreEntry *, StoreIOBuffer, STCB *, void *); #endif /* SQUID_STORECLIENT_H */ Index: squid/src/asn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/asn.c,v retrieving revision 1.17.14.5 retrieving revision 1.17.14.6 diff -u -r1.17.14.5 -r1.17.14.6 --- squid/src/asn.c 16 Sep 2002 22:47:56 -0000 1.17.14.5 +++ squid/src/asn.c 19 Sep 2002 21:55:42 -0000 1.17.14.6 @@ -1,6 +1,6 @@ /* - * $Id: asn.c,v 1.17.14.5 2002/09/16 22:47:56 rbcollins Exp $ + * $Id: asn.c,v 1.17.14.6 2002/09/19 21:55:42 rbcollins Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -192,6 +192,7 @@ StoreEntry *e; request_t *req; ASState *asState; + StoreIOBuffer readBuffer = EMPTYIOBUFFER; asState = cbdataAlloc(ASState); debug(53, 3) ("asnCacheStart: AS %d\n", as); snprintf(asres, 4096, "whois://%s/!gAS%d", Config.as_whois_server, as); @@ -210,11 +211,12 @@ asState->entry = e; asState->offset = 0; asState->reqofs = 0; + readBuffer.offset = asState->offset; + readBuffer.length = AS_REQBUF_SZ; + readBuffer.data = asState->reqbuf; storeClientCopy(asState->sc, e, - asState->offset, - AS_REQBUF_SZ, - asState->reqbuf, + readBuffer, asHandleReply, asState); } @@ -293,21 +295,25 @@ asState->reqofs = leftoversz; debug(53, 3) ("asState->offset = %ld\n", (long int) asState->offset); if (e->store_status == STORE_PENDING) { + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; debug(53, 3) ("asHandleReply: store_status == STORE_PENDING: %s\n", storeUrl(e)); + tempBuffer.offset = asState->offset; + tempBuffer.length = AS_REQBUF_SZ - asState->reqofs; + tempBuffer.data = asState->reqbuf + asState->reqofs; storeClientCopy(asState->sc, e, - asState->offset, - AS_REQBUF_SZ - asState->reqofs, - asState->reqbuf + asState->reqofs, + tempBuffer, asHandleReply, asState); } else if (asState->offset < e->mem_obj->inmem_hi) { + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; debug(53, 3) ("asHandleReply: asState->offset < e->mem_obj->inmem_hi %s\n", storeUrl(e)); + tempBuffer.offset = asState->offset; + tempBuffer.length = AS_REQBUF_SZ - asState->reqofs; + tempBuffer.data = asState->reqbuf + asState->reqofs; storeClientCopy(asState->sc, e, - asState->offset, - AS_REQBUF_SZ - asState->reqofs, - asState->reqbuf + asState->reqofs, + tempBuffer, asHandleReply, asState); } else { Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.72.2.41 retrieving revision 1.72.2.42 diff -u -r1.72.2.41 -r1.72.2.42 --- squid/src/client_side.c 19 Sep 2002 09:41:16 -0000 1.72.2.41 +++ squid/src/client_side.c 19 Sep 2002 21:55:42 -0000 1.72.2.42 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.72.2.41 2002/09/19 09:41:16 rbcollins Exp $ + * $Id: client_side.c,v 1.72.2.42 2002/09/19 21:55:42 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1216,12 +1216,10 @@ if (connGetConcurrentRequestCount(conn) == 0 && conn->in.notYetUsed == 0) { /* no current or pending requests */ debug(33, 4) ("connFinishedWithConn: FD %d closed\n", conn->fd); - comm_close(conn->fd); return 1; } else if (!Config.onoff.half_closed_clients) { /* admin doesn't want to support half-closed client sockets */ debug(33, 3) ("connFinishedWithConn: FD %d aborted (half_closed_clients disabled)\n", conn->fd); - comm_close(conn->fd); return 1; } } Index: squid/src/client_side_reply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_reply.c,v retrieving revision 1.4.6.18 retrieving revision 1.4.6.19 diff -u -r1.4.6.18 -r1.4.6.19 --- squid/src/client_side_reply.c 19 Sep 2002 11:16:58 -0000 1.4.6.18 +++ squid/src/client_side_reply.c 19 Sep 2002 21:55:43 -0000 1.4.6.19 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.c,v 1.4.6.18 2002/09/19 11:16:58 rbcollins Exp $ + * $Id: client_side_reply.c,v 1.4.6.19 2002/09/19 21:55:43 rbcollins Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -42,7 +42,7 @@ int headers_sz; store_client *sc; /* The store_client we're using */ store_client *old_sc; /* ... for entry to be validated */ - int old_reqofs; /* ... for the buffer */ + StoreIOBuffer tempBuffer; /* For use in validating requests via IMS */ int old_reqsize; /* ... again, for the buffer */ size_t reqsize; off_t reqofs; @@ -87,6 +87,10 @@ extern ErrorState *clientBuildError(err_type, http_status, char const *, struct in_addr *, request_t *); +static void startError(clientReplyContext *context, clientHttpRequest *http, ErrorState *err); +static void triggerStoreReadWithClientParameters(clientReplyContext *context, clientHttpRequest *http); + + /* The clientReply clean interface */ /* privates */ static FREE clientReplyFree; @@ -99,6 +103,7 @@ /* old_entry might still be set if we didn't yet get the reply * code in clientHandleIMSReply() */ clientRemoveStoreReference(this, &this->old_sc, &this->http->old_entry); + safe_free (this->tempBuffer.data); cbdataReferenceDone(this->http); } @@ -163,7 +168,7 @@ http->old_entry = http->entry; this->old_sc = this->sc; this->old_reqsize = this->reqsize; - this->old_reqofs = this->reqofs; + this->tempBuffer.offset = this->reqofs; /* Prevent accessing the now saved entries */ http->entry = NULL; this->sc = NULL; @@ -180,14 +185,34 @@ http->entry = http->old_entry; this->sc = this->old_sc; this->reqsize = this->old_reqsize; - this->reqofs = this->old_reqofs; + this->reqofs = this->tempBuffer.offset; /* Prevent accessed the old saved entries */ http->old_entry = NULL; this->old_sc = NULL; this->old_reqsize = 0; - this->old_reqofs = 0; + this->tempBuffer.offset = 0; } +void +startError(clientReplyContext *context, clientHttpRequest *http, ErrorState *err) +{ + http->entry = clientCreateStoreEntry(context, http->request->method, null_request_flags); + triggerStoreReadWithClientParameters (context, http); + errorAppendEntry(http->entry, err); +} + +void +triggerStoreReadWithClientParameters(clientReplyContext *context, clientHttpRequest *http) +{ + clientStreamNode *next = http->client_stream.head->next->data; + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; + /* collapse this to one object if we never tickle the assert */ + assert (context->http == http); + tempBuffer.offset = next->readBuffer.offset; + tempBuffer.length = next->readBuffer.length; + tempBuffer.data = next->readBuffer.data; + storeClientCopy(context->sc, http->entry, tempBuffer, clientSendMoreData, context); +} /* there is an expired entry in the store. * setup a temporary buffer area and perform an IMS to the origin @@ -229,14 +254,20 @@ debug(88, 5) ("clientProcessExpired: lastmod %ld\n", (long int) entry->lastmod); http->entry = entry; - http->out.offset = 0; /* FIXME Not needed - we have not written anything anyway */ + assert (http->out.offset == 0); fwdStart(http->conn ? http->conn->fd : -1, http->entry, http->request); /* Register with storage manager to receive updates when data comes in. */ if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) debug(88, 0) ("clientProcessExpired: found ENTRY_ABORTED object\n"); - /* start counting the length from 0 */ - storeClientCopy(context->sc, entry, - 0, HTTP_REQBUF_SZ, context->tempbuf, clientHandleIMSReply, context); + { + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; + /* start counting the length from 0 */ + tempBuffer.offset = 0; + tempBuffer.length = HTTP_REQBUF_SZ; + tempBuffer.data = context->tempbuf; + storeClientCopy(context->sc, entry, + tempBuffer, clientHandleIMSReply, context); + } } int @@ -363,10 +394,12 @@ clientReplyContextRestoreState(context, http); entry = http->entry; } else { + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; + tempBuffer.offset = context->reqofs; + tempBuffer.length = HTTP_REQBUF_SZ - context->reqofs; + tempBuffer.data = context->tempbuf + context->reqofs; storeClientCopy(context->sc, entry, - context->reqofs, - HTTP_REQBUF_SZ - context->reqofs, - context->tempbuf + context->reqofs, + tempBuffer, clientHandleIMSReply, context); } return; @@ -418,7 +451,7 @@ } clientRemoveStoreReference(context, &context->old_sc, &http->old_entry); /* here the data to send is the data we just recieved */ - context->old_reqofs = 0; + context->tempBuffer.offset = 0; context->old_reqsize = 0; /* clientSendMoreData tracks the offset as well. * Force it back to zero */ @@ -479,15 +512,19 @@ clientProcessMiss(context); } else { clientStreamNode *next; + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; debug(88, 3) ("clientCacheHit: waiting for HTTP reply headers\n"); context->reqofs += result.length; assert(context->reqofs <= HTTP_REQBUF_SZ); /* get the next users' buffer */ + /* FIXME: HTTP_REQBUF_SZ must be wrong here ??! + */ next = context->http->client_stream.head->next->data; + tempBuffer.offset = http->out.offset + context->reqofs; + tempBuffer.length = HTTP_REQBUF_SZ; + tempBuffer.data = next->readBuffer.data + context->reqofs; storeClientCopy(context->sc, e, - http->out.offset + context->reqofs, - HTTP_REQBUF_SZ, - next->readBuffer.data + context->reqofs, clientCacheHit, context); + tempBuffer, clientCacheHit, context); } return; } @@ -594,7 +631,6 @@ http->logType = LOG_TCP_IMS_HIT; clientSendMoreData(context, result); } else { - clientStreamNode *next; time_t timestamp = e->timestamp; MemBuf mb = httpPacked304Reply(e->mem_obj->reply); http->logType = LOG_TCP_IMS_HIT; @@ -615,12 +651,7 @@ * Simply mark the request complete in our context and * write the reply struct to the client side */ - /* now write this back to the requester */ - - /* get the next chain members buffer */ - next = http->client_stream.head->next->data; - storeClientCopy(context->sc, e, next->readBuffer.offset, next->readBuffer.length, - next->readBuffer.data, clientSendMoreData, context); + triggerStoreReadWithClientParameters (context, http); } } else { /* @@ -671,7 +702,6 @@ * Deny loops when running in accelerator/transproxy mode. */ if (http->flags.accel && r->flags.loopdetect) { - clientStreamNode *next; http->al.http.code = HTTP_FORBIDDEN; err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, @@ -679,19 +709,12 @@ http->entry = clientCreateStoreEntry(context, r->method, null_request_flags); errorAppendEntry(http->entry, err); - /* and trigger a read of the resulting object */ - next = http->client_stream.head->next->data; - storeClientCopy(context->sc, http->entry, next->readBuffer.offset, next->readBuffer.length, - next->readBuffer.data, clientSendMoreData, context); + triggerStoreReadWithClientParameters (context, http); return; } else { - clientStreamNode *next; assert(http->out.offset == 0); http->entry = clientCreateStoreEntry(context, r->method, r->flags); - /* And trigger a read of the resultant object */ - next = http->client_stream.head->next->data; - storeClientCopy(context->sc, http->entry, next->readBuffer.offset, next->readBuffer.length, - next->readBuffer.data, clientSendMoreData, context); + triggerStoreReadWithClientParameters (context, http); if (http->redirect.status) { HttpReply *rep = httpReplyCreate(); #if LOG_TCP_REDIRECTS @@ -724,20 +747,13 @@ char *url = http->uri; request_t *r = http->request; ErrorState *err = NULL; - clientStreamNode *next; debug(88, 4) ("clientProcessOnlyIfCachedMiss: '%s %s'\n", RequestMethodStr[r->method], url); http->al.http.code = HTTP_GATEWAY_TIMEOUT; err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL, &http->conn->peer.sin_addr, http->request); clientRemoveStoreReference(context, &context->sc, &http->entry); - http->entry = - clientCreateStoreEntry(context, r->method, null_request_flags); - /* And trigger a read of the resultant object */ - next = http->client_stream.head->next->data; - storeClientCopy(context->sc, http->entry, next->readBuffer.offset, next->readBuffer.length, - next->readBuffer.data, clientSendMoreData, context); - errorAppendEntry(http->entry, err); + startError (context, http, err); } void @@ -758,13 +774,7 @@ err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, &http->conn->peer.sin_addr, http->request); - http->entry = - clientCreateStoreEntry(context, http->request->method, - null_request_flags); - /* And trigger a read of the resultant object */ - storeClientCopy(context->sc, http->entry, next->readBuffer.offset, next->readBuffer.length, - next->readBuffer.data, clientSendMoreData, context); - errorAppendEntry(http->entry, err); + startError (context, http, err); return; } /* Release both IP cache */ @@ -780,6 +790,7 @@ if (!entry) entry = storeGetPublicByRequestMethod(http->request, METHOD_HEAD); if (entry) { + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; /* Swap in the metadata */ http->entry = entry; storeLockObject(http->entry); @@ -788,9 +799,11 @@ context->sc = storeClientListAdd(http->entry, context); http->logType = LOG_TCP_HIT; context->reqofs = 0; + tempBuffer.offset = http->out.offset; + tempBuffer.length = next->readBuffer.length; + tempBuffer.data = next->readBuffer.data; storeClientCopy(context->sc, http->entry, - http->out.offset, - next->readBuffer.length, next->readBuffer.data, clientCacheHit, context); + tempBuffer, clientCacheHit, context); return; } } @@ -833,9 +846,7 @@ http->entry = clientCreateStoreEntry(context, http->request->method, null_request_flags); - /* And trigger a read of the resultant object */ - storeClientCopy(context->sc, http->entry, next->readBuffer.offset, next->readBuffer.length, - next->readBuffer.data, clientSendMoreData, context); + triggerStoreReadWithClientParameters (context, http); httpReplyReset(r = http->entry->mem_obj->reply); httpBuildVersion(&version, 1, 0); httpReplySetHeaders(r, version, status, NULL, NULL, 0, 0, -1); @@ -849,13 +860,16 @@ HttpReply *rep; http_version_t version; clientStreamNode *next = node->node.next->data; + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; assert(context->http->request->max_forwards == 0); context->http->entry = clientCreateStoreEntry(context, context->http->request->method, null_request_flags); + tempBuffer.offset = next->readBuffer.offset + context->headers_sz; + tempBuffer.length = next->readBuffer.length; + tempBuffer.data = next->readBuffer.data; storeClientCopy(context->sc, context->http->entry, - next->readBuffer.offset + context->headers_sz, next->readBuffer.length, next->readBuffer.data, - clientSendMoreData, context); + tempBuffer, clientSendMoreData, context); storeReleaseRequest(context->http->entry); storeBuffer(context->http->entry); rep = httpReplyCreate(); @@ -1297,9 +1311,13 @@ if (!context->ourNode) context->ourNode = this; /* no cbdatareference, this is only used once, and safely */ if (context->flags.storelogiccomplete) { + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; + tempBuffer.offset = next->readBuffer.offset + context->headers_sz; + tempBuffer.length = next->readBuffer.length; + tempBuffer.data = next->readBuffer.data; + storeClientCopy(context->sc, http->entry, - next->readBuffer.offset + context->headers_sz, next->readBuffer.length, next->readBuffer.data, - clientSendMoreData, context); + tempBuffer, clientSendMoreData, context); return; } if (context->http->request->method == METHOD_PURGE) { @@ -1318,6 +1336,7 @@ /* We still have to do store logic processing - vary, cache hit etc */ if (context->http->entry != NULL) { /* someone found the object in the cache for us */ + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; storeLockObject(context->http->entry); if (context->http->entry->mem_obj == NULL) { /* @@ -1339,9 +1358,11 @@ assert(context->http->logType == LOG_TCP_HIT); context->reqofs = 0; assert(http->out.offset == http->out.size && http->out.offset == 0); + tempBuffer.offset = context->reqofs; + tempBuffer.length = next->readBuffer.length; + tempBuffer.data = next->readBuffer.data; storeClientCopy(context->sc, http->entry, - context->reqofs, - next->readBuffer.length, next->readBuffer.data, clientCacheHit, context); + tempBuffer, clientCacheHit, context); } else { /* MISS CASE, http->logType is already set! */ clientProcessMiss(context); @@ -1459,15 +1480,8 @@ clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL, http->conn ? &http->conn->peer.sin_addr : &no_addr, http->request); - clientStreamNode *next; clientRemoveStoreReference(context, &context->sc, &http->entry); - http->entry = clientCreateStoreEntry(context, http->request->method, - null_request_flags); - /* And trigger a read of the resultant object */ - next = http->client_stream.head->next->data; - storeClientCopy(context->sc, http->entry, next->readBuffer.offset, - next->readBuffer.length, next->readBuffer.data, clientSendMoreData, context); - errorAppendEntry(http->entry, err); + startError (context, http, err); httpReplyDestroy(rep); return; } @@ -1494,31 +1508,26 @@ * to tell if this is a squid generated error page, or one from * upstream at this point. */ ErrorState *err; - clientStreamNode *next; err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, http->conn ? &http->conn->peer.sin_addr : &no_addr, http->request); clientRemoveStoreReference(context, &context->sc, &http->entry); - http->entry = clientCreateStoreEntry(context, http->request->method, - null_request_flags); - /* And trigger a read of the resultant object */ - next = http->client_stream.head->next->data; - storeClientCopy(context->sc, http->entry, next->readBuffer.offset, - next->readBuffer.length, next->readBuffer.data, clientSendMoreData, context); - errorAppendEntry(http->entry, err); + startError (context, http, err); httpReplyDestroy(rep); return; } } else if (size < HTTP_REQBUF_SZ && entry->store_status == STORE_PENDING) { + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; /* wait for more to arrive */ context->reqofs += result.length; assert(context->reqofs <= HTTP_REQBUF_SZ); /* TODO: copy into the supplied buffer */ + tempBuffer.offset = context->reqofs; + tempBuffer.length = next->readBuffer.length - context->reqofs; + tempBuffer.data = next->readBuffer.data + context->reqofs; storeClientCopy(context->sc, entry, - context->reqofs, - next->readBuffer.length - context->reqofs, - next->readBuffer.data + context->reqofs, clientSendMoreData, context); + tempBuffer, clientSendMoreData, context); return; } if (!context->flags.headersSent) Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.14.2.8 retrieving revision 1.14.2.9 diff -u -r1.14.2.8 -r1.14.2.9 --- squid/src/store_client.c 19 Sep 2002 08:21:49 -0000 1.14.2.8 +++ squid/src/store_client.c 19 Sep 2002 21:55:43 -0000 1.14.2.9 @@ -1,6 +1,6 @@ /* - * $Id: store_client.c,v 1.14.2.8 2002/09/19 08:21:49 rbcollins Exp $ + * $Id: store_client.c,v 1.14.2.9 2002/09/19 21:55:43 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -176,30 +176,19 @@ storeClientCopy2(sc->entry, sc); } -void -storeClientCopyOld(store_client * sc, StoreEntry * e, off_t seen_offset, - off_t copy_offset, size_t size, char *buf, STCB * callback, void *data) -{ - /* OLD API -- adrian */ - fatal("storeClientCopyOld() has been called!\n"); -} - - /* copy bytes requested by the client */ void storeClientCopy(store_client * sc, StoreEntry * e, - off_t copy_offset, - size_t size, - char *buf, + StoreIOBuffer copyInto, STCB * callback, void *data) { assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); - debug(20, 3) ("storeClientCopy: %s, want %d, size %d, cb %p, cbdata %p\n", + debug(20, 3) ("storeClientCopy: %s, from %lu, for length %d, cb %p, cbdata %p\n", storeKeyText(e->hash.key), - (int) copy_offset, - (int) size, + copyInto.offset, + copyInto.length, callback, data); assert(sc != NULL); @@ -208,13 +197,12 @@ #endif assert(sc->callback == NULL); assert(sc->entry == e); - assert(sc->cmp_offset == copy_offset); - sc->copy_offset = copy_offset; + assert(sc->cmp_offset == copyInto.offset); sc->callback = callback; sc->callback_data = cbdataReference(data); - sc->copy_buf = buf; - sc->copy_size = size; - sc->copy_offset = copy_offset; + sc->copy_buf = copyInto.data; + sc->copy_size = copyInto.length; + sc->copy_offset = copyInto.offset; storeClientCopy2(e, sc); } Index: squid/src/urn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/urn.c,v retrieving revision 1.17.2.5 retrieving revision 1.17.2.6 diff -u -r1.17.2.5 -r1.17.2.6 --- squid/src/urn.c 16 Sep 2002 22:47:56 -0000 1.17.2.5 +++ squid/src/urn.c 19 Sep 2002 21:55:43 -0000 1.17.2.6 @@ -1,6 +1,6 @@ /* - * $Id: urn.c,v 1.17.2.5 2002/09/16 22:47:56 rbcollins Exp $ + * $Id: urn.c,v 1.17.2.6 2002/09/19 21:55:43 rbcollins Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -111,6 +111,7 @@ UrnState *urnState; StoreEntry *urlres_e; ErrorState *err; + StoreIOBuffer tempBuffer = EMPTYIOBUFFER; debug(52, 3) ("urnStart: '%s'\n", storeUrl(e)); CBDATA_INIT_TYPE(UrnState); urnState = cbdataAlloc(UrnState); @@ -152,10 +153,11 @@ urnState->urlres_e = urlres_e; urnState->urlres_r = requestLink(urlres_r); urnState->reqofs = 0; + tempBuffer.offset = urnState->reqofs; + tempBuffer.length = URN_REQBUF_SZ; + tempBuffer.data = urnState->reqbuf; storeClientCopy(urnState->sc, urlres_e, - 0, - URN_REQBUF_SZ, - urnState->reqbuf, + tempBuffer, urnHandleReply, urnState); } @@ -193,6 +195,7 @@ int urlcnt = 0; http_version_t version; char *buf = urnState->reqbuf; + StoreIOBuffer tempBuffer; debug(52, 3) ("urnHandleReply: Called with size=%u.\n", result.length); if (EBIT_TEST(urlres_e->flags, ENTRY_ABORTED)) { @@ -213,10 +216,11 @@ /* If we haven't received the entire object (urn), copy more */ if (urlres_e->store_status == STORE_PENDING && urnState->reqofs < URN_REQBUF_SZ) { + tempBuffer.offset = urnState->reqofs; + tempBuffer.length = URN_REQBUF_SZ; + tempBuffer.data = urnState->reqbuf + urnState->reqofs; storeClientCopy(urnState->sc, urlres_e, - urnState->reqofs, - URN_REQBUF_SZ, - urnState->reqbuf + urnState->reqofs, + tempBuffer, urnHandleReply, urnState); return;