7 #define min(x, y) (((x) < (y)) ? (x) : (y))
8 #define max(x, y) (((x) > (y)) ? (x) : (y))
10 #define array_size(x) \
11 (sizeof(x) / sizeof(x[0]))
13 #define foreach_header(i, h) \
14 for( i = 0; (i + 1) < (sizeof(h) / sizeof(h[0])) && h[i]; i += 2 )
27 const char * sa_straddr(void *sa);
28 const char * sa_strport(void *sa);
29 int sa_port(void *sa);
31 char *strfind(char *haystack, int hslen, const char *needle, int ndlen);
33 int uh_tcp_send(struct client *cl, const char *buf, int len);
34 int uh_tcp_peek(struct client *cl, char *buf, int len);
35 int uh_tcp_recv(struct client *cl, char *buf, int len);
37 int uh_http_sendhf(struct client *cl, int code, const char *summary, const char *fmt, ...);
39 #define uh_http_response(cl, code, message) \
40 uh_http_sendhf(cl, code, message, message)
42 int uh_http_sendc(struct client *cl, const char *data, int len);
45 struct client *cl, struct http_request *req,
50 struct client *cl, struct http_request *req,
51 const char *buf, int len
55 int uh_urldecode(char *buf, int blen, const char *src, int slen);
56 int uh_urlencode(char *buf, int blen, const char *src, int slen);
57 int uh_path_normalize(char *buf, int blen, const char *src, int slen);
59 struct uh_path_info * uh_path_lookup(struct client *cl, const char *url);
61 struct listener * uh_listener_add(int sock, struct config *conf);
62 struct listener * uh_listener_lookup(int sock);
64 struct client * uh_client_add(int sock, struct listener *serv);
65 struct client * uh_client_lookup(int sock);
66 void uh_client_remove(int sock);