HTTPResponse
in package
FinalYes
Legacy HTTP response emitter for headers, body streams, ranges, and content negotiation.
Included for historical compatibility only. This API is deprecated and should not be used in new code.
Tags
Table of Contents
Constants
- BODY_COMMAND : mixed = 4
- BODY_FILE : mixed = 2
- BODY_STREAM : mixed = 3
- BODY_STRING : mixed = 1
- CHUNK_EOL : mixed = "\r\n"
- CONTENT_ENCODING_GZIP : mixed = 'gzip'
- CONTENT_ENCODING_RAW : mixed = 'identity'
- STATUS_BAD_REQUEST : mixed = 400
- STATUS_GONE : mixed = 410
- STATUS_HTTP_VERSION_NOT_SUPPORTED : mixed = 505
- STATUS_INTERNAL_SERVER_ERROR : mixed = 500
- STATUS_METHOD_NOT_ALLOWED : mixed = 405
- STATUS_MOVED_PERMANENTLY : mixed = 301
- STATUS_MULTIPLE_CHOICES : mixed = 300
- STATUS_NO_CONTENT : mixed = 204
- STATUS_NOT_FOUND : mixed = 404
- STATUS_NOT_IMPLEMENTED : mixed = 501
- STATUS_NOT_MODIFIED : mixed = 304
- STATUS_OK : mixed = 200
- STATUS_PARTIAL_CONTENT : mixed = 206
- STATUS_PERMANENT_REDIRECT : mixed = 308
- STATUS_PRECONDITION_FAILED : mixed = 412
- STATUS_REQUESTED_RANGE_NOT_SATISFIABLE : mixed = 416
- STATUS_SEE_OTHER : mixed = 303
- STATUS_TEMPORARY_REDIRECT : mixed = 307
- STATUS_UNAUTHORIZED : mixed = 401
- TRANSFER_ENCODING_CHUNKED : mixed = 'chunked'
- TRANSFER_ENCODING_RAW : mixed = 'identity'
Properties
- $includeBody : mixed
- $body : mixed
- $bodyLength : mixed
- $bodyType : mixed
- $charset : mixed
- $contentEncoding : mixed
- $contentEncodingList : mixed
- $fileDisposition : mixed
- $fileExt : mixed
- $fileName : mixed
- $headerList : mixed
- $httpConfig : mixed
- $httpStatusCodes : mixed
- $ifModifiedSince : mixed
- $ifNoneMatch : mixed
- $language : mixed
- $method : mixed
- $mime : mixed
- $protocolMajorVersion : mixed
- $protocolMinorVersion : mixed
- $protocolName : mixed
- $rangeEnd : mixed
- $rangeStart : mixed
- $status : mixed
- $supportedContentEncodings : mixed
- $supportedNegotiations : mixed
- $supportedTransferEncodings : mixed
- $transferEncoding : mixed
- $transferEncodingList : mixed
Methods
- __construct() : mixed
- addHeader() : void
- addNegotiation() : void
- addTrackingInfo() : void
- cacheDurations() : CascadingDictionary
- calcEtag() : string
- getBody() : mixed
- getDocument() : DOMDocument
- getDocumentElement() : DOMNode|null
- getHeader() : mixed
- getStatus() : int
- inventCacheDuration() : int
- removeHeader() : void
- removeNegotiation() : bool
- send() : void
- setBody() : void
- setCommand() : void
- setContentEncoding() : void
- setDocument() : void
- setDownload() : void
- setEtag() : void
- setExceptionContext() : void
- setFile() : void
- setFileExt() : void
- setFileName() : void
- setHttpConfig() : void
- setLanguage() : void
- setLastModified() : void
- setMethod() : void
- setMoved() : void
- setRange() : void
- setRedirect() : void
- setRequest() : void
- setStatus() : void
- setStream() : void
- bodyHasChanged() : bool
- sendBody() : void
- sendBodyChunk() : void
- sendBodyEnd() : void
- sendHeaderList() : void
Constants
BODY_COMMAND
public
mixed
BODY_COMMAND
= 4
BODY_FILE
public
mixed
BODY_FILE
= 2
BODY_STREAM
public
mixed
BODY_STREAM
= 3
BODY_STRING
public
mixed
BODY_STRING
= 1
CHUNK_EOL
public
mixed
CHUNK_EOL
= "\r\n"
CONTENT_ENCODING_GZIP
public
mixed
CONTENT_ENCODING_GZIP
= 'gzip'
CONTENT_ENCODING_RAW
public
mixed
CONTENT_ENCODING_RAW
= 'identity'
STATUS_BAD_REQUEST
public
mixed
STATUS_BAD_REQUEST
= 400
STATUS_GONE
public
mixed
STATUS_GONE
= 410
STATUS_HTTP_VERSION_NOT_SUPPORTED
public
mixed
STATUS_HTTP_VERSION_NOT_SUPPORTED
= 505
STATUS_INTERNAL_SERVER_ERROR
public
mixed
STATUS_INTERNAL_SERVER_ERROR
= 500
STATUS_METHOD_NOT_ALLOWED
public
mixed
STATUS_METHOD_NOT_ALLOWED
= 405
STATUS_MOVED_PERMANENTLY
public
mixed
STATUS_MOVED_PERMANENTLY
= 301
STATUS_MULTIPLE_CHOICES
public
mixed
STATUS_MULTIPLE_CHOICES
= 300
STATUS_NO_CONTENT
public
mixed
STATUS_NO_CONTENT
= 204
STATUS_NOT_FOUND
public
mixed
STATUS_NOT_FOUND
= 404
STATUS_NOT_IMPLEMENTED
public
mixed
STATUS_NOT_IMPLEMENTED
= 501
STATUS_NOT_MODIFIED
public
mixed
STATUS_NOT_MODIFIED
= 304
STATUS_OK
public
mixed
STATUS_OK
= 200
STATUS_PARTIAL_CONTENT
public
mixed
STATUS_PARTIAL_CONTENT
= 206
STATUS_PERMANENT_REDIRECT
public
mixed
STATUS_PERMANENT_REDIRECT
= 308
STATUS_PRECONDITION_FAILED
public
mixed
STATUS_PRECONDITION_FAILED
= 412
STATUS_REQUESTED_RANGE_NOT_SATISFIABLE
public
mixed
STATUS_REQUESTED_RANGE_NOT_SATISFIABLE
= 416
STATUS_SEE_OTHER
public
mixed
STATUS_SEE_OTHER
= 303
STATUS_TEMPORARY_REDIRECT
public
mixed
STATUS_TEMPORARY_REDIRECT
= 307
STATUS_UNAUTHORIZED
public
mixed
STATUS_UNAUTHORIZED
= 401
TRANSFER_ENCODING_CHUNKED
public
mixed
TRANSFER_ENCODING_CHUNKED
= 'chunked'
TRANSFER_ENCODING_RAW
public
mixed
TRANSFER_ENCODING_RAW
= 'identity'
Properties
$includeBody
public
mixed
$includeBody
= true
$body
protected
mixed
$body
$bodyLength
protected
mixed
$bodyLength
$bodyType
protected
mixed
$bodyType
$charset
protected
mixed
$charset
$contentEncoding
protected
mixed
$contentEncoding
$contentEncodingList
protected
mixed
$contentEncodingList
$fileDisposition
protected
mixed
$fileDisposition
$fileExt
protected
mixed
$fileExt
$fileName
protected
mixed
$fileName
$headerList
protected
mixed
$headerList
$httpConfig
protected
static mixed
$httpConfig
= [
'date-format' => 'D, d M Y H:i:s \G\M\T',
'doc-timestamp' => false,
// "rendering took X seconds and Y MB"
'cache-duration' => 0,
// max-age, Sekunden
'input-size' => \Slothsoft\Core\IO\Memory::ONE_MEGABYTE,
// maximum $env['RESPONSE_INPUT'] size
'download-size' => 10 * \Slothsoft\Core\IO\Memory::ONE_MEGABYTE,
// if above, force download
'file-size' => 16 * \Slothsoft\Core\IO\Memory::ONE_MEGABYTE,
// maximum setFile-load
'seek-size' => \Slothsoft\Core\IO\Memory::ONE_MEGABYTE,
// maximum fseek
'chunk-size' => 256 * \Slothsoft\Core\IO\Memory::ONE_KILOBYTE,
// transfer-encoding
'gzip-level' => 9,
]
$httpStatusCodes
protected
static mixed
$httpStatusCodes
= [self::STATUS_OK => 'OK', self::STATUS_NO_CONTENT => 'No Content', self::STATUS_PARTIAL_CONTENT => 'Partial Content', self::STATUS_MULTIPLE_CHOICES => 'Multiple Choices', self::STATUS_MOVED_PERMANENTLY => 'Moved Permanently', self::STATUS_SEE_OTHER => 'See Other', self::STATUS_NOT_MODIFIED => 'Not Modified', self::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect', self::STATUS_PERMANENT_REDIRECT => 'Permanent Redirect', self::STATUS_BAD_REQUEST => 'Bad Request', self::STATUS_UNAUTHORIZED => 'Unauthorized', self::STATUS_NOT_FOUND => 'Not Found', self::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed', self::STATUS_GONE => 'Gone', self::STATUS_PRECONDITION_FAILED => 'Precondition Failed', self::STATUS_REQUESTED_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', self::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error', self::STATUS_NOT_IMPLEMENTED => 'Not Implemented', self::STATUS_HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version Not Supported']
$ifModifiedSince
protected
mixed
$ifModifiedSince
$ifNoneMatch
protected
mixed
$ifNoneMatch
$language
protected
mixed
$language
$method
protected
mixed
$method
$mime
protected
mixed
$mime
$protocolMajorVersion
protected
mixed
$protocolMajorVersion
$protocolMinorVersion
protected
mixed
$protocolMinorVersion
$protocolName
protected
mixed
$protocolName
$rangeEnd
protected
mixed
$rangeEnd
$rangeStart
protected
mixed
$rangeStart
$status
protected
mixed
$status
$supportedContentEncodings
protected
mixed
$supportedContentEncodings
= [self::CONTENT_ENCODING_RAW, self::CONTENT_ENCODING_GZIP]
$supportedNegotiations
protected
mixed
$supportedNegotiations
$supportedTransferEncodings
protected
mixed
$supportedTransferEncodings
= [self::TRANSFER_ENCODING_RAW, self::TRANSFER_ENCODING_CHUNKED]
$transferEncoding
protected
mixed
$transferEncoding
$transferEncodingList
protected
mixed
$transferEncodingList
Methods
__construct()
public
__construct() : mixed
addHeader()
public
addHeader(mixed $key, mixed $val[, mixed $param = null ]) : void
Parameters
- $key : mixed
- $val : mixed
- $param : mixed = null
addNegotiation()
public
addNegotiation(mixed $negotiation) : void
Parameters
- $negotiation : mixed
addTrackingInfo()
public
addTrackingInfo(array<string|int, mixed> &$env) : void
Parameters
- $env : array<string|int, mixed>
cacheDurations()
public
static cacheDurations() : CascadingDictionary
Return values
CascadingDictionarycalcEtag()
public
static calcEtag(mixed $data) : string
Parameters
- $data : mixed
Return values
stringgetBody()
public
getBody() : mixed
getDocument()
public
getDocument() : DOMDocument
Return values
DOMDocumentgetDocumentElement()
public
getDocumentElement(DOMDocument $targetDoc) : DOMNode|null
Parameters
- $targetDoc : DOMDocument
Return values
DOMNode|nullgetHeader()
public
getHeader(mixed $key) : mixed
Parameters
- $key : mixed
getStatus()
public
getStatus() : int
Return values
intinventCacheDuration()
public
static inventCacheDuration(string $mimeType) : int
Parameters
- $mimeType : string
Return values
intremoveHeader()
public
removeHeader(mixed $key) : void
Parameters
- $key : mixed
removeNegotiation()
public
removeNegotiation(mixed $negotiation) : bool
Parameters
- $negotiation : mixed
Return values
boolsend()
public
send() : void
setBody()
public
setBody(mixed $data) : void
Parameters
- $data : mixed
setCommand()
public
setCommand(HTTPCommand $command) : void
Parameters
- $command : HTTPCommand
setContentEncoding()
public
setContentEncoding(string $contentEncoding) : void
Parameters
- $contentEncoding : string
setDocument()
public
setDocument(DOMDocument $doc) : void
Parameters
- $doc : DOMDocument
setDownload()
public
setDownload(mixed $isDownload) : void
Parameters
- $isDownload : mixed
setEtag()
public
setEtag(mixed $etag[, mixed $isStrong = true ]) : void
Parameters
- $etag : mixed
- $isStrong : mixed = true
setExceptionContext()
public
setExceptionContext(ExceptionContext $exception) : void
Parameters
- $exception : ExceptionContext
setFile()
public
setFile(mixed $filePath[, mixed $fileName = null ]) : void
Parameters
- $filePath : mixed
- $fileName : mixed = null
setFileExt()
public
setFileExt(mixed $fileExt[, mixed $guessMime = false ]) : void
Parameters
- $fileExt : mixed
- $guessMime : mixed = false
setFileName()
public
setFileName(mixed $fileName) : void
Parameters
- $fileName : mixed
setHttpConfig()
public
static setHttpConfig(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
setLanguage()
public
setLanguage(mixed $language) : void
Parameters
- $language : mixed
setLastModified()
public
setLastModified([mixed $time = null ][, mixed $isStrong = true ]) : void
Parameters
- $time : mixed = null
- $isStrong : mixed = true
setMethod()
public
setMethod(mixed $method) : void
Parameters
- $method : mixed
setMoved()
public
setMoved(mixed $uri[, mixed $permanent = false ]) : void
Parameters
- $uri : mixed
- $permanent : mixed = false
setRange()
public
setRange(string $range) : void
Parameters
- $range : string
setRedirect()
public
setRedirect(mixed $uri[, mixed $permanent = false ][, mixed $forceGET = false ]) : void
Parameters
- $uri : mixed
- $permanent : mixed = false
- $forceGET : mixed = false
setRequest()
public
setRequest(HTTPRequest $httpRequest) : void
Parameters
- $httpRequest : HTTPRequest
setStatus()
public
setStatus(mixed $code[, mixed $message = '' ]) : void
Parameters
- $code : mixed
- $message : mixed = ''
setStream()
public
setStream(HTTPStream $stream) : void
Parameters
- $stream : HTTPStream
bodyHasChanged()
protected
bodyHasChanged() : bool
Return values
boolsendBody()
protected
sendBody() : void
sendBodyChunk()
protected
sendBodyChunk(mixed $chunk) : void
Parameters
- $chunk : mixed
sendBodyEnd()
protected
sendBodyEnd() : void
sendHeaderList()
protected
sendHeaderList() : void