首页 > Web开发 > 详细

libevent(十)evhttp

时间:2017-05-22 12:42:51      阅读:384      评论:0      收藏:0      [点我收藏+]

用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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!