entry->lock("Client");
request = fwd->request;
- HTTPMSGLOCK(request);
}
Client::~Client()
entry->unlock("Client");
- HTTPMSGUNLOCK(request);
HTTPMSGUNLOCK(theVirginReply);
HTTPMSGUNLOCK(theFinalReply);
}
completed = true;
-
- HttpRequest *r = originalRequest();
- r->hier.stopPeerClock(true);
+ originalRequest()->hier.stopPeerClock(true);
if (requestBodySource != NULL)
stopConsumingFrom(requestBodySource);
// Register to receive request body
bool Client::startRequestBodyFlow()
{
- HttpRequest *r = originalRequest();
+ HttpRequestPointer r(originalRequest());
assert(r->body_pipe != NULL);
requestBodySource = r->body_pipe;
if (requestBodySource->setConsumerIfNotLate(this)) {
SBuf tmp(request->effectiveRequestUri());
const char *reqUrl = tmp.c_str();
debugs(88, 5, "maybe purging due to " << request->method << ' ' << tmp);
- purgeEntriesByUrl(request, reqUrl);
- purgeEntriesByHeader(request, reqUrl, theFinalReply, Http::HdrType::LOCATION);
- purgeEntriesByHeader(request, reqUrl, theFinalReply, Http::HdrType::CONTENT_LOCATION);
+ purgeEntriesByUrl(request.getRaw(), reqUrl);
+ purgeEntriesByHeader(request.getRaw(), reqUrl, theFinalReply, Http::HdrType::LOCATION);
+ purgeEntriesByHeader(request.getRaw(), reqUrl, theFinalReply, Http::HdrType::CONTENT_LOCATION);
}
/// called when we have final (possibly adapted) reply headers; kids extend
if (const Acl::Tree *acl = Config.accessList.storeMiss) {
// This relatively expensive check is not in StoreEntry::checkCachable:
// That method lacks HttpRequest and may be called too many times.
- ACLFilledChecklist ch(acl, originalRequest(), NULL);
+ ACLFilledChecklist ch(acl, originalRequest().getRaw());
ch.reply = const_cast<HttpReply*>(entry->getReply()); // ACLFilledChecklist API bug
HTTPMSGLOCK(ch.reply);
if (ch.fastCheck() != ACCESS_ALLOWED) { // when in doubt, block
return false;
}
-HttpRequest *
+HttpRequestPointer
Client::originalRequest()
{
return request;
{
if (entry->isEmpty()) {
debugs(11,8, "adaptation failure with an empty entry: " << *entry);
- ErrorState *err = new ErrorState(ERR_ICAP_FAILURE, Http::scInternalServerError, request);
+ ErrorState *err = new ErrorState(ERR_ICAP_FAILURE, Http::scInternalServerError, request.getRaw());
err->detailError(ERR_DETAIL_ICAP_RESPMOD_EARLY);
fwd->fail(err);
fwd->dontRetry(true);
if (page_id == ERR_NONE)
page_id = ERR_ACCESS_DENIED;
- ErrorState *err = new ErrorState(page_id, Http::scForbidden, request);
+ ErrorState *err = new ErrorState(page_id, Http::scForbidden, request.getRaw());
err->detailError(ERR_DETAIL_RESPMOD_BLOCK_EARLY);
fwd->fail(err);
fwd->dontRetry(true);
return;
}
- startAdaptation(group, originalRequest());
+ startAdaptation(group, originalRequest().getRaw());
processReplyBody();
}
#endif
void
Client::sendBodyIsTooLargeError()
{
- ErrorState *err = new ErrorState(ERR_TOO_BIG, Http::scForbidden, request);
+ ErrorState *err = new ErrorState(ERR_TOO_BIG, Http::scForbidden, request.getRaw());
fwd->fail(err);
fwd->dontRetry(true);
abortOnData("Virgin body too large.");
// The callback can be called with a NULL service if adaptation is off.
adaptationAccessCheckPending = Adaptation::AccessCheck::Start(
Adaptation::methodRespmod, Adaptation::pointPreCache,
- originalRequest(), virginReply(), fwd->al, this);
+ originalRequest().getRaw(), virginReply(), fwd->al, this);
debugs(11,5, HERE << "adaptationAccessCheckPending=" << adaptationAccessCheckPending);
if (adaptationAccessCheckPending)
return;
if (!checkAuth(&request->header)) {
/* create appropriate reply */
SBuf realm(ftpRealm()); // local copy so SBuf wont disappear too early
- HttpReply *reply = ftpAuthRequired(request, realm);
+ HttpReply *reply = ftpAuthRequired(request.getRaw(), realm);
entry->replaceHttpReply(reply);
serverComplete();
return;
{
assert(entry);
entry->lock("Ftp::Gateway");
- ErrorState ferr(ERR_DIR_LISTING, Http::scOkay, request);
+ ErrorState ferr(ERR_DIR_LISTING, Http::scOkay, request.getRaw());
ferr.ftp.listing = &listing;
ferr.ftp.cwd_msg = xstrdup(cwd_message.size()? cwd_message.termedBuf() : "");
ferr.ftp.server_msg = ctrl.message;
ctrl.message = NULL;
- entry->replaceHttpReply( ferr.BuildHttpReply() );
+ entry->replaceHttpReply(ferr.BuildHttpReply());
EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
entry->flush();
entry->unlock("Ftp::Gateway");
http_code = Http::scInternalServerError;
}
- ErrorState err(err_code, http_code, ftpState->request);
+ ErrorState err(err_code, http_code, ftpState->request.getRaw());
if (ftpState->old_request)
err.ftp.request = xstrdup(ftpState->old_request);
// TODO: interpret as FTP-specific error code
err.detailError(code);
- ftpState->entry->replaceHttpReply( err.BuildHttpReply() );
+ ftpState->entry->replaceHttpReply(err.BuildHttpReply());
ftpSendQuit(ftpState);
}
#if USE_HTTP_VIOLATIONS
// check whether the 1xx response forwarding is allowed by squid.conf
if (Config.accessList.reply) {
- ACLFilledChecklist ch(Config.accessList.reply, originalRequest(), NULL);
+ ACLFilledChecklist ch(Config.accessList.reply, originalRequest().getRaw());
ch.reply = reply;
HTTPMSGLOCK(ch.reply);
if (ch.fastCheck() != ACCESS_ALLOWED) { // TODO: support slow lookups?
|| rep->header.has(Http::HdrType::HDR_X_ACCELERATOR_VARY)
#endif
) {
- const SBuf vary(httpMakeVaryMark(request, rep));
+ const SBuf vary(httpMakeVaryMark(request.getRaw(), rep));
if (vary.isEmpty()) {
entry->makePrivate();
}
if (ispinned && request->clientConnectionManager.valid()) {
- request->clientConnectionManager->pinConnection(serverConnection, request, _peer,
+ request->clientConnectionManager->pinConnection(serverConnection, request.getRaw(), _peer,
(request->flags.connectionAuth));
} else {
fwd->pconnPush(serverConnection, request->url.host());
/* build and pack headers */
{
HttpHeader hdr(hoRequest);
- httpBuildRequestHeader(request, entry, fwd->al, &hdr, flags);
+ httpBuildRequestHeader(request.getRaw(), entry, fwd->al, &hdr, flags);
if (request->flags.pinned && request->flags.connectionAuth)
request->flags.authSent = true;
return false;
}
- ACLFilledChecklist ch(Config.accessList.brokenPosts, originalRequest(), NULL);
+ ACLFilledChecklist ch(Config.accessList.brokenPosts, originalRequest().getRaw());
if (ch.fastCheck() != ACCESS_ALLOWED) {
debugs(11, 5, HERE << "didn't match brokenPosts");
return false;