[view source]
int cp_http_init();
int cp_http_stop_all();
void cp_http_shutdown();
cp_httpsocket *cp_httpsocket_create(int port,
cp_http_service_callback service);
cp_httpsocket *
cp_httpsocket_create_ssl(int port,
cp_http_service_callback service
char *certificate_file,
char *key_file,
int verification_mode);
void cp_httpsocket_delete(cp_httpsocket *sock);
int cp_httpsocket_listen(cp_httpsocket *sock);
int cp_httpsocket_register_service(cp_httpsocket *server,
cp_http_service *service);
void *cp_httpsocket_unregister_service(cp_httpsocket *server,
cp_http_service *service);
void cp_httpsocket_set_keepalive(cp_httpsocket *socket, int sec);
void cp_httpsocket_set_server_name(cp_httpsocket *socket, char *name);
void cp_httpsocket_set_backlog(cp_socket *sock, int backlog);
void cp_httpsocket_set_delay(cp_socket *sock, struct timeval delay);
void cp_httpsocket_set_delay_sec(cp_socket *sock, long sec);
void cp_httpsocket_set_delay_usec(cp_socket *sock, long usec);
void cp_httpsocket_set_poolsize_min(cp_socket *sock, int min);
void cp_httpsocket_set_poolsize_max(cp_socket *sock, int max);
To listen on a port, first instantiate a server socket by calling cp_httpsocket_create. The cp_httpsocket struct is a wrapper for a cp_socket backed by a thread pool to serve simultaneous requests. The service parameter defines the default cp_http_service(3). The action to be taken in response to a request for a given uri prefix is defined by means of a service. If no default service is set, the framework returns an error 501 (NOT IMPLEMENTED) page for unhandled uris. Otherwise services may be registered per uri with cp_httpsocket_register_service. Services may be removed by calling cp_httpsocket_unregister_service.
Call cp_httpsocket_listen to activate the socket. Services may still be registered after this call.
If libcprops was configured with --enable-ssl (default), SSL features are available on sockets created with cp_httpsocket_create_ssl, which requires the path to a certificate_file and a key_file as well. The verification_method may be one of SSL_VERIFY_NONE or SSL_VERIFY_PEER, optionally modified with SSL_VERIFY_FAIL_IF_NO_PEER_CERT and / or SSL_VERIFY_CLIENT_ONCE - see SSL_CTX_set_verify(3).
This document was created by
man2html,
using the manual pages. Time: 21:26:15 GMT, January 30, 2006 |