Commit Graph

26 Commits

Author SHA1 Message Date
Vadim Zeitlin
ea71cf3984 Include wx/hashmap.h from wx/webrequest.h explicitly
This header was already implicitly included, but make it explicit.

No real changes.
2020-12-13 02:28:25 +01:00
Vadim Zeitlin
fc633f5aae Move wxStringWebSessionFactoryMap out of the header
Define wxWebSession::ms_defaultSession and ms_factoryMap in the
implementation file to avoid having to make the otherwise unnecessary
wxStringWebSessionFactoryMap type public.

No real changes.
2020-12-13 02:24:43 +01:00
Vadim Zeitlin
8ea4f38689 Make wxWebResponse::Init() and Finalize() non-public
The former can be called from the derived class ctors while the latter
only needs to be called from wxWebRequest itself, so just make it a
friend: this is not ideal, but still better than leaving this public and
simpler than any alternatives.
2020-12-13 01:33:01 +01:00
Vadim Zeitlin
1c61fe6baf Remove wxWebResponse::AsString() conversion parameter
It doesn't make much sense to specify the conversion here, it would
ideally be taken from the response Content-Type header itself and
currently is just assumed to be UTF-8 anyhow.

Also implement fallback to Latin-1 to avoid losing the data entirely if
it's not in UTF-8.
2020-12-13 01:16:41 +01:00
Vadim Zeitlin
204645a47c Initialize all fields in wxWebRequestEvent default ctor
Default ctor was leaving pointers uninitialized which was dangerous, so
merge it with the other ctor to ensure that we always set them to NULL.

Also make m_response const as it can't be changed after creating the
event.
2020-12-13 00:48:23 +01:00
Vadim Zeitlin
0c9f4ababa Document wxWebResponse pointers as being non-owning
wxWebResponse objects belong to wxWebRequest itself.
2020-12-13 00:47:53 +01:00
Vadim Zeitlin
727b590814 Pass wxSharedPtr argument of RegisterFactory() by const reference
Avoid extra copies from passing it by value.
2020-12-13 00:19:03 +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
Tobias Taschner
45f006d752 Add wxWebSession::GetLibraryVersionInfo() 2018-12-10 19:38:12 +01:00
Tobias Taschner
7577c95aab Destroy default wxWebSession in module 2018-12-10 19:38:05 +01:00
Tobias Taschner
f04094e4ec Implement GetBytesReceived() in base class 2018-12-10 19:38:04 +01:00
Tobias Taschner
ab544da1d2 Move GetBytesExpectedToReceive() impl to base class 2018-12-10 19:38:03 +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
e6b33cb76c Various small interface changes 2018-12-10 19:37:53 +01:00
Tobias Taschner
56af6cbdee Implement Cancel for WinHTTP backend 2018-12-10 19:37:50 +01:00
Tobias Taschner
c24efa9821 Implement additional storage targets 2018-12-10 19:37:42 +01:00
Tobias Taschner
6530e3c08e Move response data handling to base class 2018-12-10 19:37:40 +01:00
Tobias Taschner
5660565081 Prepare wxWebRequest::SetStorage() implementation 2018-12-10 19:37:39 +01:00
Tobias Taschner
cf85c04d25 Add wxWebRequest progress methods 2018-12-10 19:37:38 +01:00
Tobias Taschner
871049f1a1 Implement wxWebResponse::GetMimeType() and GetSuggestedFileName() 2018-12-10 19:37:37 +01:00
Tobias Taschner
03e9b1b549 Remove progress events 2018-12-10 19:37:35 +01:00
Tobias Taschner
4fd6091513 Implement WinHTTP authentication 2018-12-10 19:37:35 +01:00
Tobias Taschner
701f697fa4 Change wxWebRequest API to use STATE event 2018-12-10 19:37:30 +01:00
Tobias Taschner
d7dee7019e Implement sending request data with wxWebRequest 2018-12-10 19:37:25 +01:00
Tobias Taschner
a4279752f8 Start wxWebRequestWinHTTP implementation
Can already run the GET request in the sample app
2018-12-10 19:37:23 +01:00
Tobias Taschner
e07c1bf40c Prepared wxWebRequest implementation 2018-12-10 19:37:21 +01:00