QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Enumerations | Functions | Variables
protocols_http.h File Reference

Provides support for HTTP long polling. More...

#include "quickio.h"

Go to the source code of this file.

Macros

#define HTTP_NOCACHE
 Completely disables caching for HTTP requests. More...
 
#define HTTP_COMMON
 Headers that are common to each response. More...
 

Enumerations

enum  http_close_reasons { HTTP_DONE = 2000, HTTP_NO_SURROGATE, HTTP_BAD_REQUEST, HTTP_LENGTH_REQUIRED }
 Extends the reasons for closing a client. More...
 

Functions

void protocol_http_init ()
 Sets up everything to run.
 
enum protocol_handles protocol_http_handles (struct client *client)
 If the client really wants to HTTP Poll.
 
enum protocol_status protocol_http_route (struct client *client, gsize *used)
 Routes the data received from a client.
 
void protocol_http_heartbeat (struct client *client, const struct protocol_heartbeat *hb)
 Sends a heartbeat to a client.
 
struct protocol_frames protocol_http_frame (const gchar *ev_path, const gchar *ev_extra, const evs_cb_t server_cb, const gchar *json)
 Frames data to send out to a client. More...
 
void protocol_http_send (struct client *client, const struct protocol_frames *pframes)
 HTTP uses surrogates, so it has its own sending mechanisms to make sure messages are routed to the right clients.
 
void protocol_http_close (struct client *client, guint reason)
 Terminates all communications with the client.
 

Variables

struct protocolprotocol_http
 This protocol's functions.
 

Detailed Description

Provides support for HTTP long polling.

Author
Andrew Stone andre.nosp@m.w@cl.nosp@m.ovar..nosp@m.com

Macro Definition Documentation

#define HTTP_COMMON
Value:
"Connection: Keep-Alive\r\n" \
"Keep-Alive: timeout=60\r\n"
#define HTTP_NOCACHE
Completely disables caching for HTTP requests.
Definition: protocols_http.h:18

Headers that are common to each response.

#define HTTP_NOCACHE
Value:
"Cache-Control: private, max-age=0\r\n" \
"Expires: -1\r\n"

Completely disables caching for HTTP requests.

Enumeration Type Documentation

Extends the reasons for closing a client.

Enumerator
HTTP_DONE 

Client closed according to the HTTP standard.

HTTP_NO_SURROGATE 

No surrogate was found for the client.

That's a 403.

HTTP_BAD_REQUEST 

Sometimes was woefully wrong with the request.

HTTP_LENGTH_REQUIRED 

Client didn't send length.

Function Documentation

struct protocol_frames protocol_http_frame ( const gchar *  ev_path,
const gchar *  ev_extra,
const evs_cb_t  server_cb,
const gchar *  json 
)

Frames data to send out to a client.

Returns
A buffer containing the frame. [transfer-full]