fix httpd

cvs
Slava Pestov 2006-01-17 15:47:15 +00:00
parent 7985d315f8
commit ddfadea21e
3 changed files with 7 additions and 7 deletions

View File

@ -9,9 +9,9 @@ io strings ;
: file-response ( mime-type length -- )
[
number>string "Content-Length" swons ,
"Content-Type" swons ,
] [ ] make "200 OK" response terpri ;
number>string "Content-Length" set
"Content-Type" set
] make-hash "200 OK" response terpri ;
: serve-static ( filename mime-type -- )
over file-length file-response "method" get "head" = [

View File

@ -19,7 +19,7 @@ sequences io strings ;
" " split1 drop string>number ;
: read-response ( -- code header )
#! After sending a GET oR POST we read a response line and
#! After sending a GET or POST we read a response line and
#! header.
flush readln parse-response read-header ;

View File

@ -9,7 +9,7 @@ SYMBOL: vhosts
SYMBOL: responders
: print-header ( alist -- )
[ unswons write ": " write url-encode print ] each ;
[ swap write ": " write url-encode print ] hash-each ;
: response ( header msg -- )
"HTTP/1.0 " write print print-header ;
@ -34,7 +34,7 @@ SYMBOL: responders
] with-scope ;
: serving-content ( mime -- )
"Content-Type" swons unit
"Content-Type" associate
"200 Document follows" response terpri ;
: serving-html "text/html" serving-content ;
@ -42,7 +42,7 @@ SYMBOL: responders
: serving-text "text/plain" serving-content ;
: redirect ( to -- )
"Location" swons unit
"Location" associate
"301 Moved Permanently" response terpri ;
: directory-no/ ( -- )