Lines Matching defs:http
90 #include "http-internal.h"
192 /* wrapper for setting the base from the http server */
375 * Create the headers needed for an HTTP request
387 evbuffer_add_printf(evcon->output_buffer, "%s %s HTTP/%d.%d\r\n",
457 * Create the headers needed for an HTTP reply
465 evbuffer_add_printf(evcon->output_buffer, "HTTP/%d.%d %d %s\r\n",
517 * Depending if this is a HTTP request or response, we might need to
643 * or an http layer error. for problems on the network
645 * For HTTP problems, we might have to send back a
1000 struct evhttp *http = evcon->http_server;
1001 TAILQ_REMOVE(&http->connections, evcon, next);
1226 if (strcmp(protocol, "HTTP/1.0") == 0) {
1229 } else if (strcmp(protocol, "HTTP/1.1") == 0) {
1251 /* Parse the first line of a HTTP request */
1284 if (strcmp(version, "HTTP/1.0") == 0) {
1287 } else if (strcmp(version, "HTTP/1.1") == 0) {
1793 * Starts an HTTP request on the provided evhttp_connection object.
1948 /* use chunked encoding for HTTP/1.1 */
2190 struct evhttp *http = arg;
2198 if ((cb = evhttp_dispatch_callback(&http->callbacks, req)) != NULL) {
2204 if (http->gencb) {
2205 (*http->gencb)(req, http->gencbarg);
2235 struct evhttp *http = arg;
2248 evhttp_get_request(http, nfd, (struct sockaddr *)&ss, addrlen);
2252 evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
2266 res = evhttp_accept_socket(http, fd);
2276 evhttp_accept_socket(struct evhttp *http, int fd)
2289 event_set(ev, fd, EV_READ | EV_PERSIST, accept_socket, http);
2290 EVHTTP_BASE_SET(http, ev);
2299 TAILQ_INSERT_TAIL(&http->sockets, bound, next);
2307 struct evhttp *http = NULL;
2309 if ((http = calloc(1, sizeof(struct evhttp))) == NULL) {
2314 http->timeout = -1;
2316 TAILQ_INIT(&http->sockets);
2317 TAILQ_INIT(&http->callbacks);
2318 TAILQ_INIT(&http->connections);
2320 return (http);
2326 struct evhttp *http = evhttp_new_object();
2328 http->base = base;
2330 return (http);
2340 struct evhttp *http = evhttp_new_object();
2342 if (evhttp_bind_socket(http, address, port) == -1) {
2343 free(http);
2347 return (http);
2351 evhttp_free(struct evhttp* http)
2359 while ((bound = TAILQ_FIRST(&http->sockets)) != NULL) {
2360 TAILQ_REMOVE(&http->sockets, bound, next);
2369 while ((evcon = TAILQ_FIRST(&http->connections)) != NULL) {
2374 while ((http_cb = TAILQ_FIRST(&http->callbacks)) != NULL) {
2375 TAILQ_REMOVE(&http->callbacks, http_cb, next);
2380 free(http);
2384 evhttp_set_timeout(struct evhttp* http, int timeout_in_secs)
2386 http->timeout = timeout_in_secs;
2390 evhttp_set_cb(struct evhttp *http, const char *uri,
2402 TAILQ_INSERT_TAIL(&http->callbacks, http_cb, next);
2406 evhttp_del_cb(struct evhttp *http, const char *uri)
2410 TAILQ_FOREACH(http_cb, &http->callbacks, next) {
2417 TAILQ_REMOVE(&http->callbacks, http_cb, next);
2425 evhttp_set_gencb(struct evhttp *http,
2428 http->gencb = cb;
2429 http->gencbarg = cbarg;
2533 struct evhttp* http,
2549 /* we need a connection object to put the http request on */
2557 evhttp_connection_set_base(evcon, http->base);
2570 struct evhttp *http = evcon->http_server;
2572 if ((req = evhttp_request_new(evhttp_handle_request, http)) == NULL)
2592 evhttp_get_request(struct evhttp *http, int fd,
2597 evcon = evhttp_get_request_connection(http, fd, sa, salen);
2602 if (http->timeout != -1)
2603 evhttp_connection_set_timeout(evcon, http->timeout);
2607 * we need to know which http server it belongs to.
2609 evcon->http_server = http;
2610 TAILQ_INSERT_TAIL(&http->connections, evcon, next);