Lines Matching full:if

22     //set these if you like
30 …public $max_bodysize_abort = true; // if set, abort if the response body is bigger than max_bodys…
31 public $header_regexp = ''; // if set this RE must match against the headers, else abort
50 // set these if you need to use a proxy
55 public $proxy_ssl; //boolean set to true if your proxy needs SSL
72 if (extension_loaded('zlib')) $this->headers['Accept-encoding'] = 'gzip';
92 if (!$this->sendRequest($url)) return false;
93 if ($this->status == 304 && $sloppy304) return $this->resp_body;
94 if ($this->status < 200 || $this->status > 206) return false;
115 if (strpos($url, '?')) {
136 if (!$this->sendRequest($url, $data, 'POST')) return false;
137 if ($this->status < 200 || $this->status > 206) return false;
169 // don't accept gzip if truncated bodies might occur
170 if (
184 if (!empty($uri['query'])) $path .= '?' . $uri['query'];
185 if (isset($uri['user'])) $this->user = $uri['user'];
186 if (isset($uri['pass'])) $this->pass = $uri['pass'];
189 if ($this->useProxyForUrl($url)) {
193 if (empty($port)) $port = 8080;
201 // add SSL stream prefix if needed - needs SSL support in PHP
202 if ($use_tls) {
203 if (!in_array('ssl', stream_get_transports())) {
217 if ($method == 'POST') {
218 if (is_array($data)) {
219 if (empty($headers['Content-Type'])) {
222 if ($headers['Content-Type'] == 'multipart/form-data') {
235 if ($contentlength) {
239 if ($this->user) {
242 if ($this->proxy_user) {
250 if (isset(self::$connections[$connectionId])) {
254 if (is_null($socket) || feof($socket)) {
258 if (!$socket) {
266 if ($this->ssltunnel($socket, $request_url)) {
270if (isset($headers['Proxy-Authentication'])) unset($headers['Proxy-Authentication']);
280 if ($this->keep_alive) {
287 if ($this->keep_alive && !$this->useProxyForUrl($request_url)) {
319 // check if expected body size exceeds allowance
320if ($this->max_bodysize && preg_match('/\r?\nContent-Length:\s*(\d+)\r?\n/i', $r_headers, $match))…
321 if ($match[1] > $this->max_bodysize) {
322 if ($this->max_bodysize_abort)
329 if (!preg_match('/^HTTP\/(\d\.\d)\s*(\d+).*?\n/s', $r_headers, $m))
336 if (isset($this->resp_headers['set-cookie'])) {
341 if ($val == 'deleted') {
342 if (isset($this->cookies[$key])) {
354 if (in_array($this->status, [301, 302, 303, 307, 308])) {
355 if (empty($this->resp_headers['location'])) {
368 if (!preg_match('/^http/i', $this->resp_headers['location'])) {
369 if ($this->resp_headers['location'][0] != '/') {
377 if ($this->status == 307 || $this->status == 308) {
387 // check if headers are as expected
388 if ($this->header_regexp && !preg_match($this->header_regexp, $r_headers))
391 //read body (with chunked encoding if needed)
393 if (
408if (strlen($chunk_size) > 128) // set an abritrary limit on the size of chunks
414if ($this->max_bodysize && $chunk_size + strlen($r_body) > $this->max_bodysize) {
415 if ($this->max_bodysize_abort)
422 if ($chunk_size > 0) {
432 … * If a message is received with both a Transfer-Encoding header field and a Content-Length
438 if (
461 if ($this->max_bodysize) {
462 if (strlen($r_body) > $this->max_bodysize) {
463 if ($this->max_bodysize_abort) {
472 if ($err->getCode())
479 if (
488 // decode gzip if needed
489 if (
495 if ($this->resp_body === false) {
515 * @return bool true if a tunnel was established
520 if (!$this->useProxyForUrl($requesturl)) return false;
522 if ($requestinfo['scheme'] != 'https') return false;
523 if (empty($requestinfo['port'])) $requestinfo['port'] = 443;
528 if ($this->proxy_user) {
545 if (preg_match('/^HTTP\/1\.[01] 200/i', $r_headers)) {
551 if (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID <= 50606) {
558 if (@stream_socket_enable_crypto($socket, true, $cryptoMethod)) {
591 if ($time_used > $this->timeout)
593 if (feof($socket))
601 if (@stream_select($sel_r, $sel_w, $sel_e, 1) === false) {
608 if ($nbytes === false)
617 * Reads up to a given number of bytes or throws an exception if the
623 * @param bool $ignore_eof End-of-file is not an error if this is set
633 if ($nbytes < 0) $nbytes = 0;
637 if ($time_used > $this->timeout)
647 if (feof($socket)) {
648 if (!$ignore_eof)
653 if ($to_read > 0) {
659 if (@stream_select($sel_r, $sel_w, $sel_e, 1) === false) {
665 if ($bytes === false)
691 if ($time_used > $this->timeout)
696 if (feof($socket))
704 if (@stream_select($sel_r, $sel_w, $sel_e, 1) === false) {
726 if (!$this->debug) return;
727 if (PHP_SAPI == 'cli') {
743 if (!is_null($var)) {
761 if (!is_null($var)) print_r($var);
785 if (!$key) continue;
786 if (isset($headers[$key])) {
787 if (is_array($headers[$key])) {
811 if ($value === '') continue;
831 if ($headers) $headers = "Cookie: $headers" . HTTP_NL;
863 if (!is_array($val)) {
870 if ($val['filename']) $out .= '; filename="' . urlencode($val['filename']) . '"';
872 if ($val['mimetype']) $out .= 'Content-Type: ' . $val['mimetype'] . HTTP_NL;