void ICAPClientReqmodPrecache::noteSourceStart(MsgPipe *p)
{
debug(93,3)("ICAPClientReqmodPrecache::noteSourceStart() called\n");
- assert(adapted->data->header); // What should happen instead?
+ /*
+ * If adapted->data->header is NULL then the ICAP response did
+ * not have a req/res-hdr section. Send the NULL pointer to
+ * tell the other side to use the original request/response
+ * headers.
+ */
http->takeAdaptedHeaders(adapted->data->header);
noteSourceProgress(p);
}
maybeAllocateHttpMsg();
if (!parseHead(adapted->data->header))
- return;
+ return; // need more header data
}
state.parsing = State::psBody;
debugs(93, 5, HERE << "have " << readBuf.contentSize() << " body bytes to parse");
- if (gotEncapsulated("res-body")) {
+ if (gotEncapsulated("res-body") || gotEncapsulated("req-body")) {
if (!parsePresentBody()) // need more body data
return;
} else {
/*
- * $Id: client_side_request.cc,v 1.54 2005/12/06 00:01:23 wessels Exp $
+ * $Id: client_side_request.cc,v 1.55 2005/12/20 23:22:29 wessels Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
assert(cbdataReferenceValid(this)); // indicates bug
HttpRequest *new_req = dynamic_cast<HttpRequest*>(msg);
- assert(new_req);
- /*
- * Replace the old request with the new request. First,
- * Move the "body_connection" over, then unlink old and
- * link new to the http state.
- */
- new_req->body_connection = request->body_connection;
- request->body_connection = NULL;
- requestUnlink(request);
- request = requestLink(new_req);
+
/*
- * Store the new URI for logging
+ * new_req will be NULL if the ICAP response doesn't have new
+ * request headers for us. Unfortunately, it will also be NULL
+ * if someone passes us an HttpReply as an HttpMsg, which would
+ * be a bug.
*/
- xfree(uri);
- uri = xstrdup(urlCanonical(request));
- setLogUri(this, urlCanonicalClean(request));
- assert(request->method);
+
+ if (new_req) {
+ /*
+ * Replace the old request with the new request. First,
+ * Move the "body_connection" over, then unlink old and
+ * link new to the http state.
+ */
+ new_req->body_connection = request->body_connection;
+ request->body_connection = NULL;
+ requestUnlink(request);
+ request = requestLink(new_req);
+ /*
+ * Store the new URI for logging
+ */
+ xfree(uri);
+ uri = xstrdup(urlCanonical(request));
+ setLogUri(this, urlCanonicalClean(request));
+ assert(request->method);
+ }
doCallouts();