|
|
|
@@ -37,7 +37,7 @@ void MACAddress::findAllAddresses (Array<MACAddress>& result) |
|
|
|
|
|
|
|
if (sto.sa_family == AF_LINK)
|
|
|
|
{
|
|
|
|
auto sadd = (const sockaddr_dl*) cursor->ifa_addr;
|
|
|
|
auto sadd = reinterpret_cast<const sockaddr_dl*> (cursor->ifa_addr);
|
|
|
|
|
|
|
|
#ifndef IFT_ETHER
|
|
|
|
enum { IFT_ETHER = 6 };
|
|
|
|
@@ -127,7 +127,7 @@ public: |
|
|
|
DelegateClass::setState (delegate, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
~URLConnectionState()
|
|
|
|
~URLConnectionState() override
|
|
|
|
{
|
|
|
|
signalThreadShouldExit();
|
|
|
|
|
|
|
|
@@ -1096,38 +1096,44 @@ private: |
|
|
|
{
|
|
|
|
jassert (connection == nullptr);
|
|
|
|
|
|
|
|
if (NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: juceStringToNS (url.toString (! isPost))]
|
|
|
|
cachePolicy: NSURLRequestReloadIgnoringLocalCacheData
|
|
|
|
timeoutInterval: timeOutMs <= 0 ? 60.0 : (timeOutMs / 1000.0)])
|
|
|
|
if (NSURL* nsURL = [NSURL URLWithString: juceStringToNS (url.toString (! isPost))])
|
|
|
|
{
|
|
|
|
[req setHTTPMethod: [NSString stringWithUTF8String: httpRequestCmd.toRawUTF8()]];
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
|
if (NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL: nsURL
|
|
|
|
cachePolicy: NSURLRequestReloadIgnoringLocalCacheData
|
|
|
|
timeoutInterval: timeOutMs <= 0 ? 60.0 : (timeOutMs / 1000.0)])
|
|
|
|
{
|
|
|
|
WebInputStream::createHeadersAndPostData (url, headers, postData);
|
|
|
|
if (NSString* httpMethod = [NSString stringWithUTF8String: httpRequestCmd.toRawUTF8()])
|
|
|
|
{
|
|
|
|
[req setHTTPMethod: httpMethod];
|
|
|
|
|
|
|
|
if (postData.getSize() > 0)
|
|
|
|
[req setHTTPBody: [NSData dataWithBytes: postData.getData()
|
|
|
|
length: postData.getSize()]];
|
|
|
|
}
|
|
|
|
if (isPost)
|
|
|
|
{
|
|
|
|
WebInputStream::createHeadersAndPostData (url, headers, postData);
|
|
|
|
|
|
|
|
StringArray headerLines;
|
|
|
|
headerLines.addLines (headers);
|
|
|
|
headerLines.removeEmptyStrings (true);
|
|
|
|
if (postData.getSize() > 0)
|
|
|
|
[req setHTTPBody: [NSData dataWithBytes: postData.getData()
|
|
|
|
length: postData.getSize()]];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < headerLines.size(); ++i)
|
|
|
|
{
|
|
|
|
String key = headerLines[i].upToFirstOccurrenceOf (":", false, false).trim();
|
|
|
|
String value = headerLines[i].fromFirstOccurrenceOf (":", false, false).trim();
|
|
|
|
StringArray headerLines;
|
|
|
|
headerLines.addLines (headers);
|
|
|
|
headerLines.removeEmptyStrings (true);
|
|
|
|
|
|
|
|
if (key.isNotEmpty() && value.isNotEmpty())
|
|
|
|
[req addValue: juceStringToNS (value) forHTTPHeaderField: juceStringToNS (key)];
|
|
|
|
}
|
|
|
|
for (int i = 0; i < headerLines.size(); ++i)
|
|
|
|
{
|
|
|
|
auto key = headerLines[i].upToFirstOccurrenceOf (":", false, false).trim();
|
|
|
|
auto value = headerLines[i].fromFirstOccurrenceOf (":", false, false).trim();
|
|
|
|
|
|
|
|
if (key.isNotEmpty() && value.isNotEmpty())
|
|
|
|
[req addValue: juceStringToNS (value) forHTTPHeaderField: juceStringToNS (key)];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Workaround for an Apple bug. See https://github.com/AFNetworking/AFNetworking/issues/2334
|
|
|
|
[req HTTPBody];
|
|
|
|
// Workaround for an Apple bug. See https://github.com/AFNetworking/AFNetworking/issues/2334
|
|
|
|
[req HTTPBody];
|
|
|
|
|
|
|
|
connection.reset (new URLConnectionState (req, numRedirectsToFollow));
|
|
|
|
connection.reset (new URLConnectionState (req, numRedirectsToFollow));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|