创建evhttp_connection对象,并设置回调函数,这里的回调函数是和连接状态相关的 structevhttp_connection*evhttp_connection_base_new(structevent_base*base,structevdns_base*dnsbase,constchar*address,unsignedshortport);voidevhttp_connection_set_closecb(structevhttp_connection*evcon,void(*)(structevhttp_connection*,...
voidevhttp_connection_set_retries(conn_t*c,intretry_max) voidevhttp_connection_set_closecb(conn_t*c,conn_closecbclosecb, void*arg) intevhttp_make_request(conn_t*c,evhttp_request*req, intcmd_type,char*uri) cdefclass__start_response: ...
evhttp_connection_set_closecb(req->evcon, on_sub_disconnect,this);evhttp_add_header(req->output_headers,"Connection","keep-alive");//evhttp_add_header(req->output_headers, "Cache-Control", "no-cache");//evhttp_add_header(req->output_headers, "Expires", "0");evhttp_add_header(req->o...
()is set as the main callback (req->cb) on newevhttp_requests inevhttp_request_new()which is called byevhttp_associate_new_request_with_connection().req->cbis called in a number of places but notably inevhttp_connection_done().evhttp_connection_done()is not called unless there is an ...
1. 通过evhttp_connection_base_new设置了bufferevent的readcd:evhttp_read_cb, writecb:evhttp_write_cb。 2. 调用bufferevent_setfd bufferevent_setfd代码如下: intbufferevent_setfd(structbufferevent *bev, evutil_socket_t fd) { union bufferevent_ctrl_data d;intres = -1; ...
1. 通过evhttp_connection_base_new设置了bufferevent的readcd:evhttp_read_cb, writecb:evhttp_write_cb。 2. 调用bufferevent_setfd bufferevent_setfd代码如下: intbufferevent_setfd(structbufferevent *bev, evutil_socket_t fd) { union bufferevent_ctrl_data d;intres = -1; ...
voidreply_chunk_resched_cb(evutil_socket_tfd,shortevents,void*arg) {structconn_ctx*cctx=ctx;reply_chunk_cb(cctx->conn,ctx); }voidreply_chunk_cb(structevhttp_connection*conn,void*ctx) {structconn_ctx*cctx=ctx;structbufferevent*bev=evhttp_connection_get_bufferevent(conn->conn);structevent_base...
fd = http_connect("127.0.0.1", port);/* Stupid thing to send a request */bev = bufferevent_new(fd, http_readcb, http_writecb, http_errorcb,NULL); bufferevent_base_set(base, bev); http_request ="GET /test HTTP/1.1\r\n""Host: somehost\r\n""Connection: close\r\n""\r\n"; ...
/* Will always return -1 to make evhttp close the connection - we only need the http headers */staticintscan_icy_header_cb(struct evhttp_request *req,void*arg){structmedia_file_info*mfi;constchar*ptr; mfi = (struct media_file_info *)arg;if( (ptr =evhttp_find_header(req->input_head...