Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

bug20222: fix DO-HTTP-REQUEST returning connections

It should not return the connection if it already knows it's not
keep-alive.

Change-Id: I865c0002170db2a9c677279d68ccb4de1d53302b
  • Loading branch information...
commit 268f67b072126c27ffd8c00d420f0e81cebb1f68 1 parent ab02222
authored May 26, 2011 melisgl committed June 09, 2011

Showing 2 changed files with 33 additions and 34 deletions. Show diff stats Hide diff stats

  1. 1  client.cl
  2. 66  test/t-aserve.cl
1  client.cl
@@ -1119,6 +1119,7 @@ or \"foo.com:8000\", not ~s" proxy))
1119 1119
 				creq :connection)))
1120 1120
 	     then ; connection will close, let it indicate eof
1121 1121
 		  (setf (client-request-bytes-left creq) :unknown)
  1122
+		  (setf (client-request-return-connection creq) nil)
1122 1123
 	     else ; no data in the response
1123 1124
 		  nil)
1124 1125
 	  
66  test/t-aserve.cl
@@ -1403,42 +1403,40 @@
1403 1403
 			   :keep-alive t)
1404 1404
       (declare (ignore body headers uri))
1405 1405
       (test 200 code2)
1406  
-      (test t (and "with no-keepalive" (not (null socket))))
1407 1406
       
1408  
-      ; now reuse it
  1407
+      (if* (not (asc x-proxy))
  1408
+         then (test t (not (null socket)) :fail-info "socket not kept alive"))
1409 1409
       
1410  
-      ;; bug20222: give a chance for the server to close the
1411  
-      ;; connection
1412  
-      (sleep (random 1.0))
1413  
-      (multiple-value-bind (body code3 headers uri socket2)
1414  
-	  (x-do-http-request (format nil "~a/redir-target" prefix-local)
1415  
-			     :keep-alive t
1416  
-			     :connection socket)
1417  
-	(declare (ignore body headers uri))
1418  
-	(test 200 code3)
1419  
-	(if* (and (not (asc x-proxy))
1420  
-		  (not (asc x-ssl)))
1421  
-	   then ; reuse should happen
1422  
-		(test socket (and "reuse socket" socket2))
1423  
-		(asc-format "~%~%pause ~d seconds ....~%" 
1424  
-			(+ net.aserve::*read-request-timeout* 10))
1425  
-		(force-output)
1426  
-		(sleep (+ net.aserve::*read-request-timeout* 10))
1427  
-		
1428  
-		; now the server should have shut down the
1429  
-		; socket so reuse will not happen
1430  
-		(multiple-value-bind (body code4 headers uri socket3)
1431  
-		    (x-do-http-request (format nil "~a/redir-target" prefix-local)
1432  
-				       :connection socket2)
1433  
-		  (declare (ignore body headers uri))
1434  
-		  (test 200 code4)
1435  
-		  (test t (and "not reuse socket" (not (eq socket2 socket3))))
1436  
-		  
1437  
-		  
1438  
-		  ))))
1439  
-    
1440  
-      
1441  
-    ))
  1410
+      (if* socket
  1411
+         then ;; now reuse it
  1412
+              ;; bug20222: give a chance for the server to close the
  1413
+              ;; connection
  1414
+              (sleep (random 1.0))
  1415
+              (multiple-value-bind (body code3 headers uri socket2)
  1416
+                  (x-do-http-request (format nil "~a/redir-target" prefix-local)
  1417
+                                     :keep-alive t
  1418
+                                     :connection socket)
  1419
+                (declare (ignore body headers uri))
  1420
+                (test 200 code3)
  1421
+                (if* (and (not (asc x-proxy))
  1422
+                          (not (asc x-ssl)))
  1423
+                     then               ; reuse should happen
  1424
+                     (test socket (and "reuse socket" socket2))
  1425
+                     (asc-format "~%~%pause ~d seconds ....~%" 
  1426
+                                 (+ net.aserve::*read-request-timeout* 10))
  1427
+                     (force-output)
  1428
+                     (sleep (+ net.aserve::*read-request-timeout* 10))
  1429
+                                        ; now the server should have
  1430
+                                        ; shut down the socket so
  1431
+                                        ; reuse will not happen
  1432
+                     (multiple-value-bind (body code4 headers uri socket3)
  1433
+                         (x-do-http-request (format nil "~a/redir-target"
  1434
+                                                    prefix-local)
  1435
+                                            :connection socket2)
  1436
+                       (declare (ignore body headers uri))
  1437
+                       (test 200 code4)
  1438
+                       (test t (and "not reuse socket"
  1439
+                                    (not (eq socket2 socket3)))))))))))
1442 1440
   
1443 1441
   
1444 1442
 

0 notes on commit 268f67b

Please sign in to comment.
Something went wrong with that request. Please try again.