-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(buffer): add from_parts and into_parts functions #1107
Merged
seanmonstar
merged 1 commit into
hyperium:0.10.x
from
illegalprime:feature/decons-bufreader
Mar 30, 2017
Merged
feat(buffer): add from_parts and into_parts functions #1107
seanmonstar
merged 1 commit into
hyperium:0.10.x
from
illegalprime:feature/decons-bufreader
Mar 30, 2017
Conversation
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 adds the ability to deconstruct a buffer into all of its parts and the ability to create a buffer from all of its parts, this lets users deconstruct the buffer, edit the reader, then build it back up again without losing any information
Ok! |
illegalprime
added a commit
to illegalprime/rust-websocket
that referenced
this pull request
Mar 31, 2017
this is possible with the help of hyperium/hyper#1107
illegalprime
added a commit
to illegalprime/rust-websocket
that referenced
this pull request
Apr 1, 2017
this is possible with the help of hyperium/hyper#1107
illegalprime
pushed a commit
to websockets-rs/rust-websocket
that referenced
this pull request
Apr 1, 2017
…date deps, and much more. * adds a common stream interface that is simpler than WebsocketStream * integrated new Stream trait and IntoWs struct * Fixed client creation with new stream trait Changes the way clients are created slightly: - (slightly, ostensibly) better performance when one knows if they want a secure connection or not. This means no match statement redirecting calls to their respective SSL or TCP stream. These calls have been named: - `connect` for insecure connections - `connect_secure` for secure connections - If one does not know how which connection it wants it can take the (not verified by testing) performance hit of putting the underlying stream on the heap behind a `Box`. This can be done with: - `connect_agnostic` All calls currently take the custom ToWebSocketUrlComponents but that should be changed to a `Url` (probably from rust-url). * started work on having the server side code use websocket upgrade * server now uses the ws upgrade trait to create clients * IntoWs for Streams & Request/Stream pairs Both streams and request/stream pairs can be made into a WsUpgrade struct. also AsTcpStream streams have a method to access the inner tcp stream. Things left: - Finish WsUpgrade struct: add methods and ability to accept or reject connections. - Implement IntoWs for a hyper serverside request. * started on hyper IntoWs integration The last bit is to extract the NetworkStream from a hyper server-side request and save that as a Stream, then turn it into an Incoming<(..)> and validate the request. Implementing Stream for a NetworkStream is proving complicated, since because now there is conflicting implementations for many structs implementing NetworkStream. * removed TryUnsizedClone and many Stream impls for a simpler model where all AsTcpStreams implement Stream * removed response and request from the server code in favor of WsUpgrade * moved hyper-specific upgrade implementation into its own module * implemented AsTcpStream for Box<AsTcpStream> This was initially very hard because one cannot clone unsized types and put them on the stack. I was about to revert to WebSocketStream style enum-variant-per-sized-type style but I managed to live another day without all those match blocks. * Steps toward implementing IntoWs for Hyper request The validation is done, now the only work is to extract the underlying stream. * sender and receiver not holding the stream anymore, client uses stream * added back splitting and shutting down client * started working on builder * finished builder pattern and removed unused modules * implement intows for hyper request, cleanup and refactoring * moved client builder into its own module * implemented intows * added TCP settings functions and verified questions about ws protocol * updated all dependencies to the latest and greatest * made openssl optional behind a feature gate * pass all current tests with warnings * tests pass without warnings * fleshed out roadmap, fixes #27 * added standard style enforced by the CI * added buffering reads and writes to roadmap * version bump to 0.18.0: major API change * easier wsupgrade api for protocols/exts, ability for client to verify protocols, etc. * changed stream trait to impl Read and Write, not contain * keep track of all the used buffers in BufReaders so no data goes missing this is possible with the help of hyperium/hyper#1107 * docs and doc tests
@seanmonstar I'm ready to publish the shiny new websockets crate but I can't until this change gets published in a hyper version, I was wondering what the timeline is for that? Thanks! |
5 tasks
Published v0.10.6 with this change. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
this adds the ability to deconstruct a buffer into all of its parts
and the ability to create a buffer from all of its parts, this lets
users deconstruct the buffer, edit the reader, then build it back up
again without losing any information
Currently a whole heap of changes is coming to rust-websocket, some of the changes require that we handle streams generically and therefore we need better interoperability with other buffered reader implementations. The large changes (which had to be done all at once) are in cyderize/rust-websocket#80, and include the ability to upgrade a hyper request to a websocket connection.