http.server: closing socket without sending any text would hang the http.server. Fixes #311
							parent
							
								
									0d02c16d14
								
							
						
					
					
						commit
						721d035901
					
				| 
						 | 
				
			
			@ -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* ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue