From bdccc0e5d10bb18db66b3a85a4aa994ebb5d9efb Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 4 Aug 2008 19:17:50 +0000 Subject: [PATCH] Fixed URLs with +'s not downloading from CDN. M cfnetwork.diff git-svn-id: http://svn.telesphoreo.org/trunk@414 514c082c-b64e-11dc-b46d-3d985efe055d --- methods/http.cc | 8 ++++++++ methods/http.cc.orig | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/methods/http.cc b/methods/http.cc index eb39da7..b512c5c 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -1127,6 +1127,14 @@ int HttpMethod::Loop() std::string urs = uri; + for (;;) { + size_t bad = urs.find_first_of("+"); + if (bad == std::string::npos) + break; + // XXX: generalize + urs = urs.substr(0, bad) + "%2b" + urs.substr(bad + 1); + } + CFStringRef sr = CFStringCreateWithCString(kCFAllocatorDefault, urs.c_str(), se); CFURLRef ur = CFURLCreateWithString(kCFAllocatorDefault, sr, NULL); CFRelease(sr); diff --git a/methods/http.cc.orig b/methods/http.cc.orig index 650bad0..75930ca 100644 --- a/methods/http.cc.orig +++ b/methods/http.cc.orig @@ -1123,6 +1123,14 @@ int HttpMethod::Loop() std::string urs = uri; + for (;;) { + size_t bad = urs.find_first_of("+"); + if (bad == std::string::npos) + break; + // XXX: generalize + urs = urs.substr(0, bad) + "%2b" + urs.substr(bad + 1); + } + CFStringRef sr = CFStringCreateWithCString(kCFAllocatorDefault, urs.c_str(), se); CFURLRef ur = CFURLCreateWithString(kCFAllocatorDefault, sr, NULL); CFRelease(sr); -- 2.47.2