about summary refs log blame commit diff stats
path: root/src/io/about.nim
blob: a3ecb1fe910bb33c006b8c30161f1aac5ac8df75 (plain) (tree)
1
2
3
4
5
6
7
8






                    
                                          




                                                    





                                        



                                        
                         



                      
import streams
import tables

import io/request
import ips/serialize
import types/url

const chawan = staticRead"res/chawan.html"
const Headers = {
  "Content-Type": "text/html"
}.toTable()

proc loadAbout*(request: Request, ostream: Stream) =
  if request.url.pathname == "blank":
    ostream.swrite(0)
    ostream.swrite(200) # ok
    let headers = newHeaderList(Headers)
    ostream.swrite(headers)
  elif request.url.pathname == "chawan":
    ostream.swrite(0)
    ostream.swrite(200) # ok
    let headers = newHeaderList(Headers)
    ostream.swrite(headers)
    ostream.write(chawan)
  else:
    ostream.swrite(-1)
  ostream.flush()