pub struct HttpMessage<'lua> { /* private fields */ }
Expand description

This class contains all functions to manipulate an HTTP message. For now, this class is only available from a filter context.

Implementations

Appends an HTTP header field in the HTTP message whose name is specified in name and value is defined in value.

Copies the string at the end of incoming data of the HTTP message. The function returns the copied length on success or -1 if data cannot be copied.

Returns length bytes of incoming data from the HTTP message, starting at the offset. The data are not removed from the buffer.

Returns a corresponding channel attached to the HTTP message.

Returns true if the end of message is reached.

Removes all HTTP header fields in the HTTP message whose name is specified in name.

Returns a table containing all the headers of the HTTP message.

Returns a table containing the start-line of the HTTP message.

Forwards length bytes of data from the HTTP message. Returns the amount of data forwarded.

Because it is called in the filter context, it never yield. Only available incoming data may be forwarded, event if the requested length exceeds the available amount of incoming data.

Returns the length of incoming data in the HTTP message from the calling filter point of view.

Copies the data at the offset in incoming data of the HTTP message. Returns the copied length on success or -1 if data cannot be copied.

By default, if no offset is provided, the string is copied in front of incoming data. A positive offset is relative to the beginning of incoming data of the channel buffer while negative offset is relative to their end.

Returns true if the HTTP message is full.

Returns true if the HTTP message is the response one.

Returns true if the HTTP message may still receive data.

Returns the length of outgoing data of the HTTP message.

Copies the data in front of incoming data of the HTTP message. Returns the copied length on success or -1 if data cannot be copied.

Removes length bytes of incoming data of the HTTP message, starting at offset. Returns number of bytes removed on success.

Matches the regular expression in all occurrences of header field name according to regex, and replaces them with the replace.

The replacement value can contain back references like 1, 2, … This function acts on whole header lines, regardless of the number of values they may contain.

Matches the regular expression on every comma-delimited value of header field name according to regex, and replaces them with the replace.

The replacement value can contain back references like 1, 2, …

Requires immediate send of the data. It means the data is copied at the beginning of incoming data of the HTTP message and immediately forwarded.

Because it is called in the filter context, it never yield.

Replaces length bytes of incoming data of the HTTP message, starting at offset, by the string data. Returns the copied length on success or -1 if data cannot be copied.

Sets or removes the flag that indicates end of message.

Replaces all occurrence of all header matching the name, by only one containing the value.

Rewrites the request method.

Rewrites the request path.

Rewrites the request’s query string which appears after the first question mark “?”.

Rewrites the response status code with the new status and optional reason. If no custom reason is provided, it will be generated from the status.

Rewrites the request URI.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Performs the conversion. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.