[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> httputils.php (summary)

Utilities for handling HTTP related tasks

Author: Andreas Gohr
License: GPL 2 (http://www.gnu.org/licenses/gpl.html)
File Size: 346 lines (11 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 8 functions

  http_conditionalRequest()
  http_sendfile()
  http_rangeRequest()
  http_gzip_valid()
  http_cached()
  http_cached_finish()
  http_get_raw_post_data()
  http_status()

Functions
Functions that are not part of a class:

http_conditionalRequest($timestamp)   X-Ref
Checks and sets HTTP headers for conditional HTTP requests

author: Simon Willison <swillison@gmail.com>
param: int $timestamp lastmodified time of the cache file
link: http://simonwillison.net/2003/Apr/23/conditionalGet/
returns: void or exits with previously header() commands executed

http_sendfile($file)   X-Ref
Let the webserver send the given file via x-sendfile method

author: Chris Smith <chris@jalakai.co.uk>
param: string $file absolute path of file to send
returns: void or exits with previous header() commands executed

http_rangeRequest($fh,$size,$mime)   X-Ref
Send file contents supporting rangeRequests

This function exits the running script

author: Andreas Gohr <andi@splitbrain.org>
param: resource $fh - file handle for an already open file
param: int $size     - size of the whole file
param: int $mime     - MIME type of the file

http_gzip_valid($uncompressed_file)   X-Ref
Check for a gzipped version and create if necessary

return true if there exists a gzip version of the uncompressed file
(samepath/samefilename.sameext.gz) created after the uncompressed file

author: Chris Smith <chris.eureka@jalakai.co.uk>
return: bool
param: string $uncompressed_file

http_cached($cache, $cache_ok)   X-Ref
Set HTTP headers and echo cachefile, if useable

This function handles output of cacheable resource files. It ses the needed
HTTP headers. If a useable cache is present, it is passed to the web server
and the script is terminated.

param: string $cache cache file name
param: bool   $cache_ok    if cache can be used

http_cached_finish($file, $content)   X-Ref
Cache content and print it

param: string $file file name
param: string $content

http_get_raw_post_data()   X-Ref
Fetches raw, unparsed POST data

return: string

http_status($code = 200, $text = '')   X-Ref
Set the HTTP response status and takes care of the used PHP SAPI

Inspired by CodeIgniter's set_status_header function

param: int    $code
param: string $text