File tree Expand file tree Collapse file tree 3 files changed +34
-15
lines changed
tests/Functional/http/listener Expand file tree Collapse file tree 3 files changed +34
-15
lines changed Original file line number Diff line number Diff line change @@ -41,21 +41,21 @@ static void check_listener_uri(const http::uri &address)
41
41
// We only need to check certain things specific to HTTP.
42
42
43
43
#ifdef _MS_WINDOWS
44
- // HTTP Server API includes SSL support
45
- if (address.scheme () != U (" http" ) && address.scheme () != U (" https" ))
46
- {
47
- throw std::invalid_argument (" URI scheme must be 'http' or 'https'" );
48
- }
44
+ // HTTP Server API includes SSL support
45
+ if (address.scheme () != U (" http" ) && address.scheme () != U (" https" ))
46
+ {
47
+ throw std::invalid_argument (" URI scheme must be 'http' or 'https'" );
48
+ }
49
49
#else
50
- if (address.scheme () == U (" https" ))
51
- {
52
- throw std::invalid_argument (" Listeners using 'https' are not yet supported" );
53
- }
54
-
55
- if (address.scheme () != U (" http" ))
56
- {
57
- throw std::invalid_argument (" URI scheme must be 'http'" );
58
- }
50
+ if (address.scheme () == U (" https" ))
51
+ {
52
+ throw std::invalid_argument (" Listeners using 'https' are not yet supported" );
53
+ }
54
+
55
+ if (address.scheme () != U (" http" ))
56
+ {
57
+ throw std::invalid_argument (" URI scheme must be 'http'" );
58
+ }
59
59
#endif
60
60
61
61
if (address.host ().empty ())
Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ namespace tests { namespace functional { namespace http { namespace listener {
22
22
class uri_address
23
23
{
24
24
public:
25
- uri_address () : m_uri(U(" http://localhost:34567/" ))
25
+ uri_address () :
26
+ m_uri (U(" http://localhost:34567/" )),
27
+ m_secure_uri (U(" https://localhost:8443/" ))
26
28
{
27
29
if (!s_dummy_listener)
28
30
s_dummy_listener = std::make_shared<web::http::experimental::listener::http_listener>(U (" http://localhost:30000/" ));
@@ -33,6 +35,7 @@ class uri_address
33
35
34
36
static std::shared_ptr<web::http::experimental::listener::http_listener> s_dummy_listener;
35
37
web::http::uri m_uri;
38
+ web::http::uri m_secure_uri;
36
39
};
37
40
38
41
}}}}
Original file line number Diff line number Diff line change @@ -234,6 +234,22 @@ TEST_FIXTURE(uri_address, uri_encoding)
234
234
encoded_uri = uri::encode_uri (U (" /path 1/path 2?key1=val1 val2#fragment1" )); // URI has path, query and fragment components
235
235
client.request (methods::GET, encoded_uri).wait ();
236
236
}
237
+
238
+ TEST_FIXTURE (uri_address, https_listener)
239
+ {
240
+ http_listener listener (m_secure_uri);
241
+ listener.open ().wait ();
242
+ client::http_client client (m_secure_uri);
243
+
244
+ listener.support ([&](http_request request)
245
+ {
246
+ request.reply (status_codes::OK);
247
+ });
248
+
249
+ http_asserts::assert_response_equals (client.request (methods::GET, U (" " )).get (), status_codes::OK);
250
+
251
+ listener.close ().wait ();
252
+ }
237
253
}
238
254
239
255
}}}}
You can’t perform that action at this time.
0 commit comments