Lines Matching defs:headers
31 public $header_regexp = ''; // if set this RE must match against the headers, else abort
32 public $headers = [];
72 if (extension_loaded('zlib')) $this->headers['Accept-encoding'] = 'gzip';
73 $this->headers['Accept'] = 'text/xml,application/xml,application/xhtml+xml,' .
75 $this->headers['Accept-Language'] = 'en-us';
145 * builds the request headers, follows redirects and parses the response.
173 isset($this->headers['Accept-encoding']) &&
174 $this->headers['Accept-encoding'] == 'gzip'
176 unset($this->headers['Accept-encoding']);
210 // prepare headers
211 $headers = $this->headers;
212 $headers['Host'] = $uri['host']
214 $headers['User-Agent'] = $this->agent;
215 $headers['Referer'] = $this->referer;
219 if (empty($headers['Content-Type'])) {
220 $headers['Content-Type'] = null;
222 if ($headers['Content-Type'] == 'multipart/form-data') {
223 $headers['Content-Type'] = 'multipart/form-data; boundary=' . $this->boundary;
226 $headers['Content-Type'] = 'application/x-www-form-urlencoded';
236 $headers['Content-Length'] = $contentlength;
240 $headers['Authorization'] = 'Basic ' . base64_encode($this->user . ':' . $this->pass);
243 $headers['Proxy-Authorization'] = 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass);
270 if (isset($headers['Proxy-Authentication'])) unset($headers['Proxy-Authentication']);
291 $headers['Connection'] = 'Keep-Alive';
293 $headers['Connection'] = 'Close';
302 $request .= $this->buildHeaders($headers);
310 // read headers from socket
313 $r_line = $this->readLine($socket, 'headers');
317 $this->debug('response headers', $r_headers);
334 // handle headers and cookies
351 $this->debug('Object headers', $this->resp_headers);
387 // check if headers are as expected
389 throw new HTTPClientException('The received headers did not match the given regexp');
537 // read headers from socket
540 $r_line = $this->readLine($socket, 'headers');
777 $headers = [];
786 if (isset($headers[$key])) {
787 if (is_array($headers[$key])) {
788 $headers[$key][] = $val;
790 $headers[$key] = [$headers[$key], $val];
793 $headers[$key] = $val;
796 return $headers;
802 * @param array $headers
807 protected function buildHeaders($headers)
810 foreach ($headers as $key => $value) {
826 $headers = '';
828 $headers .= "$key=$val; ";
830 $headers = substr($headers, 0, -2);
831 if ($headers) $headers = "Cookie: $headers" . HTTP_NL;
832 return $headers;
865 $out .= HTTP_NL; // end of headers
873 $out .= HTTP_NL; // end of headers