This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
chttp refactor #211
Merged
Merged
chttp refactor #211
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
05c4987
chttp streaming body refactor
tanner0101 715b6b8
protocol tester
tanner0101 33eb9ca
protocol tester cleanup
tanner0101 4a6167c
chttp header copy optimizations
tanner0101 7c02193
parser context cleanup
tanner0101 5195fbc
additional comments
tanner0101 5a26213
updates'
tanner0101 73b58a1
fix tests
tanner0101 7420b2a
http headers refactor
tanner0101 656a504
parser header re-use
tanner0101 82c2561
http tests passing
tanner0101 91d9553
updates
tanner0101 f287034
chttp refactor cleanup
tanner0101 69ead25
remove unnecessary public
tanner0101 1fe2883
tests passing
tanner0101 ad9e208
linux fixes
tanner0101 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ extension HTTPClient { | |
return HTTPClient(stream: tcpSocket.stream(on: worker), on: worker) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/// The location of a `Name: Value` pair in the raw HTTP headers data. | ||
struct HTTPHeaderIndex { | ||
/// Start offset of the header's name field. | ||
var nameStartIndex: Int | ||
/// End offset of the header's name field | ||
var nameEndIndex: Int | ||
|
||
/// Start offset of the header's value field. | ||
var valueStartIndex: Int | ||
/// End offset of the header's value field. | ||
var valueEndIndex: Int | ||
} | ||
|
||
extension HTTPHeaderIndex { | ||
/// The lowest index of this header. | ||
var startIndex: Int { | ||
return nameStartIndex | ||
} | ||
|
||
/// The highest index of this header. | ||
var endIndex: Int { | ||
return valueEndIndex + 2 // include trailing \r\n | ||
} | ||
|
||
/// The length of this header. | ||
var size: Int { | ||
return endIndex - startIndex | ||
} | ||
} | ||
|
||
extension HTTPHeaderIndex: CustomStringConvertible { | ||
/// See `CustomStringConvertible.description` | ||
var description: String { | ||
return "[\(nameStartIndex)..<\(nameEndIndex):\(valueStartIndex)..<\(valueEndIndex)]" | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot cleaner