码迷,mamicode.com
首页 > Web开发 > 详细

libevent(十)evhttp

时间:2017-05-22 13:29:35      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:void   com   listener   UI   ade   url   pcb   ack   not   

用libevent构建一个http server非常方便,可参考libevent(七)http server

主要涉及的一个结构体是 evhttp:

struct evhttp {
    /* Next vhost, if this is a vhost. */
    TAILQ_ENTRY(evhttp) next_vhost;

    /* All listeners for this host */
    TAILQ_HEAD(boundq, evhttp_bound_socket) sockets;

    TAILQ_HEAD(httpcbq, evhttp_cb) callbacks;

    /* All live connections on this host. */
    struct evconq connections;

    TAILQ_HEAD(vhostsq, evhttp) virtualhosts;

    TAILQ_HEAD(aliasq, evhttp_server_alias) aliases;

    /* NULL if this server is not a vhost */
    char *vhost_pattern;

    int timeout;

    size_t default_max_headers_size;
    ev_uint64_t default_max_body_size;

    /* Bitmask of all HTTP methods that we accept and pass to user
     * callbacks. */
    ev_uint16_t allowed_methods;

    /* Fallback callback if all the other callbacks for this connection
       don‘t match. */
    void (*gencb)(struct evhttp_request *req, void *);
    void *gencbarg;

    struct event_base *base;
};

 

libevent(十)evhttp

标签:void   com   listener   UI   ade   url   pcb   ack   not   

原文地址:http://www.cnblogs.com/gattaca/p/6888838.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!