]> gitweb.factorcode.org Git - factor.git/commitdiff
http.server: closing socket without sending any text would hang the http.server....
authorSlava Pestov <slava@factorcode.org>
Sat, 29 Oct 2011 06:54:55 +0000 (23:54 -0700)
committerSlava Pestov <slava@factorcode.org>
Sat, 29 Oct 2011 06:54:55 +0000 (23:54 -0700)
basis/http/http-tests.factor
basis/http/server/server.factor

index f161b4276f0589c497d512db86631411da56c891..c960a6634ac301c0e4e7eef544ae13235933510c 100644 (file)
@@ -456,3 +456,14 @@ SYMBOL: a
 [ "OK\n\n" ] [ "http://localhost/" add-addr http-get nip ] unit-test
 
 [ ] [ stop-test-httpd ] unit-test
+
+! Check that just closing the socket without sending anything works
+[ ] [
+    <dispatcher>
+        add-quit-action
+    test-httpd
+] unit-test
+
+[ ] [ "addr" get binary [ ] with-client ] unit-test
+
+[ ] [ stop-test-httpd ] unit-test
index 961d3d34b42317e595fefcc060544dccb27b3a8a..4c5b76431c16c06901199b789ff24f64cd4323a4 100644 (file)
@@ -37,7 +37,7 @@ IN: http.server
     dup path>> "/" head? [ "Bad request: URL" throw ] unless ; inline
 
 : read-request-line ( request -- request )
-    read-?crlf [ dup empty? ] [ drop read-?crlf ] while
+    read-?crlf [ dup "" = ] [ drop read-?crlf ] while
     parse-request-line first3
     [ >>method ] [ >url check-absolute >>url ] [ >>version ] tri* ;