Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 401 and 402]

(no description)

File Size: 283 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Http:: (3 methods):
  decodeChunked()
  parseResponseHeaders()
  parseAcceptHeader()


Class: Http  - X-Ref

decodeChunked($buffer)   X-Ref
Decode a string that is encoded with "chunked" transfer encoding as defined in rfc2068 par. 19.4.6.
Code shamelessly stolen from nusoap library by Dietrich Ayala.

param: string $buffer the string to be decoded
return: string

parseResponseHeaders(&$data, $headersProcessed = false, $debug = 0)   X-Ref
Parses HTTP an http response's headers and separates them from the body.

param: string $data the http response, headers and body. It will be stripped of headers
param: bool $headersProcessed when true, we assume that response inflating and dechunking has been already carried out
param: int $debug when > 0, logs to screen messages detailing info about the parsed data
return: array with keys 'headers', 'cookies', 'raw_data' and 'status_code'

parseAcceptHeader($header)   X-Ref
Parses one of the http headers which can have a list of values with quality param.

param: string $header
return: string[]