Skip to content

Commit f3d03e6

Browse files
committed
Moving request_compressed_response in http config out of win compile flag
1 parent 49ce8dc commit f3d03e6

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

Release/include/cpprest/http_client.h

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ class http_client_config
9494
http_client_config() :
9595
m_guarantee_order(false),
9696
m_timeout(std::chrono::seconds(30)),
97-
m_chunksize(0)
97+
m_chunksize(0),
98+
m_request_compressed(false)
9899
#if !defined(__cplusplus_winrt)
99100
, m_validate_certificates(true)
100101
#endif
@@ -105,8 +106,8 @@ class http_client_config
105106
#endif
106107
#if defined(_WIN32) && !defined(__cplusplus_winrt)
107108
, m_buffer_request(false)
108-
, m_request_compressed(false)
109109
#endif
110+
110111
{
111112
}
112113

@@ -260,6 +261,27 @@ class http_client_config
260261
return m_chunksize == 0;
261262
}
262263

264+
/// <summary>
265+
/// Checks if requesting a compressed response is turned on, the default is off.
266+
/// </summary>
267+
/// <returns>True if compressed response is enabled, false otherwise</returns>
268+
bool request_compressed_response() const
269+
{
270+
return m_request_compressed;
271+
}
272+
273+
/// <summary>
274+
/// Request that the server responds with a compressed body.
275+
/// If true, in cases where the server does not support compression, this will have no effect.
276+
/// The response body is internally decompressed before the consumer receives the data.
277+
/// </summary>
278+
/// <param name="buffer_request">True to turn on response body compression, false otherwise.</param>
279+
/// <remarks>Please note there is a performance cost due to copying the request data. Currently only supported on Windows.</remarks>
280+
void set_request_compressed_response(bool request_compressed)
281+
{
282+
m_request_compressed = request_compressed;
283+
}
284+
263285
#if !defined(__cplusplus_winrt)
264286
/// <summary>
265287
/// Gets the server certificate validation property.
@@ -303,27 +325,6 @@ class http_client_config
303325
{
304326
m_buffer_request = buffer_request;
305327
}
306-
307-
/// <summary>
308-
/// Checks if requesting a compressed response is turned on, the default is off.
309-
/// </summary>
310-
/// <returns>True if compressed response is enabled, false otherwise</returns>
311-
bool request_compressed_response() const
312-
{
313-
return m_request_compressed;
314-
}
315-
316-
/// <summary>
317-
/// Request that the server responds with a compressed body.
318-
/// If true, in cases where the server does not support compression, this will have no effect.
319-
/// The response body is internally decompressed before the consumer receives the data.
320-
/// </summary>
321-
/// <param name="buffer_request">True to turn on response body compression, false otherwise.</param>
322-
/// <remarks>Please note there is a performance cost due to copying the request data.</remarks>
323-
void set_request_compressed_response(bool request_compressed)
324-
{
325-
m_request_compressed = request_compressed;
326-
}
327328
#endif
328329
#endif
329330

@@ -404,6 +405,7 @@ class http_client_config
404405

405406
std::chrono::microseconds m_timeout;
406407
size_t m_chunksize;
408+
bool m_request_compressed;
407409

408410
#if !defined(__cplusplus_winrt)
409411
// IXmlHttpRequest2 doesn't allow configuration of certificate verification.
@@ -418,7 +420,6 @@ class http_client_config
418420
#endif
419421
#if defined(_WIN32) && !defined(__cplusplus_winrt)
420422
bool m_buffer_request;
421-
bool m_request_compressed;
422423
#endif
423424
};
424425

Release/tests/functional/http/client/outside_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ TEST_FIXTURE(uri_address, outside_google_dot_com_compressed_http_response)
7676
response.content_ready().wait();
7777

7878
auto s = response.extract_utf8string().get();
79+
VERIFY_IS_FALSE(s.empty());
7980

8081
std::wstring encoding;
8182
response.headers().match(web::http::header_names::content_encoding, encoding);

0 commit comments

Comments
 (0)