| @@ -7136,6 +7136,7 @@ URL::URL (const String& url_) | |||||
| URL::URL (const URL& other) | URL::URL (const URL& other) | ||||
| : url (other.url), | : url (other.url), | ||||
| postData (other.postData), | |||||
| parameters (other.parameters), | parameters (other.parameters), | ||||
| filesToUpload (other.filesToUpload), | filesToUpload (other.filesToUpload), | ||||
| mimeTypes (other.mimeTypes) | mimeTypes (other.mimeTypes) | ||||
| @@ -7145,6 +7146,7 @@ URL::URL (const URL& other) | |||||
| const URL& URL::operator= (const URL& other) | const URL& URL::operator= (const URL& other) | ||||
| { | { | ||||
| url = other.url; | url = other.url; | ||||
| postData = other.postData; | |||||
| parameters = other.parameters; | parameters = other.parameters; | ||||
| filesToUpload = other.filesToUpload; | filesToUpload = other.filesToUpload; | ||||
| mimeTypes = other.mimeTypes; | mimeTypes = other.mimeTypes; | ||||
| @@ -7402,14 +7404,13 @@ private: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| // just a short text attachment, so use simple url encoding.. | |||||
| const String params (getMangledParameters (url.getParameters())); | |||||
| appendUTF8ToPostData (getMangledParameters (url.getParameters())); | |||||
| appendUTF8ToPostData (url.getPostData()); | |||||
| // just a short text attachment, so use simple url encoding.. | |||||
| headers = "Content-Type: application/x-www-form-urlencoded\r\nContent-length: " | headers = "Content-Type: application/x-www-form-urlencoded\r\nContent-length: " | ||||
| + String ((int) strlen (params.toUTF8())) | |||||
| + String (postData.getSize()) | |||||
| + "\r\n"; | + "\r\n"; | ||||
| appendUTF8ToPostData (params); | |||||
| } | } | ||||
| } | } | ||||
| @@ -7497,6 +7498,13 @@ const URL URL::withFileToUpload (const String& parameterName, | |||||
| return u; | return u; | ||||
| } | } | ||||
| const URL URL::withPOSTData (const String& postData_) const | |||||
| { | |||||
| URL u (*this); | |||||
| u.postData = postData_; | |||||
| return u; | |||||
| } | |||||
| const StringPairArray& URL::getParameters() const throw() | const StringPairArray& URL::getParameters() const throw() | ||||
| { | { | ||||
| return parameters; | return parameters; | ||||
| @@ -31849,7 +31857,7 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs | |||||
| return 1; | return 1; | ||||
| case audioMasterGetSampleRate: | case audioMasterGetSampleRate: | ||||
| return (VstIntPtr) getSampleRate(); | |||||
| return (VstIntPtr) (getSampleRate() > 0 ? getSampleRate() : 44100); | |||||
| case audioMasterGetBlockSize: | case audioMasterGetBlockSize: | ||||
| return (VstIntPtr) getBlockSize(); | return (VstIntPtr) getBlockSize(); | ||||
| @@ -31926,6 +31934,9 @@ const String VSTPluginInstance::getVersion() const throw() | |||||
| String s; | String s; | ||||
| if (v == 0 || v == -1) | |||||
| v = getVersionNumber(); | |||||
| if (v != 0) | if (v != 0) | ||||
| { | { | ||||
| int versionBits[4]; | int versionBits[4]; | ||||
| @@ -12313,6 +12313,24 @@ public: | |||||
| */ | */ | ||||
| const StringPairArray& getMimeTypesOfUploadFiles() const throw(); | const StringPairArray& getMimeTypesOfUploadFiles() const throw(); | ||||
| /** Returns a copy of this URL, with a block of data to send as the POST data. | |||||
| If you're setting the POST data, be careful not to have any parameters set | |||||
| as well, otherwise it'll all get thrown in together, and might not have the | |||||
| desired effect. | |||||
| If the URL already contains some POST data, this will replace it, rather | |||||
| than being appended to it. | |||||
| This data will only be used if you specify a post operation when you call | |||||
| createInputStream(). | |||||
| */ | |||||
| const URL withPOSTData (const String& postData) const; | |||||
| /** Returns the data that was set using withPOSTData(). | |||||
| */ | |||||
| const String getPostData() const throw() { return postData; } | |||||
| /** Tries to launch the system's default browser to open the URL. | /** Tries to launch the system's default browser to open the URL. | ||||
| Returns true if this seems to have worked. | Returns true if this seems to have worked. | ||||
| @@ -12432,7 +12450,7 @@ public: | |||||
| juce_UseDebuggingNewOperator | juce_UseDebuggingNewOperator | ||||
| private: | private: | ||||
| String url; | |||||
| String url, postData; | |||||
| StringPairArray parameters, filesToUpload, mimeTypes; | StringPairArray parameters, filesToUpload, mimeTypes; | ||||
| }; | }; | ||||
| @@ -2437,7 +2437,7 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs | |||||
| return 1; | return 1; | ||||
| case audioMasterGetSampleRate: | case audioMasterGetSampleRate: | ||||
| return (VstIntPtr) getSampleRate(); | |||||
| return (VstIntPtr) (getSampleRate() > 0 ? getSampleRate() : 44100); | |||||
| case audioMasterGetBlockSize: | case audioMasterGetBlockSize: | ||||
| return (VstIntPtr) getBlockSize(); | return (VstIntPtr) getBlockSize(); | ||||
| @@ -2515,6 +2515,9 @@ const String VSTPluginInstance::getVersion() const throw() | |||||
| String s; | String s; | ||||
| if (v == 0 || v == -1) | |||||
| v = getVersionNumber(); | |||||
| if (v != 0) | if (v != 0) | ||||
| { | { | ||||
| int versionBits[4]; | int versionBits[4]; | ||||
| @@ -80,6 +80,7 @@ URL::URL (const String& url_) | |||||
| URL::URL (const URL& other) | URL::URL (const URL& other) | ||||
| : url (other.url), | : url (other.url), | ||||
| postData (other.postData), | |||||
| parameters (other.parameters), | parameters (other.parameters), | ||||
| filesToUpload (other.filesToUpload), | filesToUpload (other.filesToUpload), | ||||
| mimeTypes (other.mimeTypes) | mimeTypes (other.mimeTypes) | ||||
| @@ -89,6 +90,7 @@ URL::URL (const URL& other) | |||||
| const URL& URL::operator= (const URL& other) | const URL& URL::operator= (const URL& other) | ||||
| { | { | ||||
| url = other.url; | url = other.url; | ||||
| postData = other.postData; | |||||
| parameters = other.parameters; | parameters = other.parameters; | ||||
| filesToUpload = other.filesToUpload; | filesToUpload = other.filesToUpload; | ||||
| mimeTypes = other.mimeTypes; | mimeTypes = other.mimeTypes; | ||||
| @@ -352,14 +354,13 @@ private: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| // just a short text attachment, so use simple url encoding.. | |||||
| const String params (getMangledParameters (url.getParameters())); | |||||
| appendUTF8ToPostData (getMangledParameters (url.getParameters())); | |||||
| appendUTF8ToPostData (url.getPostData()); | |||||
| // just a short text attachment, so use simple url encoding.. | |||||
| headers = "Content-Type: application/x-www-form-urlencoded\r\nContent-length: " | headers = "Content-Type: application/x-www-form-urlencoded\r\nContent-length: " | ||||
| + String ((int) strlen (params.toUTF8())) | |||||
| + String (postData.getSize()) | |||||
| + "\r\n"; | + "\r\n"; | ||||
| appendUTF8ToPostData (params); | |||||
| } | } | ||||
| } | } | ||||
| @@ -449,6 +450,13 @@ const URL URL::withFileToUpload (const String& parameterName, | |||||
| return u; | return u; | ||||
| } | } | ||||
| const URL URL::withPOSTData (const String& postData_) const | |||||
| { | |||||
| URL u (*this); | |||||
| u.postData = postData_; | |||||
| return u; | |||||
| } | |||||
| const StringPairArray& URL::getParameters() const throw() | const StringPairArray& URL::getParameters() const throw() | ||||
| { | { | ||||
| return parameters; | return parameters; | ||||
| @@ -121,6 +121,24 @@ public: | |||||
| */ | */ | ||||
| const StringPairArray& getMimeTypesOfUploadFiles() const throw(); | const StringPairArray& getMimeTypesOfUploadFiles() const throw(); | ||||
| /** Returns a copy of this URL, with a block of data to send as the POST data. | |||||
| If you're setting the POST data, be careful not to have any parameters set | |||||
| as well, otherwise it'll all get thrown in together, and might not have the | |||||
| desired effect. | |||||
| If the URL already contains some POST data, this will replace it, rather | |||||
| than being appended to it. | |||||
| This data will only be used if you specify a post operation when you call | |||||
| createInputStream(). | |||||
| */ | |||||
| const URL withPOSTData (const String& postData) const; | |||||
| /** Returns the data that was set using withPOSTData(). | |||||
| */ | |||||
| const String getPostData() const throw() { return postData; } | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Tries to launch the system's default browser to open the URL. | /** Tries to launch the system's default browser to open the URL. | ||||
| @@ -248,7 +266,7 @@ public: | |||||
| juce_UseDebuggingNewOperator | juce_UseDebuggingNewOperator | ||||
| private: | private: | ||||
| String url; | |||||
| String url, postData; | |||||
| StringPairArray parameters, filesToUpload, mimeTypes; | StringPairArray parameters, filesToUpload, mimeTypes; | ||||
| }; | }; | ||||