Minor docs fix and cleanup in http.server.static
parent
1a7e4b6576
commit
1682a5512a
|
@ -38,7 +38,7 @@ $nl
|
||||||
"If all you want to do is serve files from a directory, the following phrase does the trick:"
|
"If all you want to do is serve files from a directory, the following phrase does the trick:"
|
||||||
{ $code
|
{ $code
|
||||||
"USING: namespaces http.server http.server.static ;"
|
"USING: namespaces http.server http.server.static ;"
|
||||||
"/var/www/mysite.com/ <static> main-responder set"
|
"\"/var/www/mysite.com/\" <static> main-responder set"
|
||||||
"8080 httpd"
|
"8080 httpd"
|
||||||
}
|
}
|
||||||
{ $subsection "http.server.static.extend" } ;
|
{ $subsection "http.server.static.extend" } ;
|
||||||
|
|
|
@ -45,9 +45,8 @@ TUPLE: file-responder root hook special allow-listings ;
|
||||||
[ file-responder get hook>> call ] [ 2drop <304> ] if ;
|
[ file-responder get hook>> call ] [ 2drop <304> ] if ;
|
||||||
|
|
||||||
: serving-path ( filename -- filename )
|
: serving-path ( filename -- filename )
|
||||||
file-responder get root>> trim-tail-separators
|
[ file-responder get root>> trim-tail-separators "/" ] dip
|
||||||
"/"
|
"" or trim-head-separators 3append ;
|
||||||
rot "" or trim-head-separators 3append ;
|
|
||||||
|
|
||||||
: serve-file ( filename -- response )
|
: serve-file ( filename -- response )
|
||||||
dup mime-type
|
dup mime-type
|
||||||
|
|
Loading…
Reference in New Issue