Module httpcommon

Module provides helper functions for HTTP protocol implementations

Types

ContentType* = object
  mimeType*: string
  charset*: string
  boundary*: string
Structure describing Content-Type header   Source Edit
ContentDisposition* = object
  disposition*: string
  name*: string
  filename*: string
  size*: int64
Structure describing Content-Disposition header   Source Edit

Procs

proc urlEncode*(s: string): string
Encodes s to be application/x-www-form-urlencoded compilant   Source Edit
proc urlDecode*(s: string): string
Decodes s from application/x-www-form-urlencoded compilant form   Source Edit
proc formEncode*(form: Props): string
Encodes form to application/x-www-form-urlencoded format   Source Edit
proc formDecode*(data: string; form: var Props)
Decodes data from application/x-www-form-urlencoded format into form   Source Edit
proc formDecode*(data: string): Props
Decodes data from application/x-www-form-urlencoded format   Source Edit
proc parseHeader*(line: string): (string, string)
Parses one header from line into key/value tuple   Source Edit
proc readHeaders*(s: AsyncStream): Future[Props] {.
async
.}
Reads http headers from the stream s   Source Edit
proc parseContentType*(value: string): ContentType
Parses the value of Content-Type header   Source Edit
proc `$`*(ct: ContentType): string
Forms the Content-Type value   Source Edit
proc parseContentDisposition*(value: string): ContentDisposition
Parses the value of Content-Disposition header   Source Edit
proc `$`*(cd: ContentDisposition): string
Forms the Content-Disposition value   Source Edit