mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-30 02:50:05 +00:00
Fixed bug in OSX network code where Content-Type headers were not being added to HTTP POST requests unless specified manually and renamed a variable in URL::createHeadersAndPostData() method
This commit is contained in:
parent
fcd5a47d8c
commit
2a983067ab
2 changed files with 11 additions and 11 deletions
|
|
@ -1018,6 +1018,15 @@ private:
|
|||
{
|
||||
[req setHTTPMethod: [NSString stringWithUTF8String: httpRequestCmd.toRawUTF8()]];
|
||||
|
||||
if (isPost)
|
||||
{
|
||||
WebInputStream::createHeadersAndPostData (url, headers, postData);
|
||||
|
||||
if (postData.getSize() > 0)
|
||||
[req setHTTPBody: [NSData dataWithBytes: postData.getData()
|
||||
length: postData.getSize()]];
|
||||
}
|
||||
|
||||
StringArray headerLines;
|
||||
headerLines.addLines (headers);
|
||||
headerLines.removeEmptyStrings (true);
|
||||
|
|
@ -1031,15 +1040,6 @@ private:
|
|||
[req addValue: juceStringToNS (value) forHTTPHeaderField: juceStringToNS (key)];
|
||||
}
|
||||
|
||||
if (isPost)
|
||||
{
|
||||
WebInputStream::createHeadersAndPostData (url, headers, postData);
|
||||
|
||||
if (postData.getSize() > 0)
|
||||
[req setHTTPBody: [NSData dataWithBytes: postData.getData()
|
||||
length: postData.getSize()]];
|
||||
}
|
||||
|
||||
connection = new URLConnectionState (req, numRedirectsToFollow);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,9 +354,9 @@ URL URL::getChildURL (const String& subPath) const
|
|||
return u;
|
||||
}
|
||||
|
||||
void URL::createHeadersAndPostData (String& headers, MemoryBlock& headersAndPostData) const
|
||||
void URL::createHeadersAndPostData (String& headers, MemoryBlock& postDataToWrite) const
|
||||
{
|
||||
MemoryOutputStream data (headersAndPostData, false);
|
||||
MemoryOutputStream data (postDataToWrite, false);
|
||||
|
||||
if (filesToUpload.size() > 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue