mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
sample/http-connect: made it compatible with C90
This commit is contained in:
parent
e045551558
commit
f976d4360b
@ -14,13 +14,13 @@ struct connect_base
|
|||||||
struct evhttp_uri *location;
|
struct evhttp_uri *location;
|
||||||
};
|
};
|
||||||
|
|
||||||
void get_cb(struct evhttp_request *req, void *arg)
|
static void get_cb(struct evhttp_request *req, void *arg)
|
||||||
{
|
{
|
||||||
assert(req);
|
assert(req);
|
||||||
evbuffer_write(req->input_buffer, STDOUT_FILENO);
|
evbuffer_write(req->input_buffer, STDOUT_FILENO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void connect_cb(struct evhttp_request *proxy_req, void *arg)
|
static void connect_cb(struct evhttp_request *proxy_req, void *arg)
|
||||||
{
|
{
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
|
|
||||||
@ -49,6 +49,8 @@ int main(int argc, const char **argv)
|
|||||||
struct evhttp_connection *evcon;
|
struct evhttp_connection *evcon;
|
||||||
struct evhttp_request *req;
|
struct evhttp_request *req;
|
||||||
|
|
||||||
|
struct connect_base connect_base;
|
||||||
|
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
printf("Usage: %s proxy url\n", argv[0]);
|
printf("Usage: %s proxy url\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
@ -80,7 +82,7 @@ int main(int argc, const char **argv)
|
|||||||
assert(base = event_base_new());
|
assert(base = event_base_new());
|
||||||
assert(evcon = evhttp_connection_base_new(base, NULL,
|
assert(evcon = evhttp_connection_base_new(base, NULL,
|
||||||
evhttp_uri_get_host(proxy), evhttp_uri_get_port(proxy)));
|
evhttp_uri_get_host(proxy), evhttp_uri_get_port(proxy)));
|
||||||
struct connect_base connect_base = {
|
connect_base = (struct connect_base){
|
||||||
.evcon = evcon,
|
.evcon = evcon,
|
||||||
.location = location,
|
.location = location,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user