Commit Graph

  • 866aee9319 Add a 'native' option for opting in to using the native parser and unparser. James Coglan 2017-03-03 22:21:38 +00:00
  • 33c930be34 Check that control frames are smaller than 125, not larger. James Coglan 2017-03-03 22:20:36 +00:00
  • 6706fe31ce In order to correctly serialise the length of long frames, the Frame.length field should be a long and bitshifting should be done with >>>. This necessitates various casts to ints, which is what byte[] sizes are measured in. James Coglan 2017-03-01 18:11:20 +00:00
  • 8e307f3429 Create a new Message when the opcode is binary. This was responsible for a NullPointerException when emitting a message. James Coglan 2017-03-01 18:08:35 +00:00
  • 79134ffade Adjust formatting in construction of first byte in Unparser. James Coglan 2017-03-01 09:11:53 +00:00
  • 2d60b40b94 Implement Unparser in Java and use the native unparser in native_spec.rb. James Coglan 2017-03-01 00:45:49 +00:00
  • 000f0b81fc Due to JRuby's limitation of only accepting 3 arguments on @JRubyMethod methods, we need to pack a few of the arguments to Unparser#frame() into an array. James Coglan 2017-03-01 00:44:39 +00:00
  • 8a43a2879a Tidy up the JRuby bindings using factory methods for Ruby types. James Coglan 2017-02-27 23:50:51 +00:00
  • ddcd43995c Port the parser to Java, passing all the unit tests. James Coglan 2017-02-26 22:56:07 +00:00
  • 9a26f9cda3 Initial attempts at getting fuzzing set up with AFL and libfuzzer. fuzzing James Coglan 2017-02-12 23:49:37 +00:00
  • 38b8f63f10 Bump version to 0.6.5. 0.6.5 James Coglan 2017-01-22 19:58:03 +00:00
  • 17749524ec Silence warnings emitted under -W2. James Coglan 2017-01-11 22:37:52 +00:00
  • 60e4027c59 Extract the parsing/unparsing code from Hybi into Ruby classes that match the C API, drop the Native driver and allow Hybi to take options for which parsers to use. James Coglan 2017-01-06 09:11:37 +00:00
  • 5c15da3a32 Set up C extension for running tests through valgrind. James Coglan 2017-01-05 23:49:44 +00:00
  • 319275d07b Free the allocated Observer if allocating a Parser fails. James Coglan 2017-01-05 22:26:42 +00:00
  • bfcc911a81 Replace the Queue_scan function and callback with an external iterator that exposes the values. James Coglan 2017-01-05 21:56:28 +00:00
  • 914dadb973 Port the frame serializer to C. James Coglan 2017-01-05 21:38:26 +00:00
  • f36fe01a19 The parser opcode checking functions should take an opcode, not a Parser. James Coglan 2016-12-31 17:57:37 +00:00
  • 3f54340819 Add a C program to pass all the Autobahn test data through the parser directly, not via Ruby. We can use this to test the parser with Valgrind. James Coglan 2016-12-31 16:05:47 +00:00
  • ede6490add Refer to error messages as 'reasons' so as not to confuse them with WebSocket message structs. James Coglan 2016-12-31 15:48:47 +00:00
  • 2936754e81 Test on Ruby 2.4.0. James Coglan 2016-12-29 11:30:09 +00:00
  • 99a6e459fe The parser should keep reading as long as the read length is the same as the required length; sometimes this is zero. James Coglan 2016-12-29 11:28:18 +00:00
  • cee5700a02 Catch errors with close frames with invalid UTF-8. James Coglan 2016-12-29 02:10:51 +00:00
  • 21bfd23f1a Implement basic RSV checking for the case when no extensions are active. James Coglan 2016-12-29 01:55:23 +00:00
  • 6ffb801dd1 Remove a redundant check for continuation frames when there's no initialised message. James Coglan 2016-12-29 01:54:54 +00:00
  • fb8fcfa5f1 Run the Hybi specs against both the pure-Ruby and the native versions of the driver. James Coglan 2016-12-29 01:00:57 +00:00
  • 97b497a520 Drop the old native extension and replace it with the new all-C parser. Replace the old masking code with a Ruby version, so that the Hybi class is pure Ruby. James Coglan 2016-12-29 00:57:54 +00:00
  • 0eb64913ca Capture errors raise by emit() and re-raise them after the parser has finished running. James Coglan 2016-12-29 00:56:55 +00:00
  • 524aa3f356 Add handling of close frames. James Coglan 2016-12-29 00:34:36 +00:00
  • 8eaae3a149 Implement hooks for ping/pong. James Coglan 2016-12-28 18:04:27 +00:00
  • 78c5aea489 Check for valid UTF-8 after the message has gone through extensions, e.g. a deflate-encoded payload will not be valid UTF-8. James Coglan 2016-12-28 16:35:45 +00:00
  • ce21d26e48 Check the length of incoming frames, including checking what they would add to the total message size. James Coglan 2016-12-28 16:35:05 +00:00
  • 721644495b Implement the require_masking flag properly. James Coglan 2016-12-28 16:14:52 +00:00
  • d6ddd6eedc Implement some error handling: checking for non-final and too-long control frames, unmasked data, and continuation violations. James Coglan 2016-12-28 15:59:25 +00:00
  • ae62fc6322 Begin emitting native parser errors back to the driver, starting by handling invalid opcodes. James Coglan 2016-12-28 15:25:44 +00:00
  • 4fa9e19063 Merge pull request #48 from kbarrette/pure_ruby_masking James Coglan 2016-12-27 15:07:32 +00:00
  • fbd22b99aa Make wsd_Queue_destroy() for-loop simpler and remove an unused variable warning. James Coglan 2016-12-27 14:54:18 +00:00
  • 8366d2790a Move declarations to the top of WebSocketParser callbacks. James Coglan 2016-12-27 14:50:22 +00:00
  • 01e8bd904d Wrap calls out to the Ruby driver and user callbacks in rb_protect. James Coglan 2016-12-27 14:39:01 +00:00
  • 4e747733a3 Begin wiring the C parser up to a Ruby driver. Driver::Native is currently a hollowed-out copy of Driver::Hybi with the parsing code removed. James Coglan 2016-12-27 12:26:59 +00:00
  • d5b2af3782 Make the Observer and Parser structs opaque. James Coglan 2016-12-26 16:37:22 +00:00
  • abd0a9372c Make the Queue structs opaque. James Coglan 2016-12-26 15:59:31 +00:00
  • 94317d4461 Make the ReadBuffer structs opaque. James Coglan 2016-12-26 15:17:05 +00:00
  • 4a79ae4eea Remove a couple of demeter violations: the parser accessing buffer->capacity, and buffer reaching into its queue via queue->head->value. James Coglan 2016-12-26 12:55:46 +00:00
  • 10f180e9f1 Use a macro for freeing then nulling a pointer, and make sure all destructors null out pointers where appropriate. James Coglan 2016-12-26 12:14:51 +00:00
  • fd4bbb0c12 Don't check if pointers are not NULL before freeing them. James Coglan 2016-12-24 12:02:10 +00:00
  • 5f1a789e3b Null out member pointers after freeing them in destroy() functions. James Coglan 2016-12-24 11:02:00 +00:00
  • 75ccaa2e2a Make the benchmark frame generator work on 1.9. James Coglan 2016-12-24 02:03:03 +00:00
  • 29321d3867 The 'masking' field of wsd_Parser is not needed; it's a serialisation setting not a parsing one. James Coglan 2016-12-24 00:33:41 +00:00
  • 67de925527 Define _GNU_SOURCE in parser.c rather than parser.h to fix asprintf() warning (thanks @mjg59). James Coglan 2016-12-23 23:23:51 +00:00
  • 285a14d4cc Put the on_frame callback at the end of websocket_parser.c. James Coglan 2016-12-23 23:22:52 +00:00
  • 430ae06161 Use PRIu64 to print uint64_t. James Coglan 2016-12-23 23:05:02 +00:00
  • 87f93d2d6a define _GNU_SOURCE to silence warnings about asprintf. James Coglan 2016-12-23 22:56:56 +00:00
  • a269b58d09 Wrap wsd_Queue_each in braces to prevent 'C90 forbids mixed declarations and code' warnings. James Coglan 2016-12-23 22:34:42 +00:00
  • 51da1913ac Deal with most of the C90 'forbids mixed declarations and code' warnings. James Coglan 2016-12-23 22:24:29 +00:00
  • a6db9856b1 Include stdint.h to see if it fixes the build on Travis. James Coglan 2016-12-23 21:58:50 +00:00
  • 8d1792941f Introduce the Observer type for adding callbacks into the parser. James Coglan 2016-12-23 21:54:55 +00:00
  • 5e23116c6e Split the C parser up into multiple files, one per 'class'. James Coglan 2016-12-23 21:21:45 +00:00
  • 4772f71114 Put in more checks to the C parser to make sure each bit of the parser works, and begin putting in parser error handling. James Coglan 2016-12-23 20:58:24 +00:00
  • 11349c56b7 Queue.tail should be set to NULL if the current count is 1; count is not decremented until the end of the function. James Coglan 2016-12-23 08:49:00 +00:00
  • a4ed6af167 Align names of forward declarations; it makes them easier for me to read. James Coglan 2016-12-23 08:46:45 +00:00
  • 2e6d2b070d Begin a minimum-viable parser in C. James Coglan 2016-12-22 21:07:33 +00:00
  • cfc45f2360 Fall back to ruby Keith Barrette 2016-11-17 17:29:27 -05:00
  • 6e32ee04f3 Add Ruby mask implementation Keith Barrette 2016-11-04 14:48:01 -04:00
  • 568dc364a8 Bump Ruby versions 2.2 and 2.3 on Travis. James Coglan 2016-11-21 23:22:52 +00:00
  • 58cdc2305b Remove Rubinius from the build as it hasn't worked on Travis for weeks. James Coglan 2016-10-26 09:14:02 +01:00
  • 930bbe2020 Move the license text into a separate file. James Coglan 2016-07-19 20:57:38 +01:00
  • 673d11e436 Bump version to 0.6.4. 0.6.4 James Coglan 2016-05-20 08:46:06 +01:00
  • 9ce857b3d4 Revise uses of encoding APIs. James Coglan 2016-05-19 21:02:58 +01:00
  • 115d82bebb Silence all -W2 warnings. James Coglan 2016-05-18 22:42:16 +01:00
  • 15ba7410c6 Remove some unused variables from Hybi#send_frame. James Coglan 2016-05-18 22:33:33 +01:00
  • ca9faf0ff4 Update Ruby versions for Travis. James Coglan 2016-04-30 13:10:29 +01:00
  • 188b7d897e Create CODE_OF_CONDUCT.md. James Coglan 2015-11-08 12:16:43 +00:00
  • d515dc0894 Bump version to 0.6.3. 0.6.3 James Coglan 2015-11-06 22:24:35 +00:00
  • 4ae198b1d3 Throw a more helpful error if a client driver is created with an invalid URL. James Coglan 2015-10-17 21:37:13 +01:00
  • 3bf1ef1651 Update Rubies for Travis: 2.1.7, 2.2.3, jruby-9, rbx-2.5. James Coglan 2015-10-17 13:20:36 +01:00
  • 39824f5ace Silence C compiler warnings; use 'long' instead of 'int' for ruby string lengths. James Coglan 2015-10-11 14:15:57 +01:00
  • c63220194c Close the connection if a draft-76 client sends a Sec-WebSocket-Key header where the numeric value is a non-integer multiple of the number of spaces. James Coglan 2015-10-02 21:32:35 +01:00
  • 6b05bab4df Merge pull request #32 from amatsuda/warning James Coglan 2015-09-18 06:45:07 -04:00
  • 5ce5c98339 "warning: instance variable @delegate not initialized" Akira Matsuda 2015-07-21 16:41:49 +09:00
  • d860041db5 Add tests to make sure EventEmitter treats strings and symbols symmetrically. optimise-event-emitter James Coglan 2015-07-20 20:14:38 +01:00
  • adfe771923 Bump version to 0.6.2. 0.6.2 James Coglan 2015-07-18 17:40:40 +01:00
  • bc7d29cb52 Emit a protocol error when a closing frame has a 1-byte payload. James Coglan 2015-07-17 22:02:51 +01:00
  • 59940290c9 Emit close code 1000 if the closing frame does not contain one. James Coglan 2015-07-15 18:06:18 +01:00
  • 198a04a537 Bump version to 0.6.1. 0.6.1 James Coglan 2015-07-13 20:16:20 +01:00
  • be2e5ed9ce A few stylistic tweaks. James Coglan 2015-07-11 14:24:19 +01:00
  • d461b0def5 Use symbols for events in the docs. James Coglan 2015-07-10 21:27:01 +01:00
  • d4245ed3f4 Rather than implementing integer (un)packing ourselves, use the Array#pack and String#unpack methods. James Coglan 2015-07-10 19:58:06 +01:00
  • 7128d1b030 Standardise the words used to refer to chunks of parser input. James Coglan 2015-07-10 09:37:03 +01:00
  • 75fe55eaba Adjust how on() calls add_listener(). This is necessary because faye-websocket overrides add_listener with one argument, so users with faye-websocket locked at < 0.10 will see errors. James Coglan 2015-07-10 09:22:16 +01:00
  • f1fd96e093 Emit an error event *after* setting the ready state to 3. 0.6.0 James Coglan 2015-07-08 20:13:50 +01:00
  • 5764488603 Bump the version to 0.6.0. James Coglan 2015-07-08 20:08:20 +01:00
  • 8919430801 Add tests for exception safety in the Draft75 parser. James Coglan 2015-07-07 21:24:33 +01:00
  • fed81a5a88 Small format changes to StreamReader. James Coglan 2015-07-07 21:24:13 +01:00
  • 91653036ce Parse the mask flag and length in the order they appear in the protocol. James Coglan 2015-07-07 20:49:29 +01:00
  • e39fa15c07 Revert variable names in Draft75#parse to what they were in 0.5. James Coglan 2015-07-07 20:45:55 +01:00
  • 50ca31b4c8 Remove empty Driver#shutdown method. James Coglan 2015-07-07 20:40:53 +01:00
  • 9523937428 Initialize StreamReader in the base constructor. James Coglan 2015-07-07 20:38:26 +01:00
  • 91df761990 Hybi#shutdown doesn't really need to take a block, it can just take a flag to say whether to emit an error. James Coglan 2015-07-07 20:33:22 +01:00
  • dcfd35fde8 Remove some excessive whitespace. James Coglan 2015-07-07 20:32:47 +01:00