10 Commits

Author SHA1 Message Date
Chris Bailey 811940bb05 Update Jazzy docs with handler example and other minor improvements (#59) 2017-10-02 11:00:25 +01:00
Chris Bailey 055a757e15 Update README.md and Jazzy annotations (#43) 2017-09-10 16:21:20 +01:00
Ian Partridge ab8f280798 Remove API docs (#29)
* Update API docs

* Remove docs directory and update .gitignore
2017-08-23 14:17:00 +01:00
Ian Partridge 92f3ee4dc0 Add HTTPServer API (#26) 2017-08-23 10:44:04 +01:00
Chris Bailey 8f1f900474 Add initial set of Jazzy docs (#24) 2017-08-13 08:03:55 +01:00
Aleksey Mashanov 6e6ffe2124 Simplification of HTTPResponse/HTTPResponseWriter (#19)
* Simplification of HTTPResponse/HTTPResponseWriter

* `HTTPResponse` is redundent. Its `status` and `headers` properties
  are moved to parameters of `writeHeader` method of `HTTPResponseWriter`
  instance. `transferEncoding` handling is moved to `HTTPHeaders` - it
  is not as simple as an enum and depends on used HTTP protocol version
  and capabilites set by a client in its request headers.
  `httpVersion` should not be configured by an outer scope - a server should
  use the HTTP version which was requested by a client.

* `writeResponse` and `writeContinue` are replaced by `writeHeader`.

* `writeTrailer` accepts trailers as `HTTPHeaders` struct.

* All `write*` methods accept a completion handler.

* `writeBody` accepts `UnsafeHTTPResponseBody` instead of just `Data`
  and `Dispatch`. It should be used only in the scope of a call and a
  copy should be made or value should be checked for `HTTPResponseBody`
  conformance before storing it anythere. This approch allows to reduce
  memory copying.

* `Result<POSIXError, Void>` enum is replaced with `Result`. In the
  first case `POSIXError` and `Void` are generic parameters names, not
  types. I think this behaviour was unintended.

* Always respond with HTTP/1.1 for any HTTP/1.x requests

* Get back HTTPResponse for possible use in the client
2017-07-17 14:06:47 +01:00
aleksey-mashanov 7e366e4687 Make HTTPHeaders more user-friendly (#14)
* Make HTTPHeaders more user-friendly

* Header name is a struct conforming to `ExpressibleByStringLiteral`.
  Standard header names are available through static constants.
  This allows to save some CPU on lowercasing and hash value
  calculation.

* Original headers are stored until first modification. Iterator
  of `HTTPHeaders` iterates over original headers while they are actual,
  in other case it iterates over underlying mutable dictionary.

* Default subscript returns values of all headers with the same
  name concatenated with comma [RFC7230, section 3.2.2], except
  for "Set-Cookie" for which only first value is returned.

* As-is values of all headers with same name can be accessed
  through subscript with label `valuesFor`.

* append() method is modified to accept dictionary literal.
  replace() method is added.

* Split HTTPHeaders implementation to separate extensions
2017-06-28 12:54:41 +01:00
tanner0101 9691a6a526 spacing fixes 2017-06-14 18:59:07 +01:00
tanner0101 205a2652fc Merge branch 'develop' into just-modules 2017-06-14 18:55:29 +01:00
tanner0101 990a38227a clean up modules 2017-06-14 18:42:36 +01:00