summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichał Cichoń <michcic@gmail.com>2017-05-18 18:28:05 +0200
committerMichał Cichoń <michcic@gmail.com>2017-05-18 18:28:05 +0200
commit091d717658fa765e4486c5644343a0aec4373a9c (patch)
tree21f4419d9dceae3226286585b8b5ca87ea1934ce /src
parentaa2d42f83607d7eae63cc7d860b919e60e1defd8 (diff)
parentcd5c65097ecf03480f477e47e0bb706dbf705a21 (diff)
downloadpianobar-windows-091d717658fa765e4486c5644343a0aec4373a9c.tar.gz
pianobar-windows-091d717658fa765e4486c5644343a0aec4373a9c.tar.bz2
pianobar-windows-091d717658fa765e4486c5644343a0aec4373a9c.zip
Merge tag '2017.05.18' into develop
2017.05.18 * Synchronize with upstream * Fixed: Handle escaped authority url components. pianobar-windows-binaries/#3
Diffstat (limited to 'src')
-rw-r--r--src/config.h2
-rw-r--r--src/http/http.c28
2 files changed, 29 insertions, 1 deletions
diff --git a/src/config.h b/src/config.h
index 8679001..42a0b11 100644
--- a/src/config.h
+++ b/src/config.h
@@ -3,7 +3,7 @@
/* package name */
#define PACKAGE "pianobar"
-#define VERSION "2015.12.10"
+#define VERSION "2017.05.18"
#define TITLE "Pianobar"
diff --git a/src/http/http.c b/src/http/http.c
index 609317f..4576d04 100644
--- a/src/http/http.c
+++ b/src/http/http.c
@@ -250,6 +250,32 @@ bool HttpSetAutoProxy (http_t http, const char* url) {
return false;
}
+static void HttpUrlDecodeInplace (wchar_t* url)
+{
+ wchar_t* input = url;
+ wchar_t* output = url;
+ size_t size = wcslen (url);
+ while (size > 0) {
+ if (input[0] == '%' && iswxdigit(input[1]) && iswxdigit(input[2])) {
+ wchar_t hex[3];
+ hex[0] = input[1];
+ hex[1] = input[2];
+ hex[2] = 0;
+ *output++ = (wchar_t)(wcstol (hex, NULL, 16));
+ input += 3;
+ size -= 3;
+ }
+ else {
+ *output++ = *input++;
+ --size;
+ }
+ }
+
+ if (output < input) {
+ *output = '\0';
+ }
+}
+
bool HttpSetProxy (http_t http, const char* url) {
URL_COMPONENTS urlComponents;
wchar_t* wideUrl = NULL;
@@ -267,10 +293,12 @@ bool HttpSetProxy (http_t http, const char* url) {
if (urlComponents.lpszUserName && urlComponents.dwUserNameLength > 0) {
wideUsername = wcsdup(urlComponents.lpszUserName);
wideUsername[urlComponents.dwUserNameLength] = 0;
+ HttpUrlDecodeInplace (wideUsername);
}
if (urlComponents.lpszPassword && urlComponents.dwPasswordLength > 0) {
widePassword = wcsdup(urlComponents.lpszPassword);
widePassword[urlComponents.dwPasswordLength] = 0;
+ HttpUrlDecodeInplace (widePassword);
}
}