diff --git a/include/wx/private/webrequest.h b/include/wx/private/webrequest.h index 2b44af1fe0..3f3bca6158 100644 --- a/include/wx/private/webrequest.h +++ b/include/wx/private/webrequest.h @@ -205,7 +205,7 @@ public: virtual wxVersionInfo GetLibraryVersionInfo() = 0; - void SetHeader(const wxString& name, const wxString& value) + void AddCommonHeader(const wxString& name, const wxString& value) { m_headers[name] = value; } void SetTempDir(const wxString& dir) { m_tempDir = dir; } diff --git a/include/wx/webrequest.h b/include/wx/webrequest.h index 73ab9641d7..75eb170d7a 100644 --- a/include/wx/webrequest.h +++ b/include/wx/webrequest.h @@ -220,7 +220,7 @@ public: wxVersionInfo GetLibraryVersionInfo(); - void SetHeader(const wxString& name, const wxString& value); + void AddCommonHeader(const wxString& name, const wxString& value); void SetTempDir(const wxString& dir); wxString GetTempDir() const; diff --git a/interface/wx/webrequest.h b/interface/wx/webrequest.h index 29559b89f6..25e1a3f0fa 100644 --- a/interface/wx/webrequest.h +++ b/interface/wx/webrequest.h @@ -581,10 +581,13 @@ public: A good example for a session-wide request header is the @c User-Agent header. + Calling this function with the same header name again replaces the + previously used value. + @param name Name of the header @param value String value of the header */ - void SetHeader(const wxString& name, const wxString& value); + void AddCommonHeader(const wxString& name, const wxString& value); /** Override the default temporary directory that may be used by the diff --git a/src/common/webrequest.cpp b/src/common/webrequest.cpp index 12d78039bf..eb3ce57102 100644 --- a/src/common/webrequest.cpp +++ b/src/common/webrequest.cpp @@ -773,7 +773,7 @@ wxStringWebSessionFactoryMap gs_factoryMap; wxWebSessionImpl::wxWebSessionImpl() { // Initialize the user-Agent header with a reasonable default - SetHeader("User-Agent", wxString::Format("%s/1 wxWidgets/%d.%d.%d", + AddCommonHeader("User-Agent", wxString::Format("%s/1 wxWidgets/%d.%d.%d", wxTheApp->GetAppName(), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER)); } @@ -889,11 +889,11 @@ wxVersionInfo wxWebSession::GetLibraryVersionInfo() return m_impl->GetLibraryVersionInfo(); } -void wxWebSession::SetHeader(const wxString& name, const wxString& value) +void wxWebSession::AddCommonHeader(const wxString& name, const wxString& value) { wxCHECK_IMPL_VOID(); - m_impl->SetHeader(name, value); + m_impl->AddCommonHeader(name, value); } void wxWebSession::SetTempDir(const wxString& dir)