The EventHttpRequest class

- « EventHttpConnection::setTimeout

- EventHttpRequest::addHeader »

- PHP Manual
- Event
- The EventHttpRequest class

# The EventHttpRequest class

(PECL event >= 1.4.0-beta)

## Introduction

Represents an HTTP request.

## Class synopsis

class EventHttpRequest {
/* Constants */
const int CMD_GET = 1;
const int CMD_POST = 2;
const int CMD_HEAD = 4;
const int CMD_PUT = 8;
const int CMD_DELETE = 16;
const int CMD_OPTIONS = 32;
const int CMD_TRACE = 64;
const int CMD_CONNECT = 128;
const int CMD_PATCH = 256;
const int INPUT_HEADER = 1;
const int OUTPUT_HEADER = 2;
/* Methods */
public addHeader( string `$key` , string `$value` , int `$type` ): bool
public cancel(): void
public clearHeaders(): void
public closeConnection(): void
public __construct( callable `$callback` , mixed `$data` = `null` )
public findHeader( string `$key` , string `$type` ): void
public free(): void
public closeConnection(): EventBufferEvent
public getCommand(): void
public closeConnection(): EventHttpConnection
public getHost(): string
public getInputBuffer(): EventBuffer
public getInputHeaders(): array
public getOutputBuffer(): EventBuffer
public getOutputHeaders(): void
public getResponseCode(): int
public getUri(): string
public removeHeader( string `$key` , string `$type` ): void
public sendError( int `$error` , string `$reason` = `null` ): void
public sendReply( int `$code` , string `$reason` , EventBuffer `$buf` = ?): void
public sendReplyChunk( EventBuffer `$buf` ): void
public sendReplyEnd(): void
public sendReplyStart( int `$code` , string `$reason` ): void
}

## Predefined Constants

`EventHttpRequest::CMD_GET`

  GET method(command)

`EventHttpRequest::CMD_POST`

  POST method(command)

`EventHttpRequest::CMD_HEAD`

  HEAD method(command)

`EventHttpRequest::CMD_PUT`

  PUT method(command)

`EventHttpRequest::CMD_DELETE`

  DELETE command(method)

`EventHttpRequest::CMD_OPTIONS`

  OPTIONS method(command)

`EventHttpRequest::CMD_TRACE`

  TRACE method(command)

`EventHttpRequest::CMD_CONNECT`

  CONNECT method(command)

`EventHttpRequest::CMD_PATCH`

  PATCH method(command)

`EventHttpRequest::INPUT_HEADER`

  Request input header type.

`EventHttpRequest::OUTPUT_HEADER`

  Request output header type.

## Table of Contents

- EventHttpRequest::addHeader — Adds an HTTP header to the headers of the request
- EventHttpRequest::cancel — Cancels a pending HTTP request
- EventHttpRequest::clearHeaders — Removes all output headers from the header list of the request
- EventHttpRequest::closeConnection — Closes associated HTTP connection
- EventHttpRequest::__construct — Constructs EventHttpRequest object
- EventHttpRequest::findHeader — Finds the value belonging a header
- EventHttpRequest::free — Frees the object and removes associated events
- EventHttpRequest::getBufferEvent — Returns EventBufferEvent object
- EventHttpRequest::getCommand — Returns the request command(method)
- EventHttpRequest::getConnection — Returns EventHttpConnection object
- EventHttpRequest::getHost — Returns the request host
- EventHttpRequest::getInputBuffer — Returns the input buffer
- EventHttpRequest::getInputHeaders — Returns associative array of the input headers
- EventHttpRequest::getOutputBuffer — Returns the output buffer of the request
- EventHttpRequest::getOutputHeaders — Returns associative array of the output headers
- EventHttpRequest::getResponseCode — Returns the response code
- EventHttpRequest::getUri — Returns the request URI
- EventHttpRequest::removeHeader — Removes an HTTP header from the headers of the request
- EventHttpRequest::sendError — Send an HTML error message to the client
- EventHttpRequest::sendReply — Send an HTML reply to the client
- EventHttpRequest::sendReplyChunk — Send another data chunk as part of an ongoing chunked reply
- EventHttpRequest::sendReplyEnd — Complete a chunked reply, freeing the request as appropriate
- EventHttpRequest::sendReplyStart — Initiate a chunked reply