puts eol eol file:R file:open !FID @FID file:size !Size [ buffer gopher:gets buffer tab? [ [ link ] html:tt eol ] [ gopher:i ] choose @FID file:tell @Size lt? ] while @FID file:close [ #70 [ $_ putc ] times ] html:tt html:br eol 'forthworks.com:80_/_atua-www_/_running_on_retro gopher:i '
puts ; ~~~ In a prior version of this I used `puts` 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:_ puts puts eol eol @Size [ fetch-next putc ] times drop ; ~~~ The only thing left is the top level server. ~~~ :gopher:server gopher:get-selector 'HTTP/1.0_200_OK puts 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 ~~~