Commit Graph

70115 Commits

Author SHA1 Message Date
Vadim Zeitlin
3f783b15f0 Add another explicit conversion from wxString to "const wchar_t*"
Fix build in wxUSE_STL=1 configuration.
2021-01-12 14:52:14 +01:00
Stefan Csomor
fd5df49920 guard method against nullptr crash
Occuring the window is not instantiated (eg native message dialog), fixes #19038
2021-01-12 08:08:19 +01:00
Vadim Zeitlin
20a3317839 Rename wxWebRequestEvent::GetResponseFileName() to GetDataFile()
This is shorter and doesn't imply that just the name (and not the full
path) is being returned.

Also rename wxWebResponse::GetFileName() to GetDataFile() for the same
reasons and for consistency. And document this previously undocumented
method.
2021-01-12 03:34:40 +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
3da03b3b7b Clarify values returned by wxWebRequest progress methods
Make it clear which values change and which remain constant.
2021-01-12 03:14:18 +01:00
Vadim Zeitlin
a1e0b7e292 Slightly simplify code removing temporary file
There is no need to check the state and storage type again when we had
just done it.
2021-01-12 03:09:56 +01:00
Vadim Zeitlin
67ad831a31 Improve documentation of wxWebRequest storage methods
Indicate which methods should be used with each storage type to process
the data later.
2021-01-12 03:09:51 +01:00
Vadim Zeitlin
591d02c979 Increase default buffer size for wxWebRequest operations
Use 64KiB rather than 8KiB, as the latter seems rather small nowadays.

Also add a symbolic constant for this number.
2021-01-12 03:00:35 +01:00
Vadim Zeitlin
6c1e1164d9 Remove unnecessary cast to "void*"
No real changes.
2021-01-12 02:57:30 +01:00
Vadim Zeitlin
646d8014ec Check if specified HTTP method is incompatible with posting data
Currently data can be used with POST or PUT HTTP methods only.
2021-01-12 02:54:13 +01:00
Vadim Zeitlin
7af2f29602 Use more readable CmpNoCase() in wxWebRequestCURL code
No real changes, just make case-insensitive comparisons more clear.
2021-01-12 02:52:28 +01:00
Vadim Zeitlin
9a8981241e Check return value of curl_easy_init()
Normally it is not supposed to fail, but still try not to crash if it
does.
2021-01-12 02:49:51 +01:00
Vadim Zeitlin
468a961426 Rename methods called from libcurl to use more clear names
Indicate that they're callbacks used by libcurl rather than normal
methods used by the application code itself.

No real changes.
2021-01-12 02:40:38 +01:00
Vadim Zeitlin
228d231753 Avoid copying POST data in NSURLSession wxWebRequest code
Just give the ownership of the buffer to NSData instead of copying it.
2021-01-12 02:34:18 +01:00
Vadim Zeitlin
5713d17ab0 Clarify asynchronous nature of wxWebRequest::Cancel() in the docs 2021-01-12 02:30:33 +01:00
Vadim Zeitlin
dceb24ad7c Add support for WXWEBREQUEST_BACKEND environment variable
Defining this variable overrides the default backend choice.

Document the variable itself and also extend wxWebSession::New()
documentation.
2021-01-12 02:17:39 +01:00
Vadim Zeitlin
d3b93a48b3 Remove wxWebSessionBackendDefault and just use empty string
There doesn't seem to be any reason to have this constant, so don't
define it and just interpret empty value of backend as meaning to choose
the default one in wxWebSession::New().
2021-01-12 02:17:31 +01:00
Robin Dunn
0df1d81acd Add missing wxDF_PNG to the interface docs 2021-01-11 12:27:30 -08:00
Vadim Zeitlin
3b87af5738 Fix the build when implicit wxString conversions are disabled
This corrects a bug introduced in 5d256988be (Add wxMSWFormatMessage()
and use it from other places, 2021-01-09).
2021-01-11 14:18:42 +01:00
Vadim Zeitlin
000856a342 Make wxWebCredentials available even when wxUSE_WEBREQUEST==0
This fixed build with wxUSE_CREDENTIALDLG==1 but wxUSE_WEBREQUEST==0.

