gopher: some aesthetics.
parent
3ce5146235
commit
920d693205
|
@ -49,8 +49,7 @@ PRIVATE>
|
||||||
ERROR: not-a-gopher-url url ;
|
ERROR: not-a-gopher-url url ;
|
||||||
|
|
||||||
: gopher ( url -- item-type byte-array )
|
: gopher ( url -- item-type byte-array )
|
||||||
dup url? [ >url ] unless
|
>url dup protocol>> "gopher" = [ not-a-gopher-url ] unless {
|
||||||
dup protocol>> "gopher" = [ not-a-gopher-url ] unless {
|
|
||||||
[ host>> ]
|
[ host>> ]
|
||||||
[ port>> 70 or <inet> binary ]
|
[ port>> 70 or <inet> binary ]
|
||||||
[ path>> rest [ "1/" ] when-empty ]
|
[ path>> rest [ "1/" ] when-empty ]
|
||||||
|
@ -108,8 +107,7 @@ M: gopher-link >url
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: gopher. ( url -- )
|
: gopher. ( url -- )
|
||||||
dup url? [ >url ] unless
|
>url [ path>> ] [ gopher swap ] bi {
|
||||||
[ path>> ] [ gopher swap ] bi {
|
|
||||||
{ A_TEXT [ gopher-text. ] }
|
{ A_TEXT [ gopher-text. ] }
|
||||||
{ A_MENU [ gopher-menu. ] }
|
{ A_MENU [ gopher-menu. ] }
|
||||||
{ A_INDEX [ gopher-menu. ] }
|
{ A_INDEX [ gopher-menu. ] }
|
||||||
|
|
|
@ -48,6 +48,7 @@ TUPLE: gopher-server < threaded-server
|
||||||
|
|
||||||
:: list-directory ( server path -- )
|
:: list-directory ( server path -- )
|
||||||
path server serving-directory>> ?head drop [
|
path server serving-directory>> ?head drop [
|
||||||
|
[ "/" ] when-empty
|
||||||
"i[%s]\t\terror.host\t1\r\n\r\n" sprintf
|
"i[%s]\t\terror.host\t1\r\n\r\n" sprintf
|
||||||
utf8 encode write
|
utf8 encode write
|
||||||
] [
|
] [
|
||||||
|
@ -70,8 +71,8 @@ TUPLE: gopher-server < threaded-server
|
||||||
"%-40s %s %10s" sprintf
|
"%-40s %s %10s" sprintf
|
||||||
] [
|
] [
|
||||||
path prepend-path
|
path prepend-path
|
||||||
|
server serving-directory>> ?head drop
|
||||||
] bi
|
] bi
|
||||||
server serving-directory>> ?head drop
|
|
||||||
server serving-hostname>>
|
server serving-hostname>>
|
||||||
server insecure>>
|
server insecure>>
|
||||||
"%s%s\t%s\t%s\t%d\r\n" sprintf
|
"%s%s\t%s\t%s\t%d\r\n" sprintf
|
||||||
|
|
Loading…
Reference in New Issue