Beispiel #1
0
/* request has been sufficiently parsed (usually, it has all headers
 * but not the body if any) to go ahead and start working.
 */
void
hwf_request_container_execute(HwfRequestContainer *request,
                              HrtTask             *request_task)
{
    HioResponseHttp *response;
    HrtBuffer *buffer;

    hrt_debug("Executing request %p in task %p", request, request_task);

    response = hio_request_http_get_response(HIO_REQUEST_HTTP(request));

    hio_response_http_send_headers(response);

    buffer = hrt_buffer_new_static_utf8_locked("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"><TITLE>HELLO WORLD</TITLE><P>This is a web page.</P>");

    hio_response_http_write(response, buffer);

    hrt_buffer_unref(buffer);

    hio_response_http_close(response);
}
Beispiel #2
0
static gboolean
on_request_completed(HrtTask        *task,
                     HrtWatcherFlags flags,
                     void           *data)
{
    HwfRequestContainer *request;
    HioResponseHttp *response;

    request = HWF_REQUEST_CONTAINER(data);

    hrt_debug("Task %p request %p completed",
              task, request);

    /* Automatically send headers and close the body,
     * if it wasn't done already.
     */
    response = hio_request_http_get_response(HIO_REQUEST_HTTP(request));

    hio_response_http_send_headers(response);
    hio_response_http_close(response);

    return FALSE;
}