s:put eol eol file:R file:open !FID @FID file:size !Size [ buffer gopher:s:get buffer tab? [ [ link ] html:tt eol ] [ gopher:i ] choose @FID file:tell @Size lt? ] while @FID file:close [ #70 [ $_ c:put ] times ] html:tt html:br eol 'forthworks.com:80_/_atua-www_/_running_on_retro gopher:i '
s:put ; ~~~ In a prior version of this I used `s:put` to send the content. That stopped at the first zero value, which kept it from working with binary data. I added `gopher:send` to send the `Size` number of bytes to stdout, fixing this issue. ~~~ :gopher:send (p-) requested-file get-mime-type 'Content-type:_ s:put s:put eol eol @Size [ fetch-next c:put ] times drop ; ~~~ The only thing left is the top level server. ~~~ :gopher:server gopher:get-selector 'HTTP/1.0_200_OK s:put eol gopher:file-for-request @Server-Info [ gopher:generate-index ] [ gopher:read-file gopher:send ] choose ; ~~~ Close off the helper portion of the namespace. ~~~ }} ~~~ And run the `gopher:server`. ~~~ gopher:server reset ~~~