diff options
| author | Cassio de Campos <cassiopc@gmail.com> | 2017-10-30 19:00:29 +0000 |
|---|---|---|
| committer | Cassio de Campos <cassiopc@gmail.com> | 2017-10-30 19:00:29 +0000 |
| commit | 3ccdafc2ac0609d02f0e04f242b60a686a41c03a (patch) | |
| tree | 2d40d34ed8215596c70da2c8dd1c143fc02e15d2 | |
| parent | b3fd27cf7372875ecb57e010fa95de93815c8445 (diff) | |
| download | boca-3ccdafc2ac0609d02f0e04f242b60a686a41c03a.tar.gz boca-3ccdafc2ac0609d02f0e04f242b60a686a41c03a.zip | |
speed up http
| -rw-r--r-- | src/fextdata.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/fextdata.php b/src/fextdata.php index da6e559..f1e568a 100644 --- a/src/fextdata.php +++ b/src/fextdata.php @@ -82,7 +82,7 @@ function scoretransfer($putname, $localsite, $timeo=20) { // LOGError("url=" .$siteurl . "index.php?getsessionid=1"); $opts = array(); $opts['http']['timeout'] = $timeo; - $context = stream_context_create($opts); + $context = stream_context_create($opts); if(($sess = @file_get_contents($siteurl . "index.php?getsessionid=1", 0, $context))===false) { LOGError("scoretransfer: timeout at get session id for $siteurl"); $logstr .= "timeout at get-session-id for $siteurl\n"; @@ -96,13 +96,14 @@ function scoretransfer($putname, $localsite, $timeo=20) { 'http' => array( 'method' => 'GET', 'request_fulluri' => true, - 'header' => 'Cookie: PHPSESSID=' . $sess + 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\n" ) ); if($bocaproxy != "") $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") - $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; + $opts['http']['header'] .= "Proxy-Authorization: Basic " . $bocaproxypass . "\r\n"; + $opts['http']['header'] .= "Connection: close\r\n"; $opts['http']['timeout'] = $timeo; $context = stream_context_create($opts); try { @@ -165,14 +166,15 @@ function scoretransfer($putname, $localsite, $timeo=20) { 'http' => array( 'method' => 'POST', 'request_fulluri' => true, - 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\nContent-Type: application/x-www-form-urlencoded", + 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\nContent-Type: application/x-www-form-urlencoded\r\n", 'content' => $data_url ) ); if($bocaproxy != "") $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") - $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; + $opts['http']['header'] .= "Proxy-Authorization: Basic " . $bocaproxypass . "\r\n"; + $opts['http']['header'] .= "Connection: close\r\n"; $opts['http']['timeout'] = $timeo; $context = stream_context_create($opts); try { @@ -201,14 +203,14 @@ function scoretransfer($putname, $localsite, $timeo=20) { 'http' => array( 'method' => 'POST', 'request_fulluri' => true, - 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\nContent-Type: application/x-www-form-urlencoded", + 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\nContent-Type: application/x-www-form-urlencoded\r\n", 'content' => $data_url ) ); if($bocaproxy != "") $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") - $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; + $opts['http']['header'] .= "Proxy-Authorization: Basic " . $bocaproxypass . "\r\n"; $opts['http']['timeout'] = $timeo; $context = stream_context_create($opts); try { @@ -311,13 +313,14 @@ function getMainXML($contest,$timeo=20,$upd=false) { 'http' => array( 'method' => 'GET', 'request_fulluri' => true, - 'header' => 'Cookie: PHPSESSID=' . $sess + 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\n" ) ); if($bocaproxy != "") $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") - $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; + $opts['http']['header'] .= "Proxy-Authorization: Basic " . $bocaproxypass . "\r\n"; + $opts['http']['header'] .= "Connection: close\r\n"; $opts['http']['timeout'] = $timeo; $context = stream_context_create($opts); $logstr .= "Authorizing\n"; @@ -353,14 +356,15 @@ function getMainXML($contest,$timeo=20,$upd=false) { 'http' => array( 'method' => 'POST', 'request_fulluri' => true, - 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\nContent-Type: application/x-www-form-urlencoded", + 'header' => 'Cookie: PHPSESSID=' . $sess . "\r\nContent-Type: application/x-www-form-urlencoded\r\n", 'content' => $data_url ) ); if($bocaproxy != "") $opts['http']['proxy'] = $bocaproxy; if($bocaproxypass != "") - $opts['http']['header'] .= "\r\nProxy-Authorization: Basic " . $bocaproxypass; + $opts['http']['header'] .= "Proxy-Authorization: Basic " . $bocaproxypass . "\r\n"; + $opts['http']['header'] .= "Connection: close\r\n"; $opts['http']['timeout'] = $timeo; $context = stream_context_create($opts); $logstr .= "Transferring data to main server\n"; |