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