diff options
author | wenyg <42307321+wenyg@users.noreply.github.com> | 2019-05-30 17:38:49 +0800 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2019-06-01 00:41:25 +0300 |
commit | 891dd1880fed8c5e1e98f122daeb1ae8414f6b1c (patch) | |
tree | 6bd92bcd6b4bc4d8be3e3ae83c038b9ee56d8e2a /sample | |
parent | c03dabd76aced01a9c8d253381c2ed6f3ad46b4f (diff) | |
download | libevent-891dd1880fed8c5e1e98f122daeb1ae8414f6b1c.tar.gz |
https-client: correction error checking
When connecting to a non-existent HTTPS service, the "req" is not null
but the "evhttp_request_get_response_code(req)" is zero.
Closes: #822 (cherry-picked)
Diffstat (limited to 'sample')
-rw-r--r-- | sample/https-client.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sample/https-client.c b/sample/https-client.c index 5869974f..58e449b1 100644 --- a/sample/https-client.c +++ b/sample/https-client.c @@ -53,7 +53,7 @@ http_request_done(struct evhttp_request *req, void *ctx) char buffer[256]; int nread; - if (req == NULL) { + if (!req || !evhttp_request_get_response_code(req)) { /* If req is NULL, it means an error occurred, but * sadly we are mostly left guessing what the error * might have been. We'll do our best... */ |