There are a few ways to change the response sent. We could change the header values with the handle_response_header callback
, change where the response content comes from by using handle_read_response_content
or change the response while it is sent out with the handle_filter_response_content
callback.
Note that it is not absolutely necessary to use one of the callbacks to send out content. For example, mod_flv_streaming
, which sends out the headers for an embedded flash video stream, does so by intercepting the handle_physical
callback.
Writing a response is as easy as getting a buffer from the send chunkqueue
, and then messing with the buffer contents. Some very useful functions to do this are defined in buffer.h
. We could for example do the following:
/* Get output buffer */ buffer *out = chunkqueue_get_append_buffer(con->send); /* Define some helpful variables */ buffer *some_other_buffer = get_some_buffer(); char *some_string = get_some_string(); /* Start out...