On Fri, Nov 18, 2016 at 11:52 AM, 刘涛 <[email protected]> wrote: > Hi, > > I got some problem when I try to make a little bit modification on the > "https-client" sample code on libevent 2.1.7. > I built all the libraries and samples successfully on WINDOWS, and the > original https-client sample also works. > > But here comes the problem when I add a few lines of code into the sample > like this. (Find the code in the attachment please.) > > Actually, I just want to fire off a new HTTPS request on the same > evhttp_connection after receiving the prior request callback, so as to reuse > the evhttp_connection. > It works very well when I did the same thing with HTTP client function (on > libevent 2.0.*), but it doesn't work any more when I turn to HTTPS (on > libevent 2.1.*) > > And the problem is the "http_request_done" callback didn't run once the > connection is closed, until event_base_dispatch return and the process exit. > I think the "http_request_done" callback should run for each HTTPS request, > not matter succeed or failed, even a error callback. > > Any problem with my code? Or is that the bug of 2.1.7?
Hi, You forget to set "Host", and I guess that you webserver hadn't been configured to work for https without "Host" header, but http is the default so it works. Plus you shouldn't send "Connection: close" if you want to send another request over the same connection. You can take a look at modified version here: https://gist.github.com/azat/2ec7504bcbec53dab9b9bc78ff8efcdb Azat. *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
