Commit Graph

61 Commits

Author SHA1 Message Date
Nabzokek Zubkenkanakov 4fbd9b471f
Header files documentation (#804)
* Added documentation of "crow::App", "crow::SimpleApp", "crow"
(namespace), all macros defined in "crow/app.h".
* Added documentation entry for file crow/TinySHA1.hpp, namespace sha1,
class sha1::SHA1, namespace crow and namespace crow::websocket
* Documented crow/app.h and also improved crow/TinySHA1.hpp documentation
* Update app.h
2024-04-24 23:35:13 +02:00
bugdea1er e3ff9238a4 Add option to use Boost.Asio 2024-04-19 17:06:13 +02:00
Boleyn Su 73c543a007 Fix use-after-move 2022-11-30 09:18:21 +01:00
Seungwoo Kang ac757ff0c9
Fix websocket crash from connection pointer dangling (#530)
* websocket: Add dangling-prevent anchor pointer

* websocket: Fix deadlock from incorrect expiration expectation

* webscoket: Fix unsafe write access to anchor_

* websocket: Fix build error from use of 'nullptr_t'

* websocket: Remove latent dereferencing on dangling 'this' pointer

* websocket: Resolve conflict with master branch

Co-authored-by: Vladislav <vladislav.oleshko@gmail.com>
2022-10-09 19:03:52 +03:00
Ryan Russell f5adec7803
refactor(websocket): readability improvements (#541)
Signed-off-by: Ryan Russell <git@ryanrussell.org>
Co-authored-by: Vladislav <vladislav.oleshko@gmail.com>
2022-09-19 00:34:43 +03:00
Seungwoo Kang 1e47bc67ba
websocket: Reduce number of re-allocation of string parameters (#535)
Co-authored-by: Vladislav <vladislav.oleshko@gmail.com>
2022-09-18 23:57:37 +03:00
The-EDev 6f832f82fa
added message string to websocket error handler 2022-06-21 02:23:51 +03:00
Luca Schlecker 2fbf93e211 replace std::error_code with asio::error_code.
This makes the code more consistent and also reflects the intention a little better.
2022-06-18 17:21:37 +03:00
Luca Schlecker 5b1c5a9e9e removing some boost includes, fixing version checks and further phase out boost. 2022-06-18 17:21:37 +03:00
Luca Schlecker f3d00bbecf replace boost::asio with standalone asio. 2022-06-18 17:21:37 +03:00
Luca Schlecker 2f87414769 replace usage of boost::iequals with utility::string_equals. 2022-06-18 17:21:37 +03:00
Michael Schreckenbauer efee71745b do not try to read from websocket after sending and receiving the close frame 2022-06-04 12:14:46 +02:00
Michael Schreckenbauer 65fcdea968 allow setting userdata in onaccept of websocket-connection 2022-05-27 14:06:12 +02:00
The-EDev f2b63f23f5
Fix for issue where app.stop() blocks when a websocket is open 2022-05-20 14:14:55 +03:00
Farook Al-Sammarraie 3e6c097733
Merge branch 'master' into #421-Websockets-should-support-a-maximum-payload 2022-05-18 20:04:38 +03:00
The-EDev 4128e5c27d
further formatting 2022-05-18 12:40:11 +03:00
The-EDev 333b49bf04
Replaced `do_not_destroy_` with `adaptor_.shutdown_readwrite()` +
formatting
2022-05-18 12:28:51 +03:00
The-EDev 57c3b43ac0
Fixed small bugs in code 2022-05-16 19:14:51 +03:00
oscar.chen a0a1925630 Pass the max payload in Connection constructor 2022-05-15 01:01:24 -07:00
oscar.chen 7164517622 use arrow not . 2022-05-14 19:10:05 -07:00
oscar.chen 89d99f6ae9 add missing commas 2022-05-14 18:46:49 -07:00
oscar.chen a30f0f6e4f fix wrong intializer syntax 2022-05-14 18:20:46 -07:00
oscar.chen 4daf126df0 Add websocket payload size for both app and WebsocketRule 2022-05-14 17:51:51 -07:00
The-EDev e5fe4e6e26
Used App reference to get websocket count and signals.
Also fixed issue where enabling SSL prevented compilation.
2022-05-15 01:15:39 +03:00
Farook Al-Sammarraie 9f99be55e1
Merge branch 'master' into ws_close 2022-05-14 18:56:39 +03:00
oscar.chen dc988ce27b fix clang format 2022-05-14 14:07:51 +03:00
oscar.chen 182b1ba915 #421 add rudimentary support for websocket max payload 2022-05-14 14:07:51 +03:00
The-EDev 78c7186897 Allowed Crow class to be passed to Websocket connection object 2022-05-14 12:05:06 +03:00
The-EDev 4cdde73388
Optimized HTTP parser
Also (likely) fixed problem with streaming without keeping connection
alive
Also fixed problem with multipart hanging on request
Also updated TODO entries to indicate Writer
2022-02-05 18:15:19 +03:00
The-EDev 869bc53150
format 2021-12-03 07:05:10 +03:00
The-EDev 94a2f942bc
changed comment style back to the original (doxygen did not work with the new style) 2021-12-03 06:39:23 +03:00
Luca Schlecker 7e4f1494d2 improved lambda bracing by inlining only empty lambdas.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-27 19:22:35 +01:00
The-EDev 03e59aa446
improved bracing rules, commented out clang-format 14 rule 2021-11-27 15:28:50 +03:00
The-EDev 7f4b7c8ff9
created new rules, used bot to enforce rules in PRs 2021-11-25 14:45:38 +03:00
The-EDev 65f8eb9e44
added macro to enforce ws spec and added 16/64 bit payload length unit tests for ws 2021-11-22 17:39:48 +03:00
The-EDev fd6de9bc05
Added functionality to close websocket connections before the app is
terminated.
This is incomplete and needs more work.
2021-11-06 06:06:18 +03:00
The-EDev 85e85c3e64
allow remote IP to be accessed from websocket object 2021-11-01 23:57:21 +03:00
The-EDev 576f90a0e4 Added Base64 decoder function and Base 64 unit tests 2021-10-31 02:50:19 +03:00
Lucas David 1bb5e0ac63 + auto to_read = static_cast<std::uint64_t>(buffer_.size());
~ if (remaining_length_ < to_read)
~   to_read = remaining_length_;
+ adaptor_.socket().async_read_some(boost::asio::buffer(buffer_, static_cast<std::size_t>(to_read))
- size_t to_read = buffer_.size();
~ if (remaining_length_ < to_read)
~   to_read = remaining_length_;
- adaptor_.socket().async_read_some( boost::asio::buffer(buffer_, to_read)

~ Changed 'to_read' from [std::size_t] to [std::uint64_t],
  hence when 'remaining_length_' [std::uint64_t] is assigned in 'to_read' no data is lossed.
  When boost::asio::buffer is created 'to_read' is casted back to [std::size_t] explicitly truncating data.
  It seems to be the correct behavior to choose fixed 'network side' types.
2021-07-27 17:04:54 +02:00
Lucas David 6aa5dba579 + buf[1] += static_cast<char>(size);
- buf[1] += size;

~ Warning was triggered by 'size' being std::size_t and lossing data by implicit casting to a narrower type.
  This behavior seems correct, then we can explicit cast it.
2021-07-27 15:39:51 +02:00
Sfinktah Bungholio 6597feb3a8 converted all (int) to static_cast 2021-02-21 11:14:30 +11:00
The-EDev fab2640702 Ping and Pong messages shouldn't fail with messages larger than 127 bytes anymore
Has the added advantage of making the code look more consistent, while sacrificing some performance (very little though)
2020-11-09 17:36:03 +03:00
The-EDev 5c7ef21211 websocket improvements
replaced base10 bits to base8 in comments
added send_ping and send_pong to API (users can now send them)
reset header value before every read
2020-11-09 04:41:55 +03:00
The-EDev 8dc61959f2 added method to send ping message 2020-11-05 04:10:33 +03:00
The-EDev 463917a17f added option to have unmasked messages 2020-11-04 07:16:03 +03:00
The-EDev 777dfa31af added documentation and illustration from RFC 6455 2020-11-04 06:20:09 +03:00
Igor Mróz 7b8b72bd11
Remove conanfile. Update mustache specification jsons. Remove compilation warnings. Update CMake version. Change test framework to Catch2. 2020-10-19 18:32:16 +02:00
SQyang 0cb9330125
Update websocket.h 2020-08-24 19:47:30 +08:00
SQyang 215b7dcf35
Update websocket.h 2020-08-13 13:18:16 +08:00
Jaeseung Ha 49bd1c2797
Merge pull request #261 from erikaldsund/fix_warning_in_websocket_h
Fixed warning in websocket.h: right shift count >= width of type
2017-12-25 02:29:25 +09:00