cp_socket

Section: cp_socket (3)
Updated: OCTOBER 2005
Index Return to Main Contents
 

NAME

cp_http_response - http response descriptor  

SYNOPSIS

#include <cprops/http.h>

cp_http_status_code
      cp_http_response_set_status(cp_http_response *response,
                                  cp_http_status_code status);

cp_http_content_type
      cp_http_response_set_content_type(cp_http_response *response,
                                        cp_http_content_type type);

void cp_http_response_set_content_type_string
           (cp_http_response *response, char *content_type_lit);

void *cp_http_response_set_header(cp_http_response *response,
                                   char *name, char *value);

char *cp_http_response_set_body(cp_http_response *response,
                                 char *body);

void cp_http_response_set_content(cp_http_response *response,
                                   cp_string *content);

void cp_http_response_set_connection_policy(cp_http_response *response,
                                             connection_policy policy);

int cp_http_response_set_cookie(cp_http_response *response,
                                 char *name, char *content, char *host,
                                 char *path, long validity, int secure);  

DESCRIPTION

Connections accepted by a cp_httpsocket are delegated to a cp_http_service handler with a pre-allocated cp_http_response struct to wrap the request response.

cp_http_response_set_status sets the status code of the response. For a list of status codes and their usage see RFC 2616.

cp_http_response_set_content_type sets the Content-Type header with the specified cp_http_content_type code. cp_http_response_set_content_type_string allows setting an arbitrary string to be written as "Content-Type".

cp_response_set_header sets the header name to the value value.

cp_response_set_body sets the content of the response body to the null terminated string body. cp_http_response_set_content accepts a cp_string(3) parameter allowing binary content, and overrides cp_response_set_body.

cp_http_response_set_connection_policy sets the "Connection" header to "Close" or "Keep-Alive", or to the default for the http version specified by the request.

If configured with support for cookies, cp_http_response_set_cookie adds a "Set-Cookie" header with the speicifed attributes.  

SEE ALSO

cp_http_service(3), cp_http_request(3), cp_httpsocket(3), RFC 2616


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 21:26:15 GMT, January 30, 2006
SourceForge.net Logo