]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/http.cc
Maintenance: Removed most NULLs using modernize-use-nullptr (#1075)
[thirdparty/squid.git] / src / http.cc
index b587606cdddcbd89d6265ddbf21853351db8c958..7a88077e072eafab3d640540dee397303be2f233 100644 (file)
@@ -81,7 +81,7 @@ HttpStateData::HttpStateData(FwdState *theFwdState) :
     debugs(11,5, "HttpStateData " << this << " created");
     serverConnection = fwd->serverConnection();
 
-    if (fwd->serverConnection() != NULL)
+    if (fwd->serverConnection() != nullptr)
         _peer = cbdataReference(fwd->serverConnection()->getPeer());         /* might be NULL */
 
     flags.peering =  _peer;
@@ -226,7 +226,7 @@ httpMaybeRemovePublic(StoreEntry * e, Http::StatusCode status)
 
     StoreEntry *pe = findPreviouslyCachedEntry(e);
 
-    if (pe != NULL) {
+    if (pe != nullptr) {
         assert(e != pe);
 #if USE_HTCP
         neighborsHtcpClear(e, e->mem_obj->request.getRaw(), e->mem_obj->method, HTCP_CLR_INVALIDATION);
@@ -243,7 +243,7 @@ httpMaybeRemovePublic(StoreEntry * e, Http::StatusCode status)
     else
         pe = storeGetPublic(e->mem_obj->storeId(), Http::METHOD_HEAD);
 
-    if (pe != NULL) {
+    if (pe != nullptr) {
         assert(e != pe);
 #if USE_HTCP
         neighborsHtcpClear(e, e->mem_obj->request.getRaw(), HttpRequestMethod(Http::METHOD_HEAD), HTCP_CLR_INVALIDATION);
@@ -298,7 +298,7 @@ HttpStateData::reusableReply(HttpStateData::ReuseDecision &decision)
     const char *v;
 #if USE_HTTP_VIOLATIONS
 
-    const RefreshPattern *R = NULL;
+    const RefreshPattern *R = nullptr;
 
     /* This strange looking define first looks up the refresh pattern
      * and then checks if the specified flag is set. The main purpose
@@ -651,7 +651,7 @@ HttpStateData::processReplyHeader()
 
     /* Attempt to parse the first line; this will define where the protocol, status, reason-phrase and header begin */
     {
-        if (hp == NULL)
+        if (hp == nullptr)
             hp = new Http1::ResponseParser;
 
         bool parsedOk = hp->parse(inBuf);
@@ -711,7 +711,7 @@ HttpStateData::processReplyHeader()
     }
 
     // done with Parser, now process using the HttpReply
-    hp = NULL;
+    hp = nullptr;
 
     newrep->sources |= request->url.getScheme() == AnyP::PROTO_HTTPS ? Http::Message::srcHttps : Http::Message::srcHttp;
 
@@ -1515,7 +1515,7 @@ HttpStateData::processReplyBody()
             flags.do_next_read = false;
 
             comm_remove_close_handler(serverConnection->fd, closeHandler);
-            closeHandler = NULL;
+            closeHandler = nullptr;
 
             Ip::Address client_addr; // XXX: Remove as unused. Why was it added?
             if (request->flags.spoofClientIp)
@@ -1696,7 +1696,7 @@ HttpStateData::closeServer()
     if (Comm::IsConnOpen(serverConnection)) {
         fwd->unregister(serverConnection);
         comm_remove_close_handler(serverConnection->fd, closeHandler);
-        closeHandler = NULL;
+        closeHandler = nullptr;
         serverConnection->close();
     }
 }
@@ -1762,7 +1762,7 @@ httpFixupAuthentication(HttpRequest * request, const HttpHeader * hdr_in, HttpHe
         if (request->extacl_user.size())
             username = request->extacl_user.termedBuf();
 #if USE_AUTH
-        else if (request->auth_user_request != NULL)
+        else if (request->auth_user_request != nullptr)
             username = request->auth_user_request->username();
 #endif
 
@@ -1792,11 +1792,11 @@ httpFixupAuthentication(HttpRequest * request, const HttpHeader * hdr_in, HttpHe
     /* Kerberos login to peer */
 #if HAVE_AUTH_MODULE_NEGOTIATE && HAVE_KRB5 && HAVE_GSSAPI
     if (strncmp(request->peer_login, "NEGOTIATE",strlen("NEGOTIATE")) == 0) {
-        char *Token=NULL;
-        char *PrincipalName=NULL,*p;
+        char *Token=nullptr;
+        char *PrincipalName=nullptr,*p;
         int negotiate_flags = 0;
 
-        if ((p=strchr(request->peer_login,':')) != NULL ) {
+        if ((p=strchr(request->peer_login,':')) != nullptr ) {
             PrincipalName=++p;
         }
         if (request->flags.auth_no_keytab) {
@@ -1833,7 +1833,7 @@ HttpStateData::httpBuildRequestHeader(HttpRequest * request,
     LOCAL_ARRAY(char, bbuf, BBUF_SZ);
     LOCAL_ARRAY(char, ntoabuf, MAX_IPSTRLEN);
     const HttpHeader *hdr_in = &request->header;
-    const HttpHeaderEntry *e = NULL;
+    const HttpHeaderEntry *e = nullptr;
     HttpHeaderPos pos = HttpHeaderInitPos;
     assert (hdr_out->owner == hoRequest);
 
@@ -2267,7 +2267,7 @@ HttpStateData::decideIfWeDoRanges (HttpRequest * request)
 
     int64_t roffLimit = request->getRangeOffsetLimit();
 
-    if (NULL == request->range || !request->flags.cachable
+    if (nullptr == request->range || !request->flags.cachable
             || request->range->offsetLimitExceeded(roffLimit) || request->flags.connectionAuth)
         result = false;
 
@@ -2333,7 +2333,7 @@ HttpStateData::sendRequest()
 
     if (!Comm::IsConnOpen(serverConnection)) {
         debugs(11,3, "cannot send request to closing " << serverConnection);
-        assert(closeHandler != NULL);
+        assert(closeHandler != nullptr);
         return false;
     }
 
@@ -2344,7 +2344,7 @@ HttpStateData::sendRequest()
     flags.do_next_read = true;
     maybeReadVirginBody();
 
-    if (request->body_pipe != NULL) {
+    if (request->body_pipe != nullptr) {
         if (!startRequestBodyFlow()) // register to receive body data
             return false;
         typedef CommCbMemFunT<HttpStateData, CommIoCbParams> Dialer;
@@ -2374,7 +2374,7 @@ HttpStateData::sendRequest()
     else if (flags.tunneling)
         // tunneled non pinned bumped requests must not keepalive
         flags.keepalive = !request->flags.sslBumped;
-    else if (_peer == NULL)
+    else if (_peer == nullptr)
         flags.keepalive = true;
     else if (_peer->stats.n_keepalives_sent < 10)
         flags.keepalive = true;
@@ -2401,7 +2401,7 @@ HttpStateData::sendRequest()
     }
 
     mb.init();
-    request->peer_host=_peer?_peer->host:NULL;
+    request->peer_host=_peer?_peer->host:nullptr;
     buildRequestPrefix(&mb);
 
     debugs(11, 2, "HTTP Server " << serverConnection);
@@ -2420,7 +2420,7 @@ HttpStateData::getMoreRequestBody(MemBuf &buf)
 
     MemBuf raw;
 
-    Must(requestBodySource != NULL);
+    Must(requestBodySource != nullptr);
     if (!requestBodySource->getMoreData(raw))
         return false; // no request body bytes to chunk yet
 
@@ -2491,7 +2491,7 @@ HttpStateData::finishingBrokenPost()
 
     if (!Comm::IsConnOpen(serverConnection)) {
         debugs(11, 3, "ignoring broken POST for closed " << serverConnection);
-        assert(closeHandler != NULL);
+        assert(closeHandler != nullptr);
         return true; // prevent caller from proceeding as if nothing happened
     }
 
@@ -2499,7 +2499,7 @@ HttpStateData::finishingBrokenPost()
     typedef CommCbMemFunT<HttpStateData, CommIoCbParams> Dialer;
     requestSender = JobCallback(11,5,
                                 Dialer, this, HttpStateData::wroteLast);
-    Comm::Write(serverConnection, "\r\n", 2, requestSender, NULL);
+    Comm::Write(serverConnection, "\r\n", 2, requestSender, nullptr);
     return true;
 #else
     return false;
@@ -2520,7 +2520,7 @@ HttpStateData::finishingChunkedRequest()
 
     typedef CommCbMemFunT<HttpStateData, CommIoCbParams> Dialer;
     requestSender = JobCallback(11,5, Dialer, this, HttpStateData::wroteLast);
-    Comm::Write(serverConnection, "0\r\n\r\n", 5, requestSender, NULL);
+    Comm::Write(serverConnection, "0\r\n\r\n", 5, requestSender, nullptr);
     return true;
 }
 
@@ -2551,7 +2551,7 @@ HttpStateData::handleMoreRequestBodyAvailable()
         return;
     }
 
-    assert(requestBodySource != NULL);
+    assert(requestBodySource != nullptr);
 
     if (requestBodySource->buf().hasContent()) {
         // XXX: why does not this trigger a debug message on every request?