0

I implemented an http client using libevent's http.h but I have some bug when trying to make-http request. What's more strange is that bug doesn't always happen when downloading files.

I used evhttp_request_new and evhttp_request_free and evhttp_request_new has a callback parameter, which the documentation states "The callback is executed when the request completed or an error occurred." What does it mean by error occurred and how do I check whether there is an error or not?

BLaZuRE
  • 2,356
  • 2
  • 26
  • 43

2 Answers2

0

Based on the source code and documentation I found on the matter, you are given an argument of type evhttp_request *. If you look through the linked pages, you will see members such as response_code, which should give you a good idea. Here is a related question if the documentation is too raw for you.

All of this information I just gathered by Googling, and am in no way knowledgeable about this.

Community
  • 1
  • 1
BLaZuRE
  • 2,356
  • 2
  • 26
  • 43
0

This isn't necessarily a complete answer to your question, but I ran into similar issues with error handling in evhttp. My post there traces through what happens during an error. (Or at least during my error; yours might be different.) The frustrating thing is that it calls back your callback with NULL. So that's how you can tell there's an error, but it doesn't make much information available about what the error was. Looking at errno might or might not help.

user2666524
  • 371
  • 1
  • 3
  • 7