Commit Graph

7 Commits

Author SHA1 Message Date
Vadim Zeitlin
508a4f6ca8 Fix Cancel() semantics under MSW and other improvements to it
Under MSW, don't set the state to State_Cancelled as soon as Cancel()
was called, as the request was still used from the other threads
afterwards, resulting in race conditions and crashes.

Fix this by just removing the SetState(State_Cancelled) call from the
main thread, as it was redundant anyhow. This also makes the behaviour
correspond to the documentation, which indicates that Cancel() works
asynchronously.

Also ensure, for all backends, that we actually cancel the request only
once, even if public Cancel() is called multiple times. This required
renaming the existing wxWebRequestImpl::Cancel() to DoCancel().
2021-01-16 13:50:29 +01:00
Vadim Zeitlin
65aad890e3 Add GetNativeHandle() to wxWebSession and wxWebRequest
This allows to retrieve the handles used internally in order to do
something not supported by the public API yet.
2021-01-16 00:21:00 +01:00
Vadim Zeitlin
70e7861a7d Implement authentication support for wxWebRequest under Mac
Add wxWebAuthChallengeURLSession and use the appropriate delegate
callback to create it.
2021-01-15 00:46:45 +01:00
Vadim Zeitlin
d0f56b1d04 Document wxWebResponse::GetContentLength()
Also change its return type from wxInt64 to wxFileOffset for consistency
with all the other length/progress-related functions in wxWebRequest.
2021-01-12 03:25:16 +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
71d5729171 Make wxWebSessionFactory private
Having wxWebSessionFactory part of the public API implies keeping
compatibility with the possible ways of implementing it which is too
restrictive for no good reason, so move this class to the private header
and don't document it nor wxWebSession::RegisterFactory() (which is now
private).
2020-12-27 01:03:08 +01:00
Vadim Zeitlin
e5bd5a926c Move backend-specific wxWebRequest headers to private subdirs
There is no need to make these headers public and keeping them private
will allow making backwards-incompatible changes to them in the future.
2020-12-26 17:00:07 +01:00