|<B>urlB>||This method returns the URL of the current request as URI object.|
$res can be:
Here is an example:
For longer responses you can give a callback instead of a string to the response function for the value of the $content.
The given callback will receive as first argument either another callback ($data_cb in the above example) or an undefined value, which means that there is no more data required and the transfer has been completed (either by you sending no more data, or by a disconnect of the client).
The callback given to respond will be called whenever the send queue of the HTTP connection becomes empty (meaning that the data is written out to the kernel). If it is called you have to start delivering the next chunk of data.
That doesnt have to be immediately, before the callback returns. This means that you can initiate for instance an IO::AIO request (see also AnyEvent::AIO) and send the data later. That is what the $data_cb callback is for. You have to call it once you got the next chunk of data. Once you sent a chunk of data via $data_cb you can just wait until your callback is called again to deliver the next chunk.
If you are done transferring all data call the $data_cb with an empty string or with no argument at all.
Please consult the example script large_response_example from the samples/ directory of the AnyEvent::HTTPD distribution for an example of how to use this mechanism.
<B>NOTE:B> You should supply a Content-Length header if you are going to send a larger file. If you dont do that the client will have no chance to know if the transfer was complete. To supply additional header fields the hash argument format will not work. You should use the array argument format for this case.
|<B>respondedB>||Returns true if this request already has been responded to.|
|<B>parm ($key)B>||Returns the first value of the form parameter $key or undef.|
|<B>paramsB>||Returns list of parameter names.|
|<B>varsB>||Returns a hash of form parameters. The value is either the value of the parameter, and in case there are multiple values present it will contain an array reference of values.|
|<B>methodB>||This method returns the method of the current request.|
|<B>contentB>||Returns the request content or undef if only parameters for a form were transmitted.|
|<B>headersB>||This method will return a hash reference containing the HTTP headers for this HTTP request.|
|<B>client_hostB>||This method returns the host/IP of the HTTP client this request was received from.|
|<B>client_portB>||This method returns the TCP port number of the HTTP client this request was received from.|
Copyright 2008-2011 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||ANYEVENT::HTTPD::REQUEST (3)||2011-08-04|