Hi SuperSaiyan,

> I have some .htm and .txt files and wish to serve them via the picolisp 
> webserver. Unfortunately,  the mime function doesn't work the way I want it 
> to work. 
> The files aren't getting sent as 'text/html' or 'text/plain' for htm and txt 
> respectively. 
> 
> Curl says the files are sent as octet-steam, for both. Thoughts?

I get here for an .html file:

   HTTP/1.0 200 OK
   Server: PicoLisp
   Date: Wed, 29 Jan 2020 05:56:55 GMT
   Content-Type: text/html; charset=utf-8


> #tst.txt, header response
> Content-Type: text/octet-stream
> Content-Disposition: attachment; filename="tst.txt"

Correct. @lib/http.l has in '*Mime':

   (`(chop "txt") "text/octet-stream" 1 T)


> #tst.htm, header response
> Content-Type: application/octet-stream
> Content-Disposition: attachment; filename="tst.htm"

".htm" is not in '*Mime'. You can add an entry with 'mime' upon startup of your
program:

   (mime "htm" "text/html; charset=utf-8")

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to