neuray API Programmer's Manual

mi::http::IRequest Class Reference

[HTTP server]

Description

This interface holds all the parameters of a request.

Note:
  • A pointer to an mi::http::IRequest interface is only valid as long as the mi::http::IConnection interface from which it was obtained is valid. The same is true for all strings obtained from the request. Overwriting such a string using the supplied functions will invalidate the obtained string.

  • This interface is not derived from mi::base::IInterface. As one consequence, there are no retain() and release() methods, and the interface cannot be used together with the mi::base::Handle class.

Public Member Functions

virtual void add_argument( const char* key, const char* value) =0
Adds an argument to the request. More...
virtual const char* get_argument( const char* key) const =0
Returns an argument from the request. More...
virtual bool  get_argument( Size index, const char** key_pointer, const char** value_pointer) const =0
Returns the argument with the given index. More...
virtual const char* get_body() const =0
Returns the body string. More...
virtual const char* get_command() const =0
Returns the command of the request.
virtual const char* get_header( const char* key) const =0
Returns a header from the request. More...
virtual bool  get_header( Size index, const char** key_pointer, const char** value_pointer) const =0
Returns the header with the given index. More...
virtual const char* get_protocol() const =0
Returns the protocol of the request.
virtual const char* get_request_line() const =0
Returns the request line of the request.
virtual const char* get_url() const =0
Returns the URL of the request.
virtual void remove_argument( const char* key) =0
Removes an argument from the request. More...
virtual void remove_header( const char* key) =0
Removes a header from the request. More...
virtual void set_argument( const char* key, const char* value) =0
Changes an argument of the request or adds an argument to the request. More...
virtual void set_header( const char* key, const char* value) =0
Changes an existing header of the request or adds a new header to the request. More...
virtual void set_url( const char* url) =0
Sets the URL of the request. More...

Member Functions

virtual void mi::​http::​IRequest::add_argument( const char* key, const char* value) [pure virtual]

Adds an argument to the request. This method does not overwrite an argument with the same key but always adds a new one.

Parameters

key
The key of the argument.
value
The value of the argument.
virtual const char* mi::​http::​IRequest::get_argument( const char* key) const [pure virtual]

Returns an argument from the request. Note that multiple arguments with the same key can occur in a request and this method will only return the first of them. Consider using get_argument(Size,const char**, const char**) if all arguments matching a particular key are desired.

Parameters

key
The key of the argument.
virtual bool mi::​http::​IRequest::get_argument( Size index, const char** key_pointer, const char** value_pointer) const [pure virtual]

Returns the argument with the given index. Can be used for iterating over all arguments by starting with index equal to 0 and then incrementing until false is returned. When false is returned, key_pointer and value_pointer will not be written.

Parameters

index
The index of the argument.
key_pointer
A pointer to the argument's key.
value_pointer
A pointer to the argument's value.

Returns

true , if there is a header for given index, false otherwise.

virtual const char* mi::​http::​IRequest::get_body() const [pure virtual]

Returns the body string.

Returns

The body, or NULL if there is no body.

virtual const char* mi::​http::​IRequest::get_command() const [pure virtual]

Returns the command of the request.

virtual const char* mi::​http::​IRequest::get_header( const char* key) const [pure virtual]

Returns a header from the request.

Parameters

key
The key of the header.

Returns

The value of the header, or NULL if the header was not found.

virtual bool mi::​http::​IRequest::get_header( Size index, const char** key_pointer, const char** value_pointer) const [pure virtual]

Returns the header with the given index. Can be used for iterating over all headers by starting with index equal to 0 and then incrementing index until false is returned. When false is returned, key_pointer and value_pointer will not be written.

Parameters

index
The index of the header.
key_pointer
A pointer to the header's key.
value_pointer
A pointer to the header's value.

Returns

true , if there is a header for given index, false otherwise.

virtual const char* mi::​http::​IRequest::get_protocol() const [pure virtual]

Returns the protocol of the request.

virtual const char* mi::​http::​IRequest::get_request_line() const [pure virtual]

Returns the request line of the request.

virtual const char* mi::​http::​IRequest::get_url() const [pure virtual]

Returns the URL of the request.

virtual void mi::​http::​IRequest::remove_argument( const char* key) [pure virtual]

Removes an argument from the request. This method removes all arguments with the given key.

Parameters

key
The key of the argument.
virtual void mi::​http::​IRequest::remove_header( const char* key) [pure virtual]

Removes a header from the request.

Parameters

key
The key of the header.
virtual void mi::​http::​IRequest::set_argument( const char* key, const char* value) [pure virtual]

Changes an argument of the request or adds an argument to the request. If one or more arguments with the same key are present the first argument with this key will be changed.

Parameters

key
The key of the argument.
value
The value of the argument.
virtual void mi::​http::​IRequest::set_header( const char* key, const char* value) [pure virtual]

Changes an existing header of the request or adds a new header to the request.

Parameters

key
The key of the header.
value
The value of the header.
virtual void mi::​http::​IRequest::set_url( const char* url) [pure virtual]

Sets the URL of the request.

Parameters

url
The new URL to be set.