]> jfr.im git - irc/blitzed-org/bopm.git/commitdiff
scan.c: Apache ip vhosting hack (apaches fault!)
authorstrtok <redacted>
Mon, 21 Jan 2002 20:03:43 +0000 (20:03 +0000)
committerstrtok <redacted>
Mon, 21 Jan 2002 20:03:43 +0000 (20:03 +0000)
scan.c

diff --git a/scan.c b/scan.c
index 84e04312e6cd50a15f8316e2d4b7956168e8e41b..eee53166c9ecbf927962b66df441988784313775 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -462,7 +462,7 @@ int scan_r_squid(struct scan_struct *ss)
 {
 
   int len;
-
+  char *newline;
 
   len = recv(ss->fd, RECVBUFF, 512, 0);
 
@@ -473,10 +473,27 @@ int scan_r_squid(struct scan_struct *ss)
        
   
   if(!strncasecmp(RECVBUFF, "HTTP/1.0 200", 12) ||
-     !strncasecmp(RECVBUFF, "HTTP/1.1 200", 12))   
-        return 1;
-   
-   
+     !strncasecmp(RECVBUFF, "HTTP/1.1 200", 12))
+       {
+           newline = strchr(RECVBUFF, '\n');
+
+           if(!newline)
+                return 1;
+
+           newline++;  /* Increase sizeof(char) to bring us 1 char after /n */
+
+           if((newline - RECVBUFF) >= strlen(RECVBUFF)) 
+                return 1;
+
+           if(!strncasecmp(newline, "Date:",5))  
+                return 0;
+                                                /* Apache hack: (apache sends HTTP/1.x 200
+                                                 * sometimes when it shouldn't. This code checks
+                                                 * for the second header apache should send.*/
+
+           return 1;      /* Open Proxy */
+       }
+        
   return 0;
 }