summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_url.class19
1 files changed, 9 insertions, 10 deletions
diff --git a/it_url.class b/it_url.class
index 8b2ef51..1594f4c 100644
--- a/it_url.class
+++ b/it_url.class
@@ -283,17 +283,18 @@ function request($p=array())
static function curl_opts($p=array())
{
$p += array('totaltimeout' => "999999", 'timeout' => 5);
+ $add = [];
foreach ($p['headers'] as $header => $value)
$headers[] = "$header: $value";
if ($p['maxlength']) {
$maxlength = $p['maxlength'];
- $add = array(
+ $add += [
#CURLOPT_BUFFERSIZE => 1024 * 1024 * 10,
CURLOPT_NOPROGRESS => false,
CURLOPT_PROGRESSFUNCTION => function ($dummy0, $dummy1, $size, $dummy2, $dummy3) use ($maxlength) { return $size < $maxlength ? 0 : 1; },
- );
+ ];
}
# file upload
@@ -301,17 +302,15 @@ static function curl_opts($p=array())
$p['data'][$field] = new CURLFile($filename, mime_content_type($filename));
if ($p['data'])
- $add[CURLOPT_POSTFIELDS] = $p['data'];
+ $add += [ CURLOPT_POSTFIELDS => $p['data'] ];
if ($p['compression'])
- $add[CURLOPT_ENCODING] = "";
+ $add += [ CURLOPT_ENCODING => "" ];
- if ($p['pass'] || $p['user']) {
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_setopt($ch, CURLOPT_USERPWD, $p['user'] . ':' . $p['pass']);
- }
+ if ($p['pass'] || $p['user'])
+ $add += [ CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => $p['user'] . ':' . $p['pass'] ];
- return (array)$add + array(
+ return $add + [
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => $p['totaltimeout'],
@@ -327,7 +326,7 @@ static function curl_opts($p=array())
CURLOPT_SSL_VERIFYHOST => $p['allow_insecure_ssl'] ? 0 : 2,
CURLINFO_HEADER_OUT => 1,
- );
+ ];
}
/*