Commit Graph

13 Commits

Author SHA1 Message Date
Vadim Zeitlin
63f1260739 Skip wxWebRequest authentication tests when using NSURLSession
The NSURLSession-based backend is missing authentication support, so
these tests always fail there, skip them for now.
2020-12-30 14:41:17 +01:00
Vadim Zeitlin
50424cba2c Change wxWebRequest and related objects to hide ref counting
Don't force the application code to deal with wxObjectDataPtr<> or,
worse, calling {Inc,Dec}Ref() manually by hiding it inside the wx
objects themselves and giving the value-like semantics to them.

There should be no real changes in the behaviour, but the API does
change significantly. Notably, wxWebRequest is not a wxEvtHandler itself
any longer, as this would be incompatible with the value semantics, and
an event handler needs to be specified when creating it, so that it
could be notified about the request state changes.
2020-12-30 02:02:20 +01:00
Vadim Zeitlin
8b632bb892 Enable wxWebRequest tests by default
Don't require WX_TEST_WEBREQUEST_URL environment variable to be set, but
only allow defining it to override the default https://httpbin.org value
or to disable the tests by setting it to 0.
2020-12-26 16:43:03 +01:00
Vadim Zeitlin
6a064c85d4 Compile even less code when wxUSE_WEBREQUEST==0 in the test
Move the check slightly higher, there is no need to include the headers
if we're not going to compile any tests anyhow.
2020-12-26 16:00:03 +01:00
Vadim Zeitlin
b37c7417f6 Don't make wxWebRequest::SplitParameters() public
They're not necessary to use this class and we may consider exporting
them later, possibly with a better API and more tests, if really needed.

Also do change their API slightly by leaving only a single function and
returning the value instead of using an out parameter for it to make it
simpler to use.
2020-12-13 02:41:01 +01:00
Vadim Zeitlin
64a3801160 Tweaks to wxWebRequest::SetData() overload taking stream
Check that the stream is valid, if specified at all, and return false if
it isn't -- or if no size was specified and determining stream size
failed.

Check for SetData() success in the test to provide better diagnostics in
case the file it uses is not found (as is the case when running the test
from another directory, for example).

Also pass wxSharedPtr<> by const reference instead of by value to avoid
unnecessary copies.
2020-12-12 18:46:28 +01:00
Vadim Zeitlin
fcaccbf12c Avoid -Wswitch warnings in wxWebRequest test
No real changes, just suppress the warnings about not handling all
states in a switch.
2020-12-12 18:12:44 +01:00
Tobias Taschner
f40e2e64d9
Add wxWebRequest::SplitParameters method
This method is adapted for use in wxWidgets from the Poco library.
2018-12-10 19:37:55 +01:00
Tobias Taschner
c24efa9821
Implement additional storage targets 2018-12-10 19:37:42 +01:00
Tobias Taschner
d4362f4bca
Add wxWebResponse::AsString() test 2018-12-10 19:37:41 +01:00
Tobias Taschner
cf85c04d25
Add wxWebRequest progress methods 2018-12-10 19:37:38 +01:00
Tobias Taschner
4fd6091513
Implement WinHTTP authentication 2018-12-10 19:37:35 +01:00
Tobias Taschner
6db3f5f115
Add unit test for wxWebRequest
The environment variable WX_TEST_WEBREQUEST_URL has to
be set to https://httpbin.org or a local instance of it
to be run.
2018-12-10 19:37:31 +01:00