[bknr-cvs] edi changed trunk/thirdparty/hunchentoot/

BKNR Commits bknr at bknr.net
Thu Sep 30 23:59:12 UTC 2010


Revision: 4615
Author: edi
URL: http://bknr.net/trac/changeset/4615

Handle clients which send "Expect: 100-continue" twice

U   trunk/thirdparty/hunchentoot/CHANGELOG
U   trunk/thirdparty/hunchentoot/acceptor.lisp
U   trunk/thirdparty/hunchentoot/headers.lisp

Modified: trunk/thirdparty/hunchentoot/CHANGELOG
===================================================================
--- trunk/thirdparty/hunchentoot/CHANGELOG	2010-09-28 16:16:38 UTC (rev 4614)
+++ trunk/thirdparty/hunchentoot/CHANGELOG	2010-09-30 23:59:11 UTC (rev 4615)
@@ -1,3 +1,6 @@
+Made sure "100 Continue" is returned even if the client sends "Expect: 100-continue" twice (reported by Gordon Sims)
+Fixed typo in code which interprets transfer encodings
+
 Version 1.1.1
 2010-08-24
 Exported WITHIN-REQUEST-P (Faré Rideau)

Modified: trunk/thirdparty/hunchentoot/acceptor.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/acceptor.lisp	2010-09-28 16:16:38 UTC (rev 4614)
+++ trunk/thirdparty/hunchentoot/acceptor.lisp	2010-09-30 23:59:11 UTC (rev 4615)
@@ -318,7 +318,7 @@
                     (transfer-encodings (cdr (assoc* :transfer-encoding headers-in))))
                 (when transfer-encodings
                   (setq transfer-encodings
-                        (split "\\s*,\\*" transfer-encodings))
+                        (split "\\s*,\\s*" transfer-encodings))
                   (when (member "chunked" transfer-encodings :test #'equalp)
                     (cond ((acceptor-input-chunking-p *acceptor*)
                            ;; turn chunking on before we read the request body

Modified: trunk/thirdparty/hunchentoot/headers.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/headers.lisp	2010-09-28 16:16:38 UTC (rev 4614)
+++ trunk/thirdparty/hunchentoot/headers.lisp	2010-09-30 23:59:11 UTC (rev 4615)
@@ -256,18 +256,21 @@
          (maybe-write-to-header-stream first-line)
          (let ((headers (and protocol (read-http-headers stream *header-stream*))))
            (unless protocol (setq protocol "HTTP/0.9"))
-           (when (equalp (cdr (assoc :expect headers :test #'eq)) "100-continue")
-             ;; handle 'Expect: 100-continue' header
-             (let ((continue-line
-                    (format nil "HTTP/1.1 ~D ~A"
-                            +http-continue+
-                            (reason-phrase +http-continue+))))
-               (write-sequence (map 'list #'char-code continue-line) stream)
-               (write-sequence +crlf+ stream)
-               (write-sequence +crlf+ stream)
-               (force-output stream)
-               (maybe-write-to-header-stream continue-line)
-               (maybe-write-to-header-stream "")))
+           ;; maybe handle 'Expect: 100-continue' header
+           (when-let (expectations (cdr (assoc* :expect headers)))
+             (when (member "100-continue" (split "\\s*,\\s*" expectations) :test #'equalp)
+               ;; according to 14.20 in the RFC - we should actually
+               ;; check if we have to respond with 417 here
+               (let ((continue-line
+                      (format nil "HTTP/1.1 ~D ~A"
+                              +http-continue+
+                              (reason-phrase +http-continue+))))
+                 (write-sequence (map 'list #'char-code continue-line) stream)
+                 (write-sequence +crlf+ stream)
+                 (write-sequence +crlf+ stream)
+                 (force-output stream)
+                 (maybe-write-to-header-stream continue-line)
+                 (maybe-write-to-header-stream ""))))
            (values headers
                    (as-keyword method)
                    url-string





More information about the Bknr-cvs mailing list