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

Re: [Libevent-users] requests over HTTPS after server-side close



On Sat, Jan 24, 2015 at 05:33:44PM +0100, Steffen Christgau wrote:
> Hi everybody,
> 
> based on code of the https-client sample I use libevent for doing
> HTTP(S) requests in one of my applications. It receives data from
> another process (via socket using libevent as well), transforms the
> data, and issues HTTP requests based on the transformation result.
> Between multiple data receptions from the external process there's some
> random delay. In case the delay is long enough, the HTTP connection
> established by libevent is closed by the server. When using HTTP
> libevent automatically reconnects to the server as soon a new request
> has been issued. So, everything is fine.
> 
> However, when HTTPS is used, the reconnect seems not work and no request
> is performed after the server-side disconnect. I was able to reproduce
> this behavior with a modified (although somewhat ugly) version of the
> https-client example. You can find the source code in the attachment
> (don't know if attachments are welcome in this mailing list). The
> timeout in http_request_done simulates reception of data from the
> external application which causes a new HTTP request to be triggered.
> The timeout value should be chosen to let the callback be invoked after
> the server closed the connection. You can try it with example.com and a
> timeout value of 55 sec. For HTTP you will get a infinite loop of
> requests. For HTTPS only one request is performed, the connection
> closes, the timer callback is invoked and the application terminates.

Which version of libevent do you use? (If you have git commit hash --
that would be great).

I'm interesting in the next commits:
- [1] 3da84c2949cc693bb6e6a65a3b1de48af1be0483 ("bufferevent_openssl: reset
fd_is_set when setfd with -1 is called")
- [2] bc79cc5c80ee374dec0e968bc6fdf301d479e133 ("http: reset connection
  before installing retry timer (fix http retries handling)")
But if you tried 2.1.5-beta, that I guess the answer is *yes*, note
that they are required for working retries (first one for ssl only).

However event after them, there is a bug, that must be fixed (for ssl
only), I will look at this today/tomorrow.

Many thanks for test case.

> I wonder which steps are required to get the code working with HTTPS as
> it does with HTTP. From an application programmers view, I would expect
> that there should be no difference, except for the bev creation (as in
> the example).

This must be true.

Cheers,
Azat.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.