From 0455110a0e16f8934ba132cd47468aa163219482 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 27 Feb 2014 15:51:49 +0000 Subject: [PATCH] Added method URL::createWithoutParsing() --- modules/juce_core/network/juce_URL.cpp | 7 +++++++ modules/juce_core/network/juce_URL.h | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/juce_core/network/juce_URL.cpp b/modules/juce_core/network/juce_URL.cpp index cf9f2cf67a..535fe81680 100644 --- a/modules/juce_core/network/juce_URL.cpp +++ b/modules/juce_core/network/juce_URL.cpp @@ -63,6 +63,13 @@ URL::URL (const String& u) : url (u) } } +URL::URL (const String& u, int) : url (u) {} + +URL URL::createWithoutParsing (const String& u) +{ + return URL (u, 0); +} + URL::URL (const URL& other) : url (other.url), postData (other.postData), diff --git a/modules/juce_core/network/juce_URL.h b/modules/juce_core/network/juce_URL.h index 28d3aac618..8b8db265c1 100644 --- a/modules/juce_core/network/juce_URL.h +++ b/modules/juce_core/network/juce_URL.h @@ -44,7 +44,11 @@ public: /** Creates an empty URL. */ URL(); - /** Creates a URL from a string. */ + /** Creates a URL from a string. + This will parse any embedded parameters after a '?' character and store them + in the list (see getParameterNames etc). If you don't want this to happen, you + can use createWithoutParsing(). + */ URL (const String& url); /** Creates a copy of another URL. */ @@ -326,12 +330,19 @@ public: */ static String removeEscapeChars (const String& stringToRemoveEscapeCharsFrom); + /** Returns a URL without attempting to remove any embedded parameters from the string. + This may be necessary if you need to create a request that involves both POST + parameters and parameters which are embedded in the URL address itself. + */ + static URL createWithoutParsing (const String& url); + private: //============================================================================== String url, postData; StringArray parameterNames, parameterValues; StringPairArray filesToUpload, mimeTypes; + URL (const String&, int); void addParameter (const String&, const String&); static InputStream* createNativeStream (const String& address, bool isPost, const MemoryBlock& postData,