Skip to content
Commits on Source (2)
This is a draft until reviewed.
This packaging is a draft initiated as a dependency of opencpn [1]. After
a deeper look into the situation it has been decided to use the bundled
code in opencpn instead of this package.
The main problem is that the bundled code has revised the API to fix a
windows build problem. This change is the last patch in the debian patch
series. The rest of the patches are bugfixes and expanded API.
From a Debian perspective here are also problems with an abandoned upstream
and a bakefiles [2] dependency which isn't packaged.
The debian patch series has split the original patch when importing wxcurl
into opencpn into several smaller steps.
[1] https://opencpn.org
[2] https://bakefile.org/
wxcurl for Debian -- rebuilding and downloading tarball
-------------------------------------------------------
This is an abandoned attempt to package wxcurl - see d/DRAFT.
The original sources are based on the bakefiles build system which is
not available in Debian. Because of this just the end result in the
form of configure, config.guess etc. has been updated. On a system
......
From: Alec Leamas <leamas.alec@nowhere.net>
Date: Mon, 10 Sep 2018 16:28:48 -0400
From: David Register <bdbcat@users.sourceforge.net>
Date: Sun, 20 Sep 2015 22:42:56 -0400
Subject: Correct an occasional ASSERT for invalid wxTimeSpan
---
......
From: Alec Leamas <leamas@nowhere.net>
Date: Tue, 21 Aug 2018 17:44:33 -0400
From: did-g <did-g@users.noreply.github.com>
Date: Tue, 24 Nov 2015 05:36:06 +0100
Subject: delete m_pCurl in wxCurlBaseThread DTOR not in OnExit
The thread method can be called before all events are processed.
......
From: Pavel Kalian <pavel@kalian.cz>
Date: Sat, 8 Aug 2015 10:30:59 -0500
Subject: base: Add SetAbort()/GetAbort() handling hung transfers.
---
include/wx/curl/base.h | 4 ++++
src/base.cpp | 17 +++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/include/wx/curl/base.h b/include/wx/curl/base.h
index 1c0120c..f6f5a37 100644
--- a/include/wx/curl/base.h
+++ b/include/wx/curl/base.h
@@ -404,6 +404,8 @@ public:
bool SetEvtHandler(wxEvtHandler* pParent, int id = wxID_ANY);
wxEvtHandler* GetEvtHandler() const;
int GetId() const;
+ void SetAbort(bool a);
+ bool GetAbort() const;
//! Sets the "event policy" of wxCURL: if you pass zero, then no events will ever be sent.
//! The wxCURL_SEND_PROGRESS_EVENTS and wxCURL_SEND_BEGINEND_EVENTS flags instead tell
@@ -545,6 +547,8 @@ protected:
CURL* m_pCURL;
+ // Flag for terminating a possibly hung transfer
+ bool m_bAbortHungTransfer;
// libCURL <-> wxString conversions helpers (see below)
#define wxCURL_BUF2STRING(x) wxString((const char*)(x), wxConvLibc)
diff --git a/src/base.cpp b/src/base.cpp
index e86f85b..f0e3011 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -44,6 +44,7 @@ extern "C"
double rUlTotal, double rUlNow)
{
wxCurlBase *curl = wx_static_cast(wxCurlBase*, ptr);
+ int res = 0;
if(curl)
{
if (rUlTotal == 0 || rUlNow == 0)
@@ -59,9 +60,10 @@ extern "C"
wxCurlDownloadEvent evt(curl->GetId(), curl, rUlTotal, rUlNow, curl->GetURL());
wxPostEvent(curl->GetEvtHandler(), evt);
}
+ if ( curl->GetAbort() )
+ res = 1; // This will cause curl_easy_perform() to return CURLE_WRITE_ERROR immediately
}
-
- return 0;
+ return res;
}
int wxcurl_verbose_stream_write(CURL * crlptr, curl_infotype info,
@@ -398,6 +400,7 @@ wxCurlBase::wxCurlBase(const wxString& szURL /*= wxEmptyString*/,
int id /*= wxID_ANY*/,
long flags /*=wxCURL_DEFAULT_FLAGS*/)
: m_szBaseURL(wxCURL_STRING2BUF(szURL)),
+m_bAbortHungTransfer(false),
m_szCurrFullURL(wxCURL_STRING2BUF(szURL)),
m_szUsername(wxCURL_STRING2BUF(szUserName)),
m_szPassword(wxCURL_STRING2BUF(szPassword)),
@@ -698,6 +701,16 @@ void wxCurlBase::SetProxyHost(const wxString& szProxyHost)
m_szProxyHost = wxCURL_STRING2BUF(szProxyHost);
}
+void wxCurlBase::SetAbort(bool a)
+{
+ m_bAbortHungTransfer = a;
+}
+
+bool wxCurlBase::GetAbort() const
+{
+ return m_bAbortHungTransfer;
+}
+
wxString wxCurlBase::GetProxyHost() const
{
return wxCURL_BUF2STRING(m_szProxyHost);
From: Pavel Kalian <pavel@kalian.cz>
Date: Sat, 8 Aug 2015 10:30:59 -0500
Subject: base: Add dummy GetNAText().
---
include/wx/curl/base.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/wx/curl/base.h b/include/wx/curl/base.h
index f6f5a37..38db554 100644
--- a/include/wx/curl/base.h
+++ b/include/wx/curl/base.h
@@ -130,6 +130,14 @@ protected:
// we cannot use wxDateTime::Now() there because once the event is constructed,
// GetElapsedTime() needs to return always the same value!
wxDateTime m_dt;
+
+public:
+ static std::string GetNAText()
+ {
+ wxString s = _("Not available");
+ return std::string(s.mb_str());
+ }
+
};
From: Pavel Kalian <pavel@kalian.cz>
Date: Sat, 8 Aug 2015 10:30:59 -0500
Subject: wxcurl: Don't take length on null pointers.
---
src/base.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/base.cpp b/src/base.cpp
index f0e3011..0049fef 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -160,10 +160,11 @@ extern "C"
size_t iRetVal = 0;
wxCharBuffer* pStr = (wxCharBuffer*) pcharbuf;
- size_t len = strlen(*pStr);
+ size_t len = 0;
if(pStr)
{
+ len = strlen(*pStr);
if(len >= iRealSize)
{
strncpy((char*)ptr, (const char*)(*pStr), iRealSize);
From: Pavel Kalian <pavel@kalian.cz>
Date: Sat, 8 Aug 2015 10:30:59 -0500
Subject: Add missing va_end().
---
src/base.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/base.cpp b/src/base.cpp
index 0049fef..1863b8f 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -498,8 +498,8 @@ bool wxCurlBase::GetInfo(int info, ...) const
CURLcode res = CURLE_OK;
CURLINFO cInfo = (CURLINFO)info;
res = curl_easy_getinfo(m_pCURL, cInfo, pParam);
-
DumpErrorIfNeed(res);
+ va_end(arg);
return (res == CURLE_OK);
}
From: Pavel Kalian <pavel@kalian.cz>
Date: Sat, 8 Aug 2015 10:30:59 -0500
Subject: base: Fix constructor initializers.
---
src/base.cpp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/base.cpp b/src/base.cpp
index 1863b8f..443f6ae 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -269,7 +269,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxCurlDownloadEvent, wxEvent);
wxCurlDownloadEvent::wxCurlDownloadEvent()
: wxCurlProgressBaseEvent(-1, wxCURL_DOWNLOAD_EVENT),
-m_rDownloadNow(0.0), m_rDownloadTotal(0.0)
+ m_rDownloadTotal(0.0), m_rDownloadNow(0.0)
{
}
@@ -304,7 +304,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxCurlUploadEvent, wxEvent);
wxCurlUploadEvent::wxCurlUploadEvent()
: wxCurlProgressBaseEvent(-1, wxCURL_UPLOAD_EVENT),
-m_rUploadNow(0.0), m_rUploadTotal(0.0)
+ m_rUploadTotal(0.0), m_rUploadNow(0.0)
{
}
@@ -400,17 +400,20 @@ wxCurlBase::wxCurlBase(const wxString& szURL /*= wxEmptyString*/,
wxEvtHandler* pEvtHandler /*= NULL*/,
int id /*= wxID_ANY*/,
long flags /*=wxCURL_DEFAULT_FLAGS*/)
-: m_szBaseURL(wxCURL_STRING2BUF(szURL)),
+ : m_pCURL(NULL),
m_bAbortHungTransfer(false),
m_szCurrFullURL(wxCURL_STRING2BUF(szURL)),
m_szUsername(wxCURL_STRING2BUF(szUserName)),
m_szPassword(wxCURL_STRING2BUF(szPassword)),
-m_iHostPort(-1), m_iResponseCode(-1),
-m_bUseProxy(false), m_iProxyPort(-1),
-m_pCURL(NULL), m_pHeaders(NULL),
-m_pEvtHandler(pEvtHandler), m_nId(id),
-m_nFlags(flags),
-m_bVerbose(false)
+m_iHostPort(-1),
+m_iResponseCode(-1),
+m_pHeaders(NULL),
+m_bUseProxy(false),
+m_iProxyPort(-1),
+m_bVerbose(false),
+m_pEvtHandler(pEvtHandler),
+m_nId(id),
+m_nFlags(flags)
{
m_szDetailedErrorBuffer[0] = '\0';
m_progressCallback = wxcurl_evt_progress_func;
From: Pavel Kalian <pavel@kalian.cz>
Date: Sat, 8 Aug 2015 10:30:59 -0500
Subject: base: Update standard curl-options.
---
src/base.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/base.cpp b/src/base.cpp
index 443f6ae..1f78775 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -806,6 +806,16 @@ void wxCurlBase::SetCurlHandleToDefaults(const wxString& relativeURL)
SetOpt(CURLOPT_HEADERFUNCTION, wxcurl_header_func);
SetOpt(CURLOPT_WRITEHEADER, &m_szResponseHeader);
SetOpt(CURLOPT_ERRORBUFFER, m_szDetailedErrorBuffer);
+ SetOpt(CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0\r\n" \
+ "Accept: application/xml,text/html,application/xhtml+xml;q=0.9,*/*;q=0.8\r\n" \
+ "Connection: keep-alive"); //Pretend we are a normal browser
+ SetOpt(CURLOPT_FOLLOWLOCATION, 1L);
+#ifdef __WXMSW__
+ SetOpt(CURLOPT_CAINFO, "curl-ca-bundle.crt"); //Use our local certificate list on Windows
+ SetOpt(CURLOPT_SSL_VERIFYPEER, true); // FIXME: Temporary until we get certificates working
+#endif
+ SetOpt(CURLOPT_ENCODING, "gzip,deflate"); //Save bandwidth by using compression
+
if(m_pEvtHandler && (m_nFlags & wxCURL_SEND_PROGRESS_EVENTS))
{
......@@ -8,6 +8,12 @@
0008-Correct-numerous-wx-alignment-traps.patch
0009-curl-base-relative-URL-was-unusable.patch
0010-base-Fix-undefined-behaviour-in-va_start.patch
0011-base-use-wxstring-return-values-instead-of-std-strin.patch
0012-Threads-corner-cases.patch
0013-Makefile.in-Add-target-writing-library-l-definition.patch
0011-Threads-corner-cases.patch
0012-Makefile.in-Add-target-writing-library-l-definition.patch
0013-base-Add-SetAbort-GetAbort-handling-hung-transfers.patch
0014-base-Add-dummy-GetNAText.patch
0015-wxcurl-Don-t-take-length-on-null-pointers.patch
0016-Add-missing-va_end.patch
0017-base-Fix-constructor-initializers.patch
0018-base-Update-standard-curl-options.patch
0019-base-Use-std-string-instead-of-wxstring.patch