Permalink
Browse files

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...
1 parent ab02222 commit 268f67b072126c27ffd8c00d420f0e81cebb1f68 Gabor committed with melisgl May 26, 2011
Showing with 33 additions and 34 deletions.
  1. +1 −0 client.cl
  2. +32 −34 test/t-aserve.cl
View
@@ -1119,6 +1119,7 @@ or \"foo.com:8000\", not ~s" proxy))
creq :connection)))
then ; connection will close, let it indicate eof
(setf (client-request-bytes-left creq) :unknown)
+ (setf (client-request-return-connection creq) nil)
else ; no data in the response
nil)
View
@@ -1403,42 +1403,40 @@
:keep-alive t)
(declare (ignore body headers uri))
(test 200 code2)
- (test t (and "with no-keepalive" (not (null socket))))
- ; now reuse it
+ (if* (not (asc x-proxy))
+ then (test t (not (null socket)) :fail-info "socket not kept alive"))
- ;; bug20222: give a chance for the server to close the
- ;; connection
- (sleep (random 1.0))
- (multiple-value-bind (body code3 headers uri socket2)
- (x-do-http-request (format nil "~a/redir-target" prefix-local)
- :keep-alive t
- :connection socket)
- (declare (ignore body headers uri))
- (test 200 code3)
- (if* (and (not (asc x-proxy))
- (not (asc x-ssl)))
- then ; reuse should happen
- (test socket (and "reuse socket" socket2))
- (asc-format "~%~%pause ~d seconds ....~%"
- (+ net.aserve::*read-request-timeout* 10))
- (force-output)
- (sleep (+ net.aserve::*read-request-timeout* 10))
-
- ; now the server should have shut down the
- ; socket so reuse will not happen
- (multiple-value-bind (body code4 headers uri socket3)
- (x-do-http-request (format nil "~a/redir-target" prefix-local)
- :connection socket2)
- (declare (ignore body headers uri))
- (test 200 code4)
- (test t (and "not reuse socket" (not (eq socket2 socket3))))
-
-
- ))))
-
-
- ))
+ (if* socket
+ then ;; now reuse it
+ ;; bug20222: give a chance for the server to close the
+ ;; connection
+ (sleep (random 1.0))
+ (multiple-value-bind (body code3 headers uri socket2)
+ (x-do-http-request (format nil "~a/redir-target" prefix-local)
+ :keep-alive t
+ :connection socket)
+ (declare (ignore body headers uri))
+ (test 200 code3)
+ (if* (and (not (asc x-proxy))
+ (not (asc x-ssl)))
+ then ; reuse should happen
+ (test socket (and "reuse socket" socket2))
+ (asc-format "~%~%pause ~d seconds ....~%"
+ (+ net.aserve::*read-request-timeout* 10))
+ (force-output)
+ (sleep (+ net.aserve::*read-request-timeout* 10))
+ ; now the server should have
+ ; shut down the socket so
+ ; reuse will not happen
+ (multiple-value-bind (body code4 headers uri socket3)
+ (x-do-http-request (format nil "~a/redir-target"
+ prefix-local)
+ :connection socket2)
+ (declare (ignore body headers uri))
+ (test 200 code4)
+ (test t (and "not reuse socket"
+ (not (eq socket2 socket3)))))))))))

0 comments on commit 268f67b

Please sign in to comment.