From 886f61cacbdb3b31511f38c6ecd2f8617a131c7c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 7 Mar 2007 23:07:16 +0000 Subject: [PATCH] fix base64 computation for strings whose length modulo 3 is 2 (patch 1665520; bug 1661616) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/common/http.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index b4a742c05b..1f756b419d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -63,6 +63,7 @@ All: - Added wxCONFIG_USE_SUBDIR flag to wxFileConfig (Giuseppe Bilotta). - Added wxSearchCtrl::[Get|Set]DescriptiveText. - Fixed detection of number of processors under Linux 2.6 +- Fixed Base64 computation in wxHTTP (p_michalczyk) wxMSW diff --git a/src/common/http.cpp b/src/common/http.cpp index af0512f967..f5f73ea461 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -139,7 +139,7 @@ wxString wxHTTP::GenerateAuthString(const wxString& user, const wxString& pass) if (len == 1) { buf << wxString::Format(wxT("%c="), base64[(from[0] << 4) & 0x30]); } else { - buf << wxString::Format(wxT("%c%c"), base64[(from[0] << 4) & 0x30] + ((from[1] >> 4) & 0xf), base64[(from[1] << 2) & 0x3c]); + buf << wxString::Format(wxT("%c%c"), base64[((from[0] << 4) & 0x30) | ((from[1] >> 4) & 0xf)], base64[(from[1] << 2) & 0x3c]); } buf << wxString::Format(wxT("=")); } -- 2.45.2