mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
http-connect: exit on error
This commit is contained in:
parent
15da23cfdb
commit
d22e12eefa
@ -11,6 +11,7 @@
|
||||
#define VERIFY(cond) do { \
|
||||
if (!(cond)) { \
|
||||
fprintf(stderr, "[error] %s\n", #cond); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
} while (0); \
|
||||
|
||||
@ -26,8 +27,11 @@ static void get_cb(struct evhttp_request *req, void *arg)
|
||||
{
|
||||
ev_ssize_t len;
|
||||
struct evbuffer *evbuf;
|
||||
struct evhttp_connection *evcon;
|
||||
|
||||
VERIFY(req);
|
||||
evcon = evhttp_request_get_connection(req);
|
||||
VERIFY(evcon);
|
||||
|
||||
evbuf = evhttp_request_get_input_buffer(req);
|
||||
len = evbuffer_get_length(evbuf);
|
||||
@ -72,7 +76,7 @@ int main(int argc, const char **argv)
|
||||
}
|
||||
|
||||
{
|
||||
proxy = evhttp_uri_parse(argv[1]);
|
||||
VERIFY(proxy = evhttp_uri_parse(argv[1]));
|
||||
VERIFY(evhttp_uri_get_host(proxy));
|
||||
VERIFY(evhttp_uri_get_port(proxy) > 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user