]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid NULL http->entry pointer in clientBuildReplyHeader().
authorwessels <>
Fri, 2 Mar 2001 06:02:31 +0000 (06:02 +0000)
committerwessels <>
Fri, 2 Mar 2001 06:02:31 +0000 (06:02 +0000)
src/client_side.cc

index c32fd393536cf91d4c0a1ea49ae159e06fbf3585..9f03ee92b0086e661516c26c810fca72728f3636 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.529 2001/02/23 20:59:50 hno Exp $
+ * $Id: client_side.cc,v 1.530 2001/03/01 23:02:31 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -288,7 +288,7 @@ clientRedirectDone(void *data, char *result)
     assert(http->redirect_state == REDIRECT_PENDING);
     http->redirect_state = REDIRECT_DONE;
     if (result) {
-       http_status status = (http_status)atoi(result);
+       http_status status = (http_status) atoi(result);
        if (status == HTTP_MOVED_PERMANENTLY || status == HTTP_MOVED_TEMPORARILY) {
            char *t = result;
            if ((t = strchr(result, ':')) != NULL) {
@@ -1280,10 +1280,13 @@ clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep)
         * the objects age, so a Age: 0 header does not add any useful
         * information to the reply in any case.
         */
-       if (http->entry->timestamp > -1)
-           if (http->entry->timestamp < squid_curtime)
-               httpHeaderPutInt(hdr, HDR_AGE,
-                   squid_curtime - http->entry->timestamp);
+       if (NULL == http->entry)
+           (void) 0;
+       else if (http->entry->timestamp < 0)
+           (void) 0;
+       else if (http->entry->timestamp > squid_curtime)
+           httpHeaderPutInt(hdr, HDR_AGE,
+               squid_curtime - http->entry->timestamp);
     }
     /* Handle authentication headers */
     if (request->auth_user_request)