[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re:Re: [Libevent-users] https-client sample problem on libevent 2.1.7



Hi,

I've tried the advice about the output headers (host & connection:close), after that I can make several request on the same connection,  but the problem is still the same once the server side response with "Connection:Close".

I also captured the network packets between client(172.19.10.40) and my HTTPS web server(10.206.0.46) with wireshark, please find "https.pcap" in the attachment, the last few packets of which shows the client who send the FIN  just after successfully reconnected to the server, even not yet did any HTTPS handshake.

So I think probably it is the problem of client. 

I'm trying to dug deep into the bufferevent_ssl layer to track the problem, any body can help?


At 2016-11-19 01:21:44, "Azat Khuzhin" <a3at.mail@xxxxxxxxx> wrote: >On Fri, Nov 18, 2016 at 11:52 AM, 刘涛 <liutao74748@xxxxxxx> 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 majordomo@xxxxxxxxxxxxx with >unsubscribe libevent-users in the body.


 

Attachment: https.pcap
Description: Binary data