@@ -110,12 +110,12 @@ struct CURLSymbols
110
110
class WebInputStream ::Pimpl
111
111
{
112
112
public:
113
- Pimpl (WebInputStream& ownerStream, const URL& urlToCopy, bool isPOSTLike )
113
+ Pimpl (WebInputStream& ownerStream, const URL& urlToCopy, bool addParametersToBody )
114
114
: owner (ownerStream),
115
115
url (urlToCopy),
116
- addParametersToRequestBody (isPOSTLike ),
117
- hasPOSTData (url.hasPOSTData() ),
118
- httpRequest (isPOSTLike || url.hasPOSTData() ? "POST" : "GET")
116
+ addParametersToRequestBody (addParametersToBody ),
117
+ hasBodyDataToSend (url.hasBodyDataToSend() || addParametersToRequestBody ),
118
+ httpRequest (hasBodyDataToSend ? " POST" : " GET" )
119
119
{
120
120
jassert (symbols); // Unable to load libcurl!
121
121
@@ -231,8 +231,11 @@ class WebInputStream::Pimpl
231
231
if (! requestHeaders.endsWithChar (' \n ' ))
232
232
requestHeaders << " \r\n " ;
233
233
234
- if (hasPOSTData)
235
- WebInputStream::createHeadersAndPostData (url, requestHeaders, headersAndPostData, addParametersToRequestBody);
234
+ if (hasBodyDataToSend)
235
+ WebInputStream::createHeadersAndPostData (url,
236
+ requestHeaders,
237
+ headersAndPostData,
238
+ addParametersToRequestBody);
236
239
237
240
if (! requestHeaders.endsWithChar (' \n ' ))
238
241
requestHeaders << " \r\n " ;
@@ -247,7 +250,7 @@ class WebInputStream::Pimpl
247
250
&& symbols->curl_easy_setopt (curl, CURLOPT_USERAGENT, userAgent.toRawUTF8 ()) == CURLE_OK
248
251
&& symbols->curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, (maxRedirects > 0 ? 1 : 0 )) == CURLE_OK)
249
252
{
250
- if (hasPOSTData )
253
+ if (hasBodyDataToSend )
251
254
{
252
255
if (symbols->curl_easy_setopt (curl, CURLOPT_READDATA, this ) != CURLE_OK
253
256
|| symbols->curl_easy_setopt (curl, CURLOPT_READFUNCTION, StaticCurlRead) != CURLE_OK)
@@ -259,7 +262,7 @@ class WebInputStream::Pimpl
259
262
}
260
263
261
264
// handle special http request commands
262
- const auto hasSpecialRequestCmd = hasPOSTData ? (httpRequest != " POST" ) : (httpRequest != " GET" );
265
+ const auto hasSpecialRequestCmd = hasBodyDataToSend ? (httpRequest != " POST" ) : (httpRequest != " GET" );
263
266
264
267
if (hasSpecialRequestCmd)
265
268
if (symbols->curl_easy_setopt (curl, CURLOPT_CUSTOMREQUEST, httpRequest.toRawUTF8 ()) != CURLE_OK)
@@ -326,7 +329,7 @@ class WebInputStream::Pimpl
326
329
327
330
listener = webInputListener;
328
331
329
- if (hasPOSTData )
332
+ if (hasBodyDataToSend )
330
333
postBuffer = &headersAndPostData;
331
334
332
335
size_t lastPos = static_cast <size_t > (-1 );
@@ -348,7 +351,7 @@ class WebInputStream::Pimpl
348
351
singleStep ();
349
352
350
353
// call callbacks if this is a post request
351
- if (hasPOSTData && listener != nullptr && lastPos != postPosition)
354
+ if (hasBodyDataToSend && listener != nullptr && lastPos != postPosition)
352
355
{
353
356
lastPos = postPosition;
354
357
@@ -619,7 +622,7 @@ class WebInputStream::Pimpl
619
622
// Options
620
623
int timeOutMs = 0 ;
621
624
int maxRedirects = 5 ;
622
- const bool addParametersToRequestBody, hasPOSTData ;
625
+ const bool addParametersToRequestBody, hasBodyDataToSend ;
623
626
String httpRequest;
624
627
625
628
// ==============================================================================
0 commit comments