Bug in aserve: 204 No Content (with patch)
Vebjorn Ljosa <[email protected]> Wed, 20 Sep 2006 16:41:05 -0700
| Newsgroups | gmane.lisp.open-source.franz |
|---|---|
| Message-ID | <[email protected]> |
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi
The HTTP client in Aserve does not seem to handle "204 No Content"
responses: It just hangs, trying to read the body of the response. An
example is the following URL:
http://yamuna.cs.ucsb.edu/~ljosa/nocontent.php
To reproduce:
(do-http-request "http://yamuna.cs.ucsb.edu/~ljosa/nocontent.php")
Handling 204 responses is important because some web services (e.g.,
Amazon.com's "Simple Storage Service," S3) use them.
I have attached a patch. It can be applied successfully both to
aserve-1.2.47 and to the CVS version of portableaserve.
Thanks,
Vebjorn
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="aserve-no-content.diff"
Index: packages.cl
===================================================================
RCS file: /cvsroot/portableaserve/portableaserve/aserve/packages.cl,v
retrieving revision 1.6
diff -u -r1.6 packages.cl
--- packages.cl 20 Feb 2005 12:20:45 -0000 1.6
+++ packages.cl 20 Sep 2006 23:35:11 -0000
@@ -150,6 +150,7 @@
#:*http-response-timeout*
#:*mime-types*
#:*response-accepted*
+ #:*response-no-content*
#:*response-bad-request*
#:*response-continue*
#:*response-created*
Index: client.cl
===================================================================
RCS file: /cvsroot/portableaserve/portableaserve/aserve/client.cl,v
retrieving revision 1.18
diff -u -r1.18 client.cl
--- client.cl 20 Feb 2005 12:20:45 -0000 1.18
+++ client.cl 20 Sep 2006 23:35:13 -0000
@@ -217,11 +217,13 @@
(cdr (assoc :location (client-request-headers creq)
:test #'eq))))
- (if* (and (null new-location)
- ; not called when redirecting
- (if* (functionp skip-body)
- then (funcall skip-body creq)
- else skip-body))
+ (if* (or (and (null new-location)
+ ; not called when redirecting
+ (if* (functionp skip-body)
+ then (funcall skip-body creq)
+ else skip-body))
+ (= (client-request-response-code creq)
+ #.(net.aserve::response-number *response-no-content*)))
then
(return-from do-http-request
(values
Index: main.cl
===================================================================
RCS file: /cvsroot/portableaserve/portableaserve/aserve/main.cl,v
retrieving revision 1.46
diff -u -r1.46 main.cl
--- main.cl 19 Feb 2006 10:32:44 -0000 1.46
+++ main.cl 20 Sep 2006 23:35:14 -0000
@@ -920,6 +920,7 @@
(defparameter *response-ok* (make-resp 200 "OK"))
(defparameter *response-created* (make-resp 201 "Created"))
(defparameter *response-accepted* (make-resp 202 "Accepted"))
+(defparameter *response-no-content* (make-resp 204 "No Content"))
(defparameter *response-partial-content*
(make-resp 206 "Partial Content"))
(defparameter *response-moved-permanently* (make-resp 301 "Moved Permanently"))
@@ -942,6 +943,7 @@
*response-ok*
*response-created*
*response-accepted*
+ *response-no-content*
*response-moved-permanently*
*response-found*
*response-see-other*
--azLHFNyN32YCQGCU--