James Coglan
23675e08ee
Don't expose the internal frame structure of messages to extensions; they should not be able to depend on seeing the actual frame boundaries off the wire because that requires all extensions to leave them intact.
2014-12-06 22:08:37 +00:00
James Coglan
66f46330e7
Remove some blank lines.
2014-12-05 19:36:06 +00:00
James Coglan
7376f48d6a
Catch errors raised by Extensions.activate().
2014-12-02 22:53:16 +00:00
James Coglan
330fa2073d
Don't assume that messages coming out of extensions have anything but the standard websocket-extensions API.
2014-11-29 01:54:20 +00:00
James Coglan
58474a837c
Populate the Message.data field before handing off to extensions.
2014-11-29 01:13:18 +00:00
James Coglan
82182eb348
Close the Extensions object when ending the session.
2014-11-29 00:55:02 +00:00
James Coglan
94041e7a86
websocket-extensions uses Node-style callbacks rather than emitting error events.
2014-11-27 09:32:49 +00:00
James Coglan
e73f7db754
Rename validFrame() to validFrameRsv().
2014-11-26 09:59:08 +00:00
James Coglan
0efc0ebb8d
Don't pass the driver into the Extensions constructor.
2014-11-25 23:17:39 +00:00
James Coglan
f904131d21
Extract the Extensions class into another module.
2014-11-25 21:14:17 +00:00
James Coglan
ee664ba6c9
Decouple Extensions and individual extension libs from the Driver.fail() method, emitting errors instead.
2014-11-25 19:42:54 +00:00
James Coglan
538239b761
Move the header-parsing functions into class methods on Extensions.
2014-11-25 09:11:58 +00:00
James Coglan
2bc103c781
Adjust the data structures in the Extensions parser so that the server sets the order of extensions, per the spec.
2014-11-24 23:03:50 +00:00
James Coglan
eceb59e2fb
Implement the client-side framework for extensions.
2014-11-24 22:05:31 +00:00
James Coglan
40341c5439
The Client driver requires the crypto module for generating keys.
2014-11-24 00:41:34 +00:00
James Coglan
396637d463
Extract permessage-deflate into a separate module.
2014-11-23 21:46:04 +00:00
James Coglan
c986ad231c
Enable strict mode on all source files.
2014-11-23 20:09:26 +00:00
James Coglan
ef897eed1c
Implement deflate compression on server-to-client messages.
2014-11-23 19:45:02 +00:00
James Coglan
724a5f19a4
Flesh out the parameter validation for extensions, and provide better support for multiple values of extension params and HTTP headers.
2014-11-23 15:21:11 +00:00
James Coglan
0332ce2625
Initial support for permessage-deflate, only supports client-to-server compression but enough to pass the Autobahn suite.
2014-11-23 13:11:24 +00:00
James Coglan
6146615801
Extract Hybi parser state into Frame and Message structs.
...
This makes the structure of all the state in the parser easier to see,
it makes it easier to free memory by deleting a single struct rather
than many related fields, and it produces some data structures that will
be useful for adding extensions.
2014-11-22 13:34:34 +00:00
James Coglan
7325241d11
Move the header setting for Sec-WebSocket-Protocol.
2014-11-08 17:46:03 +00:00
James Coglan
eb2d329a16
Clean up some formatting typos.
2014-11-08 17:20:51 +00:00
James Coglan
623a93c0b7
Duplicate headers should be allowed if ALLOWED_DUPLICATES *includes* the name.
2014-11-08 16:39:40 +00:00
James Coglan
208be33754
Refactor the way headers are generated in all the drivers.
2014-11-08 16:12:14 +00:00
James Coglan
0bb47c17b4
Remove TLS concerns from the proxy implementation.
...
This results in a more simple design, in the sense of fewer concerns
being mixed together. It makes the API more verbose, but it's not
difficult to use correctly.
It also means that we make the I/O implementation deal with TLS, so it
can use tls.connect({socket: io}) or the upcoming TLSSocket class,
rather than this module needing a huge amount of boilerplate and
internal indirection to use tls.createSecurePair() and make Proxy wrap
pair.encrypted.
Using tls.connect({socket: io}) would be awkward on this end, because it
expects a stream that emits *incoming* data from the TCP connection. All
the streams in this module emit *outgoing* data that should be written
to TCP, so their polarity is flipped compared to what tls.connect()
wants, and resolving that involves even more stream boilerplate.
2014-11-08 15:20:08 +00:00
James Coglan
d6da566641
Only call tls.checkServerIdentity() if it is available (i.e. before Node 0.8.).
2014-11-07 19:17:12 +00:00
James Coglan
cde48d625c
Move http_parser.js up into the lib/websocket directory.
2014-11-07 19:16:35 +00:00
James Coglan
6eb04d5acc
Remove a redundant assignment.
2014-11-06 23:20:32 +00:00
James Coglan
4348bec390
Some cleanup to remove bits I left lying around while refactoring proxy support.
2014-11-06 23:04:11 +00:00
James Coglan
550b3d906d
Unify the proxy handshake, TLS handshake, and WebSocket protocol into a single stream when using driver.proxy() to simplify the API.
2014-11-05 23:30:15 +00:00
David Glasser
b88b8d6856
proxy should emit 'close' when it's done
...
This will cause any stream piped into it to stop piping into it. (It's
the only way to unpipe a Node 0.8 Streams1-style pipe.)
This change allows you to remove the empty "stream.on('data')" in
faye-websocket.
2014-10-29 16:47:56 -07:00
James Coglan
76f4128634
Redesign the proxy API so that we can more cleanly deal with TLS, either to the proxy server or origin server or both, while still allowing control of the TLS options and custom headers, and not leaking so much of the implementation.
2014-10-29 22:07:01 +00:00
James Coglan
32e6715b6e
[wip] Emit a proxy-connect event so the client can perform a TLS handshake at the right time.
2014-10-29 19:27:30 +00:00
James Coglan
bdc9bfe7e8
Add support for connecting via HTTP proxies.
2014-10-27 09:30:11 +00:00
David Glasser
dcd7c278b6
driver.close() before driver.start() should close
2014-08-15 10:48:30 -07:00
James Coglan
28858d9fb3
Delegate the protocol and version methods correctly in the TCP driver.
2014-07-04 17:49:11 +01:00
James Coglan
ae52cf995e
Stop the Hybi parser hanging onto data it doesn't need after emitFrame().
2014-06-16 20:30:44 +01:00
James Coglan
dfe7b2b000
Trailing blank lines are bad.
2014-05-17 00:35:31 +01:00
James Coglan
ed3907d5fd
Clean up the state management code in StreamReader.
2014-05-07 20:49:49 +01:00
David Glasser
8d19ee823e
StreamReader: Don't hang on to fully read buffers
2014-05-06 11:52:59 -07:00
James Coglan
9f2782da14
Correct the draft-76 status line reason phrase.
2014-04-17 02:23:58 +01:00
James Coglan
0b089ad921
Merge pull request #5 from Zarel/patch-1
...
Lower default max buffer length
2013-12-27 10:17:09 -08:00
James Coglan
e65e837968
Stop parsing Hybi when we go into a failure state.
2013-12-27 18:16:41 +00:00
Guangcong Luo
cda22e3bef
Lower default max buffer length
...
Real-world testing shows that the previous max buffer length
of ~1GB was too high, and messages of the size of roughly 300MB
could still cause the process to crash from running out of
memory. 64MB seems like a reasonably conservative maximum.
2013-12-24 19:26:38 -06:00
James Coglan
1ae37d6efe
Remove an unused instance variable _lengthBuffer.
2013-12-20 10:20:41 +00:00
James Coglan
82c42a6ce5
Extend max-length checking to draft-{75,76}.
2013-12-20 10:09:31 +00:00
James Coglan
aad1519f3f
Extend max-length checking to short (<= 125 bytes) frames and to sequences of continuation frames.
2013-12-20 09:50:18 +00:00
James Coglan
d93c853414
Don't pre-allocate a huge Buffer before we know there's enough chunks in the read queue to complete a message.
2013-12-02 21:07:33 +00:00
James Coglan
2dff35d3e4
Map Node v0.11's magic numbers for HTTP methods.
2013-12-02 13:02:38 +00:00