James Coglan
7953bc39ff
Implement masking as a transform stream.
2014-05-11 22:07:34 +01:00
James Coglan
bf39b7b44b
Optimise some special cases in StreamReader; return a new Buffer from read() immediately if there's enough buffered data, and if the read can be fulfilled entirely from the first queued buffer than take a slice rather than copying into a new buffer.
2014-05-11 13:33:51 +01:00
James Coglan
85ba40ac32
Convert StreamReader so that it emits streams rather than waiting for an entire payload.
2014-05-09 15:35:40 +01:00
James Coglan
e6edb23681
Rather than a sync read() method in a loop, use an async read() method with a callback.
2014-05-08 16:35:21 +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
James Coglan
6588928445
Make HttpParser work on v0.11.6+.
2013-11-29 00:42:49 +00:00
James Coglan
151fddd206
Make the maximum frame length into an option that the user can set.
2013-11-28 23:38:42 +00:00
David Glasser
f15b331a34
Reduce frame max length to max Node Buffer length.
2013-10-11 19:21:14 -07:00
James Coglan
12f9f4d444
Add support for Basic Auth URLs to the client driver.
2013-08-13 17:16:49 +01:00
James Coglan
17e2bd4084
Messages should be queued when the driver is in the 'pre-connecting' state, as the client is initially.
2013-05-17 11:48:36 +01:00
James Coglan
3dfaaf497f
Expose the isSecureRequest() method.
2013-05-17 11:47:56 +01:00
James Coglan
97451f81ab
Set status and headers as soon as we have them so they're available if there is an error.
2013-05-12 14:44:17 +01:00
James Coglan
de001a0f54
Remove a blank line.
2013-05-12 01:45:56 +01:00
James Coglan
26c4873f3e
Apply offset to the consumed offset from HTTP parsing before we check whether the whole buffer has been used.
2013-05-12 01:45:04 +01:00
James Coglan
b2472e89a6
Document the Server driver.
2013-05-12 01:31:14 +01:00
James Coglan
1124df2bf5
Add a Server driver for running WebSockets through a bare TCP server.
2013-05-12 01:13:50 +01:00
James Coglan
ea4e289669
Add a setHeader() function to allow peers to add headers to their handshake responses.
2013-05-11 22:26:20 +01:00
James Coglan
d7c65eedd9
Expose the status and headers from the response in the client driver.
2013-05-11 21:58:37 +01:00
James Coglan
d594f7d708
Include more possible headers as indicators of a secure connection.
2013-05-11 21:55:52 +01:00
James Coglan
aa25393a6c
Check for GET in isWebSocket() and expose the isSecureRequest() method.
2013-05-04 17:27:25 +01:00
James Coglan
88202e66d5
Stream.end() should write() if given an empty stream.
2013-05-04 17:26:59 +01:00
James Coglan
25c075a408
Rename the module to websocket-driver.
2013-05-04 16:42:44 +01:00
James Coglan
f16ad50db0
Raise an error if the length header is larger than the max int that JS can represent precisely.
2013-05-04 13:33:27 +01:00
James Coglan
d716650499
Add more robust error handling for Hybi and Client and emit error events when the protocol goes wrong.
2013-05-02 00:09:14 +01:00
James Coglan
cbb33e4924
Allow default handler options to be overridden.
2013-05-01 00:59:54 +01:00
James Coglan
23f296b926
Replace the getVersion() method with a version property.
2013-05-01 00:55:49 +01:00
James Coglan
b56a960bb2
s/addListener/on/
2013-05-01 00:24:33 +01:00
James Coglan
f6481422b9
Firm up the event system. Make handlers only emit their own events, and then map those to Messages and IO events with a bit of glue. Only emit 'data' when streams are readable, same for 'end'.
2013-04-30 23:35:51 +01:00
James Coglan
9975aa089b
Use the Node EventEmitter class to publish events.
2013-04-30 08:20:14 +01:00
James Coglan
d2e958096c
Refer to the draft-76 request body as 'body' rather than 'head'.
2013-04-29 22:00:39 +01:00
James Coglan
e9bdd17cef
Correct a typo in stream docs.
2013-04-29 21:54:52 +01:00
James Coglan
e98eb72c6c
Remove comments about Node streams.
2013-04-29 21:51:00 +01:00
James Coglan
5dfe9ecdad
Return the protocol version from the Client handler.
2013-04-29 21:35:57 +01:00
James Coglan
c957874493
Make protocol.http() select the right driver for the request.
2013-04-29 20:46:17 +01:00
James Coglan
b354dd69fa
Implement the draft-76 protocol.
2013-04-29 20:27:35 +01:00
James Coglan
c70c5618da
Only end the messages stream when we trigger onclose.
2013-04-29 19:11:26 +01:00
James Coglan
6c025087f7
Emit 'end' from the messages stream when the socket's onclose event runs.
2013-04-29 19:08:10 +01:00
James Coglan
9ed82bc0ab
Extract the IO and Messages streams and flesh them out to implement backpressure.
2013-04-29 19:00:08 +01:00
James Coglan
e3b8033c58
Placeholder for draft-76 support just to get the common tests passing.
2013-04-29 08:56:05 +01:00
James Coglan
950cd9f1e2
Implement and test draft-75.
2013-04-29 08:40:05 +01:00