al->updateError(aConn->bareError);
#if USE_OPENSSL
- if (aConn->clientConnection != NULL && aConn->clientConnection->isOpen()) {
+ if (aConn->clientConnection != nullptr && aConn->clientConnection->isOpen()) {
if (auto ssl = fd_table[aConn->clientConnection->fd].ssl.get())
al->cache.sslClientCert.resetWithoutLocking(SSL_get_peer_certificate(ssl));
}
logRequest();
- loggingEntry(NULL);
+ loggingEntry(nullptr);
if (request)
checkFailureRatio(request->error.category, al->hier.code);
#if USE_ADAPTATION
announceInitiatorAbort(virginHeadSource);
- if (adaptedBodySource != NULL)
+ if (adaptedBodySource != nullptr)
stopConsumingFrom(adaptedBodySource);
#endif
char *tailbuf, size_t taillen, const MasterXaction::Pointer &mx)
{
size_t url_sz;
- ClientHttpRequest *http = new ClientHttpRequest(NULL);
+ ClientHttpRequest *http = new ClientHttpRequest(nullptr);
HttpRequest *request;
StoreIOBuffer tempBuffer;
- if (http->al != NULL)
+ if (http->al != nullptr)
http->al->cache.start_time = current_time;
/* this is only used to adjust the connection offset in client_side.c */
http->req_sz = 0;
if (cbdataReferenceValid(http_))
return true;
- http = NULL;
+ http = nullptr;
cbdataReferenceDone(http_);
nullptr,
http->getConn(),
http->request,
- NULL,
+ nullptr,
#if USE_AUTH
- http->getConn() != NULL && http->getConn()->getAuth() != NULL ?
+ http->getConn() != nullptr && http->getConn()->getAuth() != nullptr ?
http->getConn()->getAuth() : http->request->auth_user_request);
#else
NULL);
}
// Locate if there is a port attached, strip ready for IP lookup
- char *portStr = NULL;
+ char *portStr = nullptr;
char *hostB = xstrdup(host);
host = hostB;
if (host[0] == '[') {
// IPv6 literal.
portStr = strchr(hostB, ']');
if (portStr && *(++portStr) != ':') {
- portStr = NULL;
+ portStr = nullptr;
}
} else {
// Domain or IPv4 literal with port
if (portStr) {
*portStr = '\0'; // strip the ':'
if (*(++portStr) != '\0') {
- char *end = NULL;
+ char *end = nullptr;
int64_t ret = strtoll(portStr, &end, 10);
if (end == portStr || *end != '\0' || ret < 1 || ret > 0xFFFF) {
// invalid port details. Replace the ':'
*(--portStr) = ':';
- portStr = NULL;
+ portStr = nullptr;
} else
port = (ret & 0xFFFF);
}
void
ClientRequestContext::clientAccessCheckDone(const Acl::Answer &answer)
{
- acl_checklist = NULL;
+ acl_checklist = nullptr;
err_type page_id;
Http::StatusCode status;
debugs(85, 2, "The request " << http->request->method << ' ' <<
#if USE_AUTH
char const *proxy_auth_msg = "<null>";
- if (http->getConn() != NULL && http->getConn()->getAuth() != NULL)
+ if (http->getConn() != nullptr && http->getConn()->getAuth() != nullptr)
proxy_auth_msg = http->getConn()->getAuth()->denyMessage("<null>");
- else if (http->request->auth_user_request != NULL)
+ else if (http->request->auth_user_request != nullptr)
proxy_auth_msg = http->request->auth_user_request->denyMessage("<null>");
#endif
#if USE_AUTH
error->auth_user_request =
- http->getConn() != NULL && http->getConn()->getAuth() != NULL ?
+ http->getConn() != nullptr && http->getConn()->getAuth() != nullptr ?
http->getConn()->getAuth() : http->request->auth_user_request;
#endif
#if ICAP_CLIENT
Adaptation::Icap::History::Pointer ih = request->icapHistory();
- if (ih != NULL) {
- if (getConn() != NULL && getConn()->clientConnection != NULL) {
+ if (ih != nullptr) {
+ if (getConn() != nullptr && getConn()->clientConnection != nullptr) {
ih->rfc931 = getConn()->clientConnection->rfc931;
#if USE_OPENSSL
if (getConn()->clientConnection->isOpen()) {
{
ClientRequestContext *context = (ClientRequestContext *)data;
ClientHttpRequest *http = context->http;
- context->acl_checklist = NULL;
+ context->acl_checklist = nullptr;
if (answer.allowed())
redirectStart(http, clientRedirectDoneWrapper, context);
{
ClientRequestContext *context = static_cast<ClientRequestContext *>(data);
ClientHttpRequest *http = context->http;
- context->acl_checklist = NULL;
+ context->acl_checklist = nullptr;
if (answer.allowed())
storeIdStart(http, clientStoreIdDoneWrapper, context);
const char *statusNote = reply.notes.findFirst("status");
const char *urlNote = reply.notes.findFirst("url");
- if (urlNote != NULL) {
+ if (urlNote != nullptr) {
// HTTP protocol redirect to be done.
// TODO: change default redirect status for appropriate requests
// HTTP/1.1 client contacting reverse-proxy should get 307 (Http::scTemporaryRedirect)
// HTTP/1.1 client being diverted by forward-proxy should get 303 (Http::scSeeOther)
Http::StatusCode status = Http::scFound;
- if (statusNote != NULL) {
+ if (statusNote != nullptr) {
const char * result = statusNote;
status = static_cast<Http::StatusCode>(atoi(result));
}
urlNote = reply.notes.findFirst("rewrite-url");
// prevent broken helpers causing too much damage. If old URL == new URL skip the re-write.
- if (urlNote != NULL && strcmp(urlNote, http->uri)) {
+ if (urlNote != nullptr && strcmp(urlNote, http->uri)) {
AnyP::Uri tmpUrl;
if (tmpUrl.parse(old_request->method, SBuf(urlNote))) {
HttpRequest *new_request = old_request->clone();
new_request->flags.redirected = true;
// unlink bodypipe from the old request. Not needed there any longer.
- if (old_request->body_pipe != NULL) {
- old_request->body_pipe = NULL;
+ if (old_request->body_pipe != nullptr) {
+ old_request->body_pipe = nullptr;
debugs(61,2, "URL-rewriter diverts body_pipe " << new_request->body_pipe <<
" from request " << old_request << " to " << new_request);
}
/* XXX PIPELINE: This is inaccurate during pipelining */
- if (http->getConn() != NULL && Comm::IsConnOpen(http->getConn()->clientConnection))
+ if (http->getConn() != nullptr && Comm::IsConnOpen(http->getConn()->clientConnection))
fd_note(http->getConn()->clientConnection->fd, http->uri);
assert(http->uri);
const char *urlNote = reply.notes.findFirst("store-id");
// prevent broken helpers causing too much damage. If old URL == new URL skip the re-write.
- if (urlNote != NULL && strcmp(urlNote, http->uri) ) {
+ if (urlNote != nullptr && strcmp(urlNote, http->uri) ) {
// Debug section required for some very specific cases.
debugs(85, 9, "Setting storeID with: " << urlNote );
http->request->store_id = urlNote;
void
ClientRequestContext::checkNoCacheDone(const Acl::Answer &answer)
{
- acl_checklist = NULL;
+ acl_checklist = nullptr;
if (answer.denied()) {
http->request->flags.noCache = true; // do not read reply from cache
http->request->flags.cachable = false; // do not store reply into cache
#if USE_AUTH
// Preserve authentication info for the ssl-bumped request
- if (request->auth_user_request != NULL)
+ if (request->auth_user_request != nullptr)
getConn()->setAuth(request->auth_user_request, "SSL-bumped CONNECT");
#endif
calloutContext->adaptation_acl_check_done = true;
if (Adaptation::AccessCheck::Start(
Adaptation::methodReqmod, Adaptation::pointPreCache,
- request, NULL, calloutContext->http->al, this))
+ request, nullptr, calloutContext->http->al, this))
return; // will call callback
}
#endif
// set final error but delay sending until we bump
Ssl::ServerBump *srvBump = new Ssl::ServerBump(this, e, Ssl::bumpClientFirst);
errorAppendEntry(e, calloutContext->error);
- calloutContext->error = NULL;
+ calloutContext->error = nullptr;
getConn()->setServerBump(srvBump);
e->unlock("ClientHttpRequest::doCallouts+sslBumpNeeded");
} else
assert (repContext);
repContext->setReplyToStoreEntry(e, "immediate SslBump error");
errorAppendEntry(e, calloutContext->error);
- calloutContext->error = NULL;
+ calloutContext->error = nullptr;
if (calloutContext->readNextRequest && getConn())
getConn()->flags.readMore = true; // resume any pipeline reads.
node = (clientStreamNode *)client_stream.tail->data;
cbdataReferenceDone(calloutContext->http);
delete calloutContext;
- calloutContext = NULL;
+ calloutContext = nullptr;
#if HEADERS_LOG
headersLog(0, 1, request->method, request);
#if ICAP_CLIENT
Adaptation::Icap::History::Pointer ih = request->icapHistory();
- if (ih != NULL)
+ if (ih != nullptr)
ih->logType = loggingTags();
#endif
}
assert(!virginHeadSource);
assert(!adaptedBodySource);
virginHeadSource = initiateAdaptation(
- new Adaptation::Iterator(request, NULL, al, g));
+ new Adaptation::Iterator(request, nullptr, al, g));
// we could try to guess whether we can bypass this adaptation
// initiation failure, but it should not really happen
debugs(85,3, "REQMOD reply is HTTP reply");
// subscribe to receive reply body
- if (new_rep->body_pipe != NULL) {
+ if (new_rep->body_pipe != nullptr) {
adaptedBodySource = new_rep->body_pipe;
int consumer_ok = adaptedBodySource->setConsumerIfNotLate(this);
assert(consumer_ok);
AclMatchedName = answer.ruleId.termedBuf();
assert(calloutContext);
calloutContext->clientAccessCheckDone(ACCESS_DENIED);
- AclMatchedName = NULL;
+ AclMatchedName = nullptr;
}
void
ClientHttpRequest::noteMoreBodyDataAvailable(BodyPipe::Pointer)
{
assert(request_satisfaction_mode);
- assert(adaptedBodySource != NULL);
+ assert(adaptedBodySource != nullptr);
if (size_t contentSize = adaptedBodySource->buf().contentSize()) {
const size_t spaceAvailable = storeEntry()->bytesWanted(Range<size_t>(0,contentSize));
receivedWholeAdaptedReply = true;
// should we end request satisfaction now?
- if (adaptedBodySource != NULL && adaptedBodySource->exhausted())
+ if (adaptedBodySource != nullptr && adaptedBodySource->exhausted())
endRequestSatisfaction();
}
debugs(85,3, "handleAdaptationFailure(" << bypassable << ")");
const bool usedStore = storeEntry() && !storeEntry()->isEmpty();
- const bool usedPipe = request->body_pipe != NULL &&
+ const bool usedPipe = request->body_pipe != nullptr &&
request->body_pipe->consumedSize() > 0;
if (bypassable && !usedStore && !usedPipe) {
nullptr, c, request, al);
#if USE_AUTH
calloutContext->error->auth_user_request =
- c != NULL && c->getAuth() != NULL ? c->getAuth() : request->auth_user_request;
+ c != nullptr && c->getAuth() != nullptr ? c->getAuth() : request->auth_user_request;
#endif
calloutContext->error->detailError(errDetail);
calloutContext->readNextRequest = true;
- if (c != NULL)
+ if (c != nullptr)
c->expectNoForwarding();
}
//else if(calloutContext == NULL) is it possible?