Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP2 and gzip #1188

Merged
merged 78 commits into from
Nov 29, 2017
Merged

HTTP2 and gzip #1188

merged 78 commits into from
Nov 29, 2017

Conversation

Joannis
Copy link
Member

@Joannis Joannis commented Oct 8, 2017

This PR will focus on HTTP2 and Gzip.

The reason this is bundled is because HTTP2 relies on Huffman trees, which are are one of the primary components of Gzip. Gzip will not implement a good algorithm such as LZ77 yet but will instead use a primitive and unperformant implementation as a placeholder for a future PR.

Current state:

  • HPACK
  • ALPN for TLS
  • A very basic HTTP/2 client
  • Body streams (with an HTTP/1.1 implementation)

More todos will be added once they're almost up for development...

@Joannis Joannis self-assigned this Oct 8, 2017
@Joannis Joannis added the enhancement New feature or request label Oct 17, 2017
Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@@ -0,0 +1,80 @@
/// A stream is both an InputStream and an OutputStream
public typealias Stream = InputStream & OutputStream
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async module should be removed.

import Async
import Bits

public final class BodyStream: Async.Stream, ClosableStream {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

import Bits
import Foundation

final class ChunkEncoder: Async.Stream, ClosableStream {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

stream.onClose(onClose)
}

/// - TODO: Improve performance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should make that a private comment


// Send the settings, next
client.updateSettings(to: settings)
}.catch(client.promise.fail)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing

extension HTTP2Client {
/// Updates the frame's contents as settings, sends an acknowledgement
///
/// TODO: Settings changed in the middle of the stream affecting the context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have these as // so they don't show up in the documentation

Copy link
Member Author

@Joannis Joannis Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They won't, since they're internal APIs. And they serve as a good reminder

]

func testClient() throws {
// #if os(Linux)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get these working before merging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have an HTTP/2 host that I can test again. External hosts like google.com can not be connected to from CircleCI

XCTAssertThrowsError(try parser.parse(from: data))
}

func testTooLargeResponse() throws {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Joannis Joannis merged commit 90f75b1 into beta Nov 29, 2017
@Joannis Joannis deleted the http2-and-gzip branch November 29, 2017 08:33
@tanner0101 tanner0101 moved this from Backlog to Done in Vapor 3 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants