223 Commits

Author SHA1 Message Date
Peter Thorson
2c3d714a9e [improvement] Improve error handling options for get_connection and start_accept. Update docs. fixes #896 2020-08-07 08:36:20 -05:00
Peter Thorson
266720951c Merge branch 'SophiaTX-set_body-move' into develop
# Conflicts:
#	websocketpp/connection.hpp
#	websocketpp/impl/connection_impl.hpp
2020-07-31 06:49:34 -05:00
Dmitry Matrokhin
ec5c379401 Add test and refactor to_hex
Avoid std::string creation and code duplication.
2020-07-02 02:03:48 +03:00
Peter Thorson
d9f48e734d [core/http] Many updates to remove or isolate the use of exceptions. Update bundled HTTP library to remove the use of exceptions for error handling. All exceptions have been replaced with the error_codes used by the rest of the library either returned or as an output parameter. Documentation has been updated to note when this has happened. The main library interface has been updated to ensure that all functions that can throw are labeled as such and have a non-throwing overload. Nothing has been removed from the main library interface so anyone who uses exception handling with the main library is unaffected. These changes are being done in preparation for adding options to build WebSocket++ on platforms with exceptions disabled. references #438 #908 2020-06-27 17:51:46 -05:00
Peter Thorson
9f49a15d61 fix regression in new uri parsing logic. Add new test case for this situation. fixes #886 2020-04-28 09:45:57 -05:00
Peter Thorson
f7781fa4dd misc cleanup 2020-04-19 22:23:27 -05:00
Peter Thorson
20ea478989 Overhaul URI authority handling to allow better validation per RFC3986. Allows detecting IPv6 literal addresses in order to generate valid URI strings. fixes #601 references #879 2020-04-19 22:07:33 -05:00
Matus Kysel
eaff20e5ac Added move set_body for preformance 2019-02-13 14:54:18 +01:00
Gianfranco Costamagna
5c48a114f4 Fix testsuite errors, due to a "Connection: upgrade" seen differently than "Connection: Upgrade" 2018-07-12 19:10:02 +02:00
Peter Thorson
c4050979c3 tcp_pre_bind_handler returns a lib::error_code not an asio::error_code. These are sometimes the same but not always. Fix ensures that the error code types always match correctly no matter what they are. Update test suite to reflect adjusted behavior 2017-09-24 10:44:21 -05:00
Peter Thorson
0b2e14ee3a Merge branch 'pr/589' into develop 2017-06-11 17:44:02 -05:00
Peter Thorson
2819d364d9 Merge branch 'develop' into integration_tests_sleep 2017-06-11 16:31:21 -05:00
Peter Thorson
d282738c81 Merge branch 'pr/643' into develop 2017-06-11 16:28:58 -05:00
Peter Thorson
6645fcb390 Merge pull request #646 from alex-che/timers_tests_sleep
Fix the tls_handshake_timeout unit test failing due to server thread …
2017-06-11 16:18:00 -05:00
Peter Thorson
29bb4ada91 Merge branch 'pr/647' into develop 2017-06-11 16:16:38 -05:00
Peter Thorson
9ddb300d87 Update permessage-deflate support to reflect that zlib doesn't support a 256 bit window. Improve extension negotiation error checking and documentation. fixes #596 fixes #653 2017-06-11 15:24:43 -05:00
Alex Korotkin
527f401049 Fix unitialized shared_ptr in mock_endpoint 2017-05-17 09:54:14 +03:00
Alex Korotkin
00456642fa Fix the tls_handshake_timeout unit test failing due to server thread not having enough time to start 2017-05-17 09:48:33 +03:00
Alex Korotkin
7be37565ca Fix refused client connection due to servers not yet started
The server thread in a unit test may not have enough time to start and the
ongoing client connection will be refused. Fix this by adding sleep.
2017-05-16 18:13:11 +03:00
Alex Korotkin
5675036891 Fix unit test timers clashing between tests
If unit tests run long enough, then test timers fired for former unit tests can start to fail while running latter unit tests.
2017-05-16 16:51:43 +03:00
Peter Thorson
abf927bb24 Fix some bugs, normalize code style, update documentation, add tests
Method needs to be public to be useful, updated return type to const
reference for efficiency
2016-10-14 08:27:06 -05:00
Johan de Vries
f94b3c0e4c Implemented close code 1014
Also adds two missing messages to get_string()
2016-10-10 10:05:15 +02:00
Jupp Müller
1013aa89bc Fix shutdown bugs by holding loggers in shared_ptrs
This change fixes a shutdown crash occuring when using an
external io_service to drive a websocketpp server. The crash
itself is reproduced by the following code:

```

int main(int argc, const char * argv[])
{
    boost::asio::io_service ioService;
        std::unique_ptr<boost::asio::io_service::work> ioServiceWork(new boost::asio::io_service::work(ioService));
            std::thread ioServiceThread(boost::bind(&boost::asio::io_service::run, &ioService));

    {
        auto server = std::unique_ptr<websocketpp::server<websocketpp::config::asio>>(new websocketpp::server<websocketpp::config::asio>());
        server->init_asio(&ioService);
        server->listen(0);
        server->start_accept();

        server->stop();
    }

    ioServiceWork.reset();
    ioService.stop();
    ioServiceThread.join();

    return 0;
}
```

The cause of the crash is a dangling pointer to alog or elog objects in endpoints.
This is mitigated by storing logging objects as shared_ptrs. This ensures that
they are kept alive and able to log even if their owning structures have already
been deallocated.
2016-03-31 16:49:16 +02:00
Peter Thorson
918745a7ea Add test case for un-setting a handler (with NULL) 2016-02-26 06:20:53 -05:00
Peter Thorson
3f913f97ef update tls version used in tls timer tests 2016-02-21 18:24:37 -05:00
Peter Thorson
ffaeba2ec7 switch comment style in connection tests 2016-02-21 18:24:19 -05:00
Gregor Jasny
89df55c577 Register tests to CTest 2016-01-05 09:51:15 +01:00
vladon
cd4af122c0 avoid unnecessary empty strings ("") in favor of clear() and empty() (performance) 2015-09-29 21:36:41 +03:00
Peter Thorson
b6817e4c7e Actually have the response status getters work; also tests 2015-09-19 10:54:50 -04:00
Peter Thorson
fb829e0895 Misc changes related to translation of asio transport errors #448 2015-08-20 10:14:55 -04:00
Eli Fidler
15c78afbf4 fix crash in strip_lws()
Before this fix, a malicious client could cause a websocketpp server to create an invalid std::string.
2015-08-04 12:01:14 -04:00
Peter Thorson
22918a3992 Merge branch 'permessage-deflate' into develop
Conflicts:
	Doxyfile
	examples/utility_client/CMakeLists.txt
	websocketpp/version.hpp
2015-07-29 09:12:21 -04:00
Peter Thorson
ef380f7fff Add CMake build support for examples and tests, zlib dependencies 2015-07-29 08:57:56 -04:00
Thijs Wenker
d3fe51fa39 Added missing CMake files, organized the CMake structure between test and example directories using the global variable USE_FOLDERS 2015-07-16 12:17:59 +02:00
Peter Thorson
0d7052d2ae Merge branch 'master' into permessage-deflate
Update permessage-deflate to track latest release version.
2015-06-03 09:21:06 -04:00
Peter Thorson
c5510d6de0 Merge branch 'develop'
Conflicts:
	CMakeLists.txt
	Doxyfile
	changelog.md
	readme.md
	websocketpp/version.hpp
2015-06-02 08:55:24 -04:00
Peter Thorson
acb53a379c Refactor deferred http handler support to better match the library conventions 2015-04-29 20:00:20 -04:00
Peter Thorson
c18f210ea3 Allow deferring the sending of an HTTP response. references #425
This allows processing of long running http handlers to defer their
response until it is ready without blocking the network thread.
2015-04-29 19:28:36 -04:00
Peter Thorson
769fe89533 Major refactor to support standalone Asio and remove Boost dependencies
It is now possible to use WebSocket++’s asio transport using only
standalone asio by defining ASIO_STANDALONE before including any
WebSocket++ headers.
2015-04-25 07:17:28 -04:00
Peter Thorson
6300e090ad disable emplace test
emplace requires move assignability which the class in question doesn’t
support.
2015-03-05 07:55:03 -06:00
Peter Thorson
39dbe3a4e0 adds a vectored write handler for iostream transport 2015-03-04 18:42:55 -06:00
Peter Thorson
371d2cdaef Merge branch 'master' into permessage-deflate
Conflicts:
	websocketpp/version.hpp
2015-02-27 09:55:51 -05:00
Peter Thorson
9efb12e59b Fixes an issue where some frame data was counted against the max header size limit
End result was that connections that included a lot of frame data
immediately after the initial handshake would erroneously fail due to
hitting the max header size limit.
2015-02-27 09:48:00 -05:00
Peter Thorson
8f042d95ec don't test for std::move on non-c++11 systems 2015-02-06 08:07:42 -05:00
Peter Thorson
0278ba7895 temporary disable of a unit test 2015-02-06 08:00:36 -05:00
Peter Thorson
4bea90f555 preliminary support for move semantics for endpoints 2015-02-06 07:51:24 -05:00
Peter Thorson
f9b08ccea1 Merge branch 'master' into permessage-deflate
Conflicts:
	websocketpp/extensions/permessage_deflate/enabled.hpp
2015-01-22 10:21:11 -05:00
Peter Thorson
31c761a0a9 Endpoints are now reset after listen failure. fixes #390 2015-01-22 08:20:13 -05:00
Peter Thorson
681c2331a1 Fixes out of scope pointer returned from websocketpp::exception::what(); fixes #397
Also adds unit tests for exception construction
2015-01-22 07:33:14 -05:00
Peter Thorson
3017a9c5e4 increase test timeouts 2015-01-20 07:55:42 -05:00