|
|
|
NAME
http_pipe_in_progress()
LIBRARY
Caudiumlib.
SYNOPSIS inherit "caudiumlib"; mapping http_pipe_in_progress(); DESCRIPTION
Returns a response mapping that tells Caudium that this request
is in progress and that sending of data, closing the connection
and such will be handled by the module or the caller of
http_pipe_in_progress(). If this is used and you fail
to close connection correctly, FD leaking will be the result.
RETURNS
The HTTP response mapping in the form :
([
"file": -1,
"pipe": 1,
]);
EXAMPLE
This can be used in a simple pikescript. But adding this in
a module is allmost the same in fact.
inherit "caudiumlib"; string|mapping|object parse( object id ) { id->my_fd->write(id->clientprot + " 200 Ok\r\n"); id->my_fd->write("Server: Caudium !\r\n"); id->my_fd->write("Expires: 0\r\n"); id->my_fd->write("Content-Type: text/html\r\n"); id->my_fd->write("pragma: no-cache\r\n\r\n"); id->my_fd->set_id( ({ id->my_fd }) ); id->my_fd->set_nonblocking(0,send_data); return http_pipe_in_progress(); } void send_data(array (object) id) { id[0]->write("<pre>"); id[0]->write("test......................\n"); id[0]->write("test......................\n"); id[0]->write("test......................\n"); id[0]->write("sleep for 10 sec\n"); sleep(10); id[0]->write("Done</pre>"); id[0]->close(); destruct(id[0]); }Note: don't use sleep() in real world, on Pike < 7.2 this is a blocking call... |
|
Copyright © 2000 - 2005
The Caudium Group
All Rights Reserved. Hosting by Kazar.
|
|