Permalink
Browse files

http.server: closing socket without sending any text would hang the h…

…ttp.server. Fixes #311
  • Loading branch information...
1 parent fd944c5 commit b740d79d9196afb7179addd49c9b69a97e5eead0 @slavapestov committed Oct 29, 2011
Showing with 12 additions and 1 deletion.
  1. +11 −0 basis/http/http-tests.factor
  2. +1 −1 basis/http/server/server.factor
@@ -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
@@ -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* ;

0 comments on commit b740d79

Please sign in to comment.