No real changes, this commit just moves the code around.
2021-01-11 03:16:21 +01:00
Vadim Zeitlin
4986850c63 Rename wxWebSession::SetHeader() to AddCommonHeader()
The old name wasn't very clear and it was confusing to have methods with
the same name in wxWebSession and wxWebRequest.
2021-01-11 03:02:25 +01:00
Catalin Raceanu
76167e271b Insert comma for clarity in a message in the sample
No real changes.
2021-01-11 02:57:15 +01:00
Vadim Zeitlin
e530016723 Remove unnecessary trailing backslashes from the sample
Multiline strings don't need backslashes for continuation.
2021-01-11 02:55:51 +01:00
Vadim Zeitlin
054892f250 Fix wording of wxWebRequestEvent::GetResponseFileName() docs
Also document that the returned string is the full path and not just the
name of the file.
2021-01-11 02:54:48 +01:00
Vadim Zeitlin
451b97170b Small tweak to wxCredentialEntryDialog docs consistency
Don't use the article for just one parameter.
2021-01-11 02:51:05 +01:00
Vadim Zeitlin
c750661c40 Use explicit encodings in wxWebRequestCURL
At least in one place the code is still wrong when sending data as HTTP
headers can contain only ASCII characters, but at least do our best to
interpret the data we receive correctly.
2021-01-11 02:42:09 +01:00
Vadim Zeitlin
df13c2bd26 Properly percent-encode URLs passed to libcurl
URLs can't contain non-ASCII characters, so use wxURI to encode them
properly.
2021-01-11 02:31:51 +01:00
Vadim Zeitlin
252373e540 Allow a simple way to rest requesting the given URL in the test
This does nothing more than just running a GET request for the given
URL for testing purposes.
2021-01-11 02:30:43 +01:00
Vadim Zeitlin
9149a3725d Assert that we have correct user data in libcurl callbacks
Don't just silently ignore invalid user data value, this is not supposed
to happen.

Also use "userdata" name for the same parameter of all callbacks
consistently.
2021-01-11 02:22:38 +01:00
Vadim Zeitlin
397940f5cf Set shut down flag after acquiring the mutex, not before
As this flag is tested in the worker thread only when it owns the mutex,
set it only after acquiring the mutex too to avoid any possibility of a
data race.
2021-01-11 01:27:38 +01:00
Vadim Zeitlin
0f82a1e043 Use atomic int for reference count in wxWebRequest classes
This is required because these classes are copied in both the main and
the worker threads and using plain int is MT-unsafe.
2021-01-11 01:24:55 +01:00
Vadim Zeitlin
de93f8be5b Fix race condition when setting the request state to active
Call SetState(State_Active) before signalling the worker thread, as
otherwise it would be possible for it to wake up and set its state to
something else before it was reset to "active" from the main thread.

This fixed another TSAN error.
2021-01-11 01:15:28 +01:00
Vadim Zeitlin
fd1d396406 Use wxCondition::Signal() rather than Broadcast()
The latter is unnecessary when there is only one thread to wake up.
2021-01-11 01:12:06 +01:00
Vadim Zeitlin
1d52f1cbb5 Add a comment explaining mutex use in wxWebSessionCURL
No real changes.
2021-01-11 01:11:44 +01:00
Vadim Zeitlin
0588b0e7ce Extract all the wxWebRequest test sections in separate tests
As in 31a441e814 (Use separate test cases for wxWebRequest auth tests,
2021-01-10), there is no real reason to use sections here as we don't
reuse anything between them and using separate tests makes it easier to
run individual tests and, especially, combinations of them.

This commit is best viewed ignoring whitespace-only changes.
2021-01-10 21:27:51 +01:00
Vadim Zeitlin
29a36ef4ff Unlock wxWebSessionCURL mutex before destroying it
Mutexes must not be destroyed while locked and thread sanitizer
correctly complains about this, so ensure that we do unlock the mutex
before the worked thread terminates and the object is destroyed.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
d88762d2f1 Collect mutex and data protected by it in a single struct
Also use critical section instead of a mutex, as this is more efficient
under MSW.

Main purpose of this commit is to make it clear that this mutex/critical
section is only used together with the data from the same struct.

No real changes.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
7d1a7ef942 Respect --disabled-sys-libs when checking for libcurl
Don't use system libcurl if --disabled-sys-libs was used, but warn about
it as this could be unexpected.

We could consider including libcurl as submodule, and use the built-in
version as a fallback, but it's a relatively big repository (100MiB+),
so it's not clear if it would be a good idea to do it.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
abcc31c6b2 Update wxCredentialEntryDialog to use wxWebCredentials
As a side effect, make wxWebCredentials default-constructible.

Also demonstrate using wxCredentialEntryDialog in the sample.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
31a441e814 Use separate test cases for wxWebRequest auth tests
This allows to easily run both auth tests at once without all the other
tests and it's not like we reuse much (or actually anything) by having
them as sections in the same test case anyhow.

This commit is best viewed ignoring whitespace-only changes.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
1e6d6be8bb Add wxWebCredentials and use it in SetCredentials()
Prefer using a class encapsulating both the user name and the password
to using a pair of variables.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
8eab460c0d Sort DEFAULT_wxUSE_XXX in alphabetical order in configure
Just sort the features in the same section in alphabetical order to make
it easier to find the given feature in the list (or confirm that it is
not present).

No real changes.
2021-01-10 19:55:37 +01:00
Vadim Zeitlin
3b214608b8 Merge branch 'wxRibbon-coord-functions'
Fix wxRibbonToolBar coordinate functions for non-first group: they only
worked correctly for the first group before.

See https://github.com/wxWidgets/wxWidgets/pull/2152

Closes https://github.com/wxWidgets/wxWidgets/pull/2163
2021-01-10 19:28:18 +01:00
Vadim Zeitlin
5c1a27488f Express tool position rectangle position consistently
Use tool position as offset from group position and not vice versa, both
because this was already done like this in the other places and because
this makes more sense: the tool is inside the group, so its position is
relative to it.

No real changes.
2021-01-10 19:26:33 +01:00
Vadim Zeitlin
aed13bb9a9 Remove unnecessary temporary variable in wxRibbonToolBar
Just return the wxRect directly.

No real changes.
2021-01-10 19:25:53 +01:00
Gary Allen
ca4acfdffa Fix wxRibbon tooltips: show them only once and not over dropdown
Don't update wxRibbonToolBar and wxRibbonButtonBar tooltips each time
the mouse was moved, this was inconsistent with the standard tooltips
behaviour and resulted in flicker.

Also don't show tooltips at all over a dropdown, as they partially
covered and, again, such behaviour is very non-standard.

Closes https://github.com/wxWidgets/wxWidgets/pull/2162
2021-01-10 19:20:16 +01:00
Gary Allen
027c1b8304 Update wxRibbonToolBar docs 2021-01-10 20:18:42 +02:00
Vadim Zeitlin
b980e2e859 Fix warnings about possibly unused variable in TGA code
Just a minor fix after the changes of 0c939ae727 (Implement reading 16
and 32-bit color-mapped TGA images, 2020-12-11).

No real changes.
2021-01-10 19:03:19 +01:00
Gary Allen
0ee16339ae Fix wxRibbonToolbar Coord Functions 2021-01-10 18:34:58 +02:00
Vadim Zeitlin
fe197d7527 Add small wxSecretString helper for wiping strings values
This is simpler and more robust than remembering to call WipeString()
manually.
2021-01-10 01:21:45 +01:00