29 Commits

Author SHA1 Message Date
Carl Brown 3739ce6037 Remove TODO comment for thing I'd already done. 2018-01-08 11:07:29 -06:00
Carl Brown 36adb9f32f Remove Logging variable no longer used and fixed typo
Thanks @gtaban for the feedback.
2018-01-08 10:57:54 -06:00
Carl Brown 66c6b6a06d Semaphores to fix TSAN warnings
Semaphores to track if abort() has been called

Semaphores to track if cleanup() has been called and only let it get called once
2018-01-03 14:06:30 -06:00
George 92dcc60699 Any informational header (1XX) should be allowed to be written prior to actual response headers.
Previously, this honor was only bestowed upon status 100 "Continue".
2017-11-12 12:45:59 -08:00
Arjun Nayini 2c4336880d [Code Style] Some code style changes (#92)
* [Code Style] Some code style changes

Minor changes to make some code Swiftier

* Fixes for PR feedback
2017-11-09 19:58:39 +00:00
Arjun Nayini 728b66d569 Lint and Clean up code (#84) 2017-11-07 11:34:33 -08:00
Aaron Liberatore 3aa8b03c06 Keep alive override (#57)
* Overridable keep alive timeout

* removes whitespace
2017-09-28 22:01:29 +01:00
Carl Brown 2ab754e00f Swift 4 support (#56) 2017-09-26 17:05:12 +01:00
Carl Brown defd4c7005 Push completion block to queueSocketWrite (#55)
* Push completion block to queueSocketWrite

* Fix test assert

I had put this fix in the PR for Swift 4 instead of the PR for this when I split them up. Sorry.
2017-09-26 17:04:52 +01:00
Aaron Liberatore 00adc53d0f Closes requests with Connection: close header (#52)
* Closes requests with Connection: close header

* Fixes whitespace and merge mistake
2017-09-24 13:27:14 +01:00
Carl Brown 280caad31d Honor &stopProcessingBody flag, with tests (#51)
Issue #48
2017-09-22 08:50:20 +01:00
David Jones a8205d2b7a Remove Keep-Alive header 2017-09-19 14:21:40 +01:00
David Jones 62aba99de0 Revise naming and type for requests remaining var 2017-09-19 14:17:30 +01:00
David Jones ee4b4d9620 Correct function of keepalive header 2017-09-19 14:17:13 +01:00
Chris Bailey d53f9432ce Perf: read connectionCount only when needed (#23) 2017-08-29 12:48:12 +01:00
Chris Bailey 75f022c06d Remove need for utils.* in CHTTPParser (#35) 2017-08-27 10:14:35 +01:00
Ian Partridge 6c0317d239 Add .swiftlint.yml and clean up project (#33) 2017-08-24 18:15:50 +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
Carl Brown 0da680a181 Fix for exclusive access issue in Swift 4 (#21) 2017-07-15 11:15:44 +01:00
seabaylea 48d155f3ed discardBody() should call done() 2017-06-30 17:34:54 +01:00
Chris Bailey 43702318d4 Convert HTTPMethod to a struct (#17)
* Convert HTTPMethod to a struct

* Compare on rawValue rather than description

* Remove RawRepresentable and add ExpressibleByStringLiteral conformance
2017-06-30 17:11:20 +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
Tanner 5a16db4ccb move response write convenience methods to extension (#10) 2017-06-20 16:56:04 +01:00
Tanner 3a21866782 rename Request to HTTPRequest 2017-06-16 11:51:32 +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