Merge branch 'web-request'

Add wxWebViewRequest and related classes allowing to use HTTPS and
HTTP/2.

See https://github.com/wxWidgets/wxWidgets/pull/977
This commit is contained in:
Vadim Zeitlin
2021-01-17 18:19:47 +01:00
100 changed files with 29554 additions and 185 deletions

View File

@@ -660,14 +660,13 @@ set(NET_UNIX_SRC
set(NET_OSX_SRC
src/osx/core/sockosx.cpp
src/osx/webrequest_urlsession.mm
)
set(NET_WIN32_SRC
src/msw/sockmsw.cpp
src/msw/urlmsw.cpp
)
set(NET_WIN32_HDR
src/msw/webrequest_winhttp.cpp
)
set(NET_CMN_SRC
@@ -681,6 +680,8 @@ set(NET_CMN_SRC
src/common/sckstrm.cpp
src/common/socket.cpp
src/common/url.cpp
src/common/webrequest.cpp
src/common/webrequest_curl.cpp
)
set(NET_CMN_HDR
@@ -695,6 +696,7 @@ set(NET_CMN_HDR
wx/sckstrm.h
wx/socket.h
wx/url.h
wx/webrequest.h
)
set(QA_SRC
@@ -907,6 +909,7 @@ set(GUI_CMN_SRC
src/generic/wizard.cpp
src/generic/editlbox.cpp
src/generic/datavgen.cpp
src/generic/creddlgg.cpp
src/generic/rowheightcache.cpp
src/generic/animateg.cpp
)
@@ -1197,6 +1200,8 @@ set(GUI_CMN_HDR
wx/generic/splash.h
wx/generic/calctrlg.h
wx/generic/sashwin.h
wx/creddlg.h
wx/generic/creddlgg.h
wx/generic/animate.h
)

View File

@@ -308,6 +308,33 @@ if(wxUSE_LIBLZMA)
endif()
endif()
if (wxUSE_WEBREQUEST)
if(wxUSE_WEBREQUEST_CURL)
find_package(CURL)
if(NOT CURL_FOUND)
message(WARNING "CURL not found, wxWebSessionBackendCURL won't be available")
wx_option_force_value(wxUSE_WEBREQUEST_CURL OFF)
endif()
endif()
include(CheckCSourceCompiles)
if(wxUSE_WEBREQUEST_WINHTTP)
check_c_source_compiles("#include <windows.h>
#include <winhttp.h>
int main(){return 0;}"
HAVE_WINHTTP_H)
if(NOT HAVE_WINHTTP_H)
message(WARNING "winhttp.h not found, wxWebSessionBackendWinHTTP won't be available")
wx_option_force_value(wxUSE_WEBREQUEST_WINHTTP OFF)
endif()
endif()
if (NOT(wxUSE_WEBREQUEST_WINHTTP OR wxUSE_WEBREQUEST_URLSESSION OR wxUSE_WEBREQUEST_CURL))
message(WARNING "wxUSE_WEBREQUEST requires at least one backend, it won't be available")
wx_option_force_value(wxUSE_WEBREQUEST OFF)
endif()
endif()
if(UNIX)
if(wxUSE_SECRETSTORE AND NOT APPLE)
# The required APIs are always available under MSW and OS X but we must

View File

@@ -25,6 +25,15 @@ wx_add_library(wxnet IS_BASE ${NET_FILES})
if(WIN32)
wx_lib_link_libraries(wxnet PRIVATE ws2_32)
if(wxUSE_WEBREQUEST_WINHTTP)
wx_lib_link_libraries(wxnet PRIVATE Winhttp)
endif()
endif()
if (wxUSE_WEBREQUEST_CURL)
target_include_directories(wxnet PRIVATE ${CURL_INCLUDE_DIRS})
wx_lib_link_libraries(wxnet PRIVATE ${CURL_LIBRARIES})
endif()
wx_finalize_lib(wxnet)

View File

@@ -181,6 +181,22 @@ wx_option(wxUSE_TEXTBUFFER "use wxTextBuffer class")
wx_option(wxUSE_TEXTFILE "use wxTextFile class")
wx_option(wxUSE_TIMER "use wxTimer class")
wx_option(wxUSE_VARIANT "use wxVariant class")
# WebRequest options
wx_option(wxUSE_WEBREQUEST "use wxWebRequest class")
if(WIN32)
wx_option(wxUSE_WEBREQUEST_WINHTTP "use wxWebRequest WinHTTP backend")
endif()
if(APPLE)
wx_option(wxUSE_WEBREQUEST_URLSESSION "use wxWebRequest URLSession backend")
endif()
if(APPLE OR WIN32)
set(wxUSE_WEBREQUEST_CURL_DEFAULT OFF)
else()
set(wxUSE_WEBREQUEST_CURL_DEFAULT ON)
endif()
wx_option(wxUSE_WEBREQUEST_CURL "use wxWebRequest libcurl backend" ${wxUSE_WEBREQUEST_CURL_DEFAULT})
wx_option(wxUSE_ZIPSTREAM "use wxZip streams")
# URL-related classes
@@ -361,6 +377,7 @@ wx_option(wxUSE_COMMON_DIALOGS "use all common dialogs")
wx_option(wxUSE_ABOUTDLG "use wxAboutBox")
wx_option(wxUSE_CHOICEDLG "use wxChoiceDialog")
wx_option(wxUSE_COLOURDLG "use wxColourDialog")
wx_option(wxUSE_CREDENTIALDLG "use wxCredentialEntryDialog")
wx_option(wxUSE_FILEDLG "use wxFileDialog")
wx_option(wxUSE_FINDREPLDLG "use wxFindReplaceDialog")
wx_option(wxUSE_FONTDLG "use wxFontDialog")

View File

@@ -59,6 +59,11 @@ if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
if(POLICY CMP0060)
# Link libraries by full path even in implicit directories.
cmake_policy(SET CMP0060 NEW)
endif()
if(POLICY CMP0067)
# Honor language standard in try_compile() source-file signature.
cmake_policy(SET CMP0067 NEW)

View File

@@ -157,6 +157,7 @@ wx_add_sample(webview LIBRARIES wxwebview DATA ../help/doc.zip:doc.zip
if(TARGET webviewsample AND wxUSE_STC)
wx_exe_link_libraries(webviewsample wxstc)
endif()
wx_add_sample(webrequest LIBRARIES wxnet DEPENDS wxUSE_WEBREQUEST)
# widgets Sample
set(SAMPLE_WIDGETS_SRC
activityindicator.cpp

View File

@@ -294,6 +294,16 @@
#cmakedefine01 wxUSE_MIMETYPE
#cmakedefine01 wxUSE_WEBREQUEST
#ifdef __APPLE__
#define wxUSE_WEBREQUEST_URLSESSION wxUSE_WEBREQUEST
#else
#cmakedefine01 wxUSE_WEBREQUEST_URLSESSION
#endif
#cmakedefine01 wxUSE_WEBREQUEST_CURL
#cmakedefine01 wxUSE_PROTOCOL
#cmakedefine01 wxUSE_PROTOCOL_FILE
@@ -523,6 +533,8 @@
#cmakedefine01 wxUSE_NUMBERDLG
#cmakedefine01 wxUSE_CREDENTIALDLG
#cmakedefine01 wxUSE_SPLASH
#cmakedefine01 wxUSE_WIZARDDLG
@@ -679,6 +691,12 @@
#cmakedefine01 wxUSE_GRAPHICS_DIRECT2D
#endif
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
#cmakedefine01 wxUSE_WEBREQUEST_WINHTTP
#else
#cmakedefine01 wxUSE_WEBREQUEST_WINHTTP
#endif
#cmakedefine01 wxUSE_OLE

View File

@@ -52,6 +52,7 @@ set(TEST_SRC
misc/typeinfotest.cpp
net/ipc.cpp
net/socket.cpp
net/webrequest.cpp
regex/regextest.cpp
regex/wxregextest.cpp
scopeguard/scopeguardtest.cpp