Manouchehri / serf

High-performance asynchronous HTTP client library
https://code.google.com/p/serf
Apache License 2.0
0 stars 0 forks source link

SSL Client authentication produces connection resets #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install an apache2 httpd and configure it for client auth, e.g. use a self 
signed cert and sign user certs with it
2. Setup svn on said server via mod_dav_svn to be accessible via client auth
3. Use svn version >=1.8 with any libserf and receive the following errors
svn: E120108: Unable to connect to a repository at URL 
'https://example.com/svn/testrepo'
svn: E120108: Error running context: The server unexpectedly closed the 
connection.

What is the expected output? What do you see instead?
The command should produce a listing of the repository content; e.g. with svn 
1.7.11 and libneon:
/usr/bin/svn ls https://example.com/svn/testrepos
README

What version of the product are you using? On what operating system?
Used versions of libserv 1.1,1.2,1.3 on Debian Wheezy with Openssl 1.0.1e
I also tried using different versions of Openssl but so far libserf compiled 
with both 0.9.8k and 0.9.8o produced the same output.
Also to compile the libserf is used these packages from debian wheezy:

libaprutil1-dev v 1.3.12
libapr1-dev v 1.4.6
libssl-dev 1.0.1

The apache server with mod_dav_svn is also a debian wheezy with apache2 v 
2.2.22 and openssl 1.0.1e

Please provide any additional information below.
As recommended on the users@subversion.apache.org maillinglist I tried 
recompiling libserf 1.3 with debug flags enabled. Here is the output I received:

[2013-07-25T19:28:25.869637+02] outgoing.c: created connection 0xb750f018
[2013-07-25T19:28:25.869949+02] outgoing.c: created socket for conn
0xb750f018, status 0
[2013-07-25T19:28:25.870036+02] [l:<myip>:37685 r:<serverip>:443]
outgoing.c: connected socket for conn 0xb750f018, status 115
[2013-07-25T19:28:25.877722+02] buckets/ssl_buckets.c: ssl_encrypt:
begin 8000
[2013-07-25T19:28:25.877819+02] buckets/ssl_buckets.c: ssl_encrypt:
bucket read 521 bytes; status 0
[2013-07-25T19:28:25.877982+02] buckets/ssl_buckets.c:
SSL_connect:before/connect initialization
[2013-07-25T19:28:25.878043+02] buckets/ssl_buckets.c: bio_bucket_write
called for 260 bytes
[2013-07-25T19:28:25.878073+02] buckets/ssl_buckets.c:
SSL_connect:unknown state
[2013-07-25T19:28:25.878092+02] buckets/ssl_buckets.c: bio_bucket_read
called for 7 bytes
[2013-07-25T19:28:25.878106+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.878123+02] buckets/ssl_buckets.c: SSL_connect:error
in unknown state
[2013-07-25T19:28:25.878137+02] buckets/ssl_buckets.c: ssl_encrypt: SSL
write: -1
[2013-07-25T19:28:25.878164+02] buckets/ssl_buckets.c: ssl_encrypt: SSL
write error: 2
[2013-07-25T19:28:25.878178+02] buckets/ssl_buckets.c: ssl_encrypt: SSL
write error: 120103 0
[2013-07-25T19:28:25.878192+02] buckets/ssl_buckets.c: ssl_encrypt read
agg: 120103 70014 0 260
[2013-07-25T19:28:25.878206+02] buckets/ssl_buckets.c: ssl_encrypt
finished: 120103 260 (8 1 9)
[2013-07-25T19:28:25.927760+02] buckets/ssl_buckets.c: ssl_decrypt:
begin 8000
[2013-07-25T19:28:25.927798+02] buckets/ssl_buckets.c: bio_bucket_read
called for 7 bytes
[2013-07-25T19:28:25.927813+02] buckets/ssl_buckets.c: bio_bucket_read
waiting: (8 1 9)
[2013-07-25T19:28:25.927831+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.927845+02] buckets/ssl_buckets.c: SSL_connect:error
in unknown state
[2013-07-25T19:28:25.927886+02] buckets/ssl_buckets.c: ssl_decrypt: read
2896 bytes (8000); status: 0
[2013-07-25T19:28:25.927924+02] buckets/ssl_buckets.c: bio_bucket_read
called for 7 bytes
[2013-07-25T19:28:25.927940+02] buckets/ssl_buckets.c: bio_bucket_read
waiting: (8 1 9)
[2013-07-25T19:28:25.927954+02] buckets/ssl_buckets.c: bio_bucket_read
received 7 bytes (0)
[2013-07-25T19:28:25.928050+02] buckets/ssl_buckets.c: bio_bucket_read
called for 60 bytes
[2013-07-25T19:28:25.928067+02] buckets/ssl_buckets.c: bio_bucket_read
received 60 bytes (0)
[2013-07-25T19:28:25.928158+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
read server hello A
[2013-07-25T19:28:25.928176+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.928190+02] buckets/ssl_buckets.c: bio_bucket_read
received 5 bytes (0)
[2013-07-25T19:28:25.928204+02] buckets/ssl_buckets.c: bio_bucket_read
called for 7081 bytes
[2013-07-25T19:28:25.928217+02] buckets/ssl_buckets.c: bio_bucket_read
received 2824 bytes (70014)
[2013-07-25T19:28:25.928242+02] buckets/ssl_buckets.c: bio_bucket_read
called for 4257 bytes
[2013-07-25T19:28:25.928262+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.928277+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server certificate A
[2013-07-25T19:28:25.928290+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server certificate A
[2013-07-25T19:28:25.928307+02] buckets/ssl_buckets.c: ssl_decrypt: 11 0 9
[2013-07-25T19:28:25.928353+02] buckets/ssl_buckets.c: ssl_decrypt:
begin 8000
[2013-07-25T19:28:25.928379+02] buckets/ssl_buckets.c: bio_bucket_read
called for 4257 bytes
[2013-07-25T19:28:25.928394+02] buckets/ssl_buckets.c: bio_bucket_read
waiting: (8 1 9)
[2013-07-25T19:28:25.928408+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.928422+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server certificate A
[2013-07-25T19:28:25.928458+02] buckets/ssl_buckets.c: ssl_decrypt: read
6352 bytes (8000); status: 0
[2013-07-25T19:28:25.928496+02] buckets/ssl_buckets.c: bio_bucket_read
called for 4257 bytes
[2013-07-25T19:28:25.928511+02] buckets/ssl_buckets.c: bio_bucket_read
waiting: (8 1 9)
[2013-07-25T19:28:25.928527+02] buckets/ssl_buckets.c: bio_bucket_read
received 4257 bytes (0)
[2013-07-25T19:28:25.939164+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
read server certificate A
[2013-07-25T19:28:25.939210+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.939227+02] buckets/ssl_buckets.c: bio_bucket_read
received 5 bytes (0)
[2013-07-25T19:28:25.939242+02] buckets/ssl_buckets.c: bio_bucket_read
called for 781 bytes
[2013-07-25T19:28:25.939256+02] buckets/ssl_buckets.c: bio_bucket_read
received 781 bytes (0)
[2013-07-25T19:28:25.942208+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
read server key exchange A
[2013-07-25T19:28:25.942231+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.942245+02] buckets/ssl_buckets.c: bio_bucket_read
received 5 bytes (0)
[2013-07-25T19:28:25.942259+02] buckets/ssl_buckets.c: bio_bucket_read
called for 1304 bytes
[2013-07-25T19:28:25.942272+02] buckets/ssl_buckets.c: bio_bucket_read
received 1304 bytes (70014)
[2013-07-25T19:28:25.942889+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
read server certificate request A
[2013-07-25T19:28:25.942912+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
read server done A
[2013-07-25T19:28:25.942975+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
write client certificate A
[2013-07-25T19:28:25.966978+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
write client key exchange A
[2013-07-25T19:28:25.967410+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
write change cipher spec A
[2013-07-25T19:28:25.967574+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
write finished A
[2013-07-25T19:28:25.967597+02] buckets/ssl_buckets.c: bio_bucket_write
called for 226 bytes
[2013-07-25T19:28:25.967618+02] buckets/ssl_buckets.c: bio_bucket_write
waiting: (0 0 0)
[2013-07-25T19:28:25.967642+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
flush data
[2013-07-25T19:28:25.967658+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.967677+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.967697+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server session ticket A
[2013-07-25T19:28:25.967719+02] buckets/ssl_buckets.c: ssl_decrypt: 11 0 9
[2013-07-25T19:28:25.967786+02] buckets/ssl_buckets.c: ssl_encrypt:
begin 8000
[2013-07-25T19:28:25.967809+02] buckets/ssl_buckets.c: ssl_encrypt: 0
226 9 (quick read)
[2013-07-25T19:28:25.967853+02] buckets/ssl_buckets.c: ssl_encrypt:
begin 8000
[2013-07-25T19:28:25.967876+02] buckets/ssl_buckets.c: ssl_encrypt:
reset 70014 120103 (8 1 9)
[2013-07-25T19:28:25.967907+02] buckets/ssl_buckets.c: ssl_encrypt:
bucket read 521 bytes; status 11
[2013-07-25T19:28:25.967940+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.967961+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.967979+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server session ticket A
[2013-07-25T19:28:25.967995+02] buckets/ssl_buckets.c: ssl_encrypt: SSL
write: -1
[2013-07-25T19:28:25.968014+02] buckets/ssl_buckets.c: ssl_encrypt: SSL
write error: 2
[2013-07-25T19:28:25.968034+02] buckets/ssl_buckets.c: ssl_encrypt: SSL
write error: 120103 0
[2013-07-25T19:28:25.968052+02] buckets/ssl_buckets.c: ssl_encrypt read
agg: 120103 70014 11 0
[2013-07-25T19:28:25.968072+02] buckets/ssl_buckets.c: ssl_encrypt
finished: 120103 0 (8 1 9)
[2013-07-25T19:28:25.972533+02] buckets/ssl_buckets.c: ssl_decrypt:
begin 8000
[2013-07-25T19:28:25.972631+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.972655+02] buckets/ssl_buckets.c: bio_bucket_read
waiting: (8 1 9)
[2013-07-25T19:28:25.972672+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.972692+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server session ticket A
[2013-07-25T19:28:25.972725+02] buckets/ssl_buckets.c: ssl_decrypt: read
314 bytes (8000); status: 0
[2013-07-25T19:28:25.972754+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.972774+02] buckets/ssl_buckets.c: bio_bucket_read
waiting: (8 1 9)
[2013-07-25T19:28:25.972797+02] buckets/ssl_buckets.c: bio_bucket_read
received 5 bytes (0)
[2013-07-25T19:28:25.972817+02] buckets/ssl_buckets.c: bio_bucket_read
called for 234 bytes
[2013-07-25T19:28:25.972835+02] buckets/ssl_buckets.c: bio_bucket_read
received 234 bytes (0)
[2013-07-25T19:28:25.972900+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
read server session ticket A
[2013-07-25T19:28:25.972921+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.972939+02] buckets/ssl_buckets.c: bio_bucket_read
received 5 bytes (0)
[2013-07-25T19:28:25.972957+02] buckets/ssl_buckets.c: bio_bucket_read
called for 1 bytes
[2013-07-25T19:28:25.972975+02] buckets/ssl_buckets.c: bio_bucket_read
received 1 bytes (0)
[2013-07-25T19:28:25.973130+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.973150+02] buckets/ssl_buckets.c: bio_bucket_read
received 5 bytes (0)
[2013-07-25T19:28:25.973168+02] buckets/ssl_buckets.c: bio_bucket_read
called for 64 bytes
[2013-07-25T19:28:25.973185+02] buckets/ssl_buckets.c: bio_bucket_read
received 64 bytes (70014)
[2013-07-25T19:28:25.973367+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
read finished A
[2013-07-25T19:28:25.973424+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.973447+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.973469+02] buckets/ssl_buckets.c: ssl_decrypt: 11 0 9
[2013-07-25T19:28:25.973492+02] buckets/ssl_buckets.c: ssl_decrypt:
begin 8000
[2013-07-25T19:28:25.973511+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.973529+02] buckets/ssl_buckets.c: bio_bucket_read
waiting: (8 1 9)
[2013-07-25T19:28:25.973547+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.973570+02] buckets/ssl_buckets.c: ssl_decrypt: 11 0 9
[2013-07-25T19:28:25.973623+02] buckets/ssl_buckets.c: ssl_encrypt:
begin 8000
[2013-07-25T19:28:25.973643+02] buckets/ssl_buckets.c: ssl_encrypt:
reset 70014 120103 (8 1 9)
[2013-07-25T19:28:25.973671+02] buckets/ssl_buckets.c: ssl_encrypt:
bucket read 521 bytes; status 11
[2013-07-25T19:28:25.973743+02] buckets/ssl_buckets.c: bio_bucket_write
called for 565 bytes
[2013-07-25T19:28:25.973765+02] buckets/ssl_buckets.c: ssl_encrypt: SSL
write: 521
[2013-07-25T19:28:25.973785+02] buckets/ssl_buckets.c: ssl_encrypt read
agg: 11 70014 11 565
[2013-07-25T19:28:25.973805+02] buckets/ssl_buckets.c: ssl_encrypt
finished: 11 565 (8 1 9)
[2013-07-25T19:28:25.976733+02] buckets/ssl_buckets.c: ssl_decrypt:
begin 8000
[2013-07-25T19:28:25.976759+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.976775+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.976799+02] buckets/ssl_buckets.c: ssl_decrypt: read
53 bytes (8000); status: 0
[2013-07-25T19:28:25.976821+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.976838+02] buckets/ssl_buckets.c: bio_bucket_read
received 5 bytes (0)
[2013-07-25T19:28:25.976857+02] buckets/ssl_buckets.c: bio_bucket_read
called for 48 bytes
[2013-07-25T19:28:25.976873+02] buckets/ssl_buckets.c: bio_bucket_read
received 48 bytes (70014)
[2013-07-25T19:28:25.976960+02] buckets/ssl_buckets.c: SSL_connect:SSL
renegotiate ciphers
[2013-07-25T19:28:25.977059+02] buckets/ssl_buckets.c: bio_bucket_write
called for 581 bytes
[2013-07-25T19:28:25.977088+02] buckets/ssl_buckets.c: SSL_connect:SSLv3
write client hello A
[2013-07-25T19:28:25.977109+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:25.977130+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:25.977148+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server hello A
[2013-07-25T19:28:25.977170+02] buckets/ssl_buckets.c: ssl_decrypt: 11 0 9
[2013-07-25T19:28:35.987868+02] buckets/ssl_buckets.c: ssl_decrypt:
begin 8000
[2013-07-25T19:28:35.987964+02] buckets/ssl_buckets.c: bio_bucket_read
called for 5 bytes
[2013-07-25T19:28:35.987987+02] buckets/ssl_buckets.c: bio_bucket_read
received 0 bytes (70014)
[2013-07-25T19:28:35.988006+02] buckets/ssl_buckets.c: SSL_connect:error
in SSLv3 read server hello A
[2013-07-25T19:28:35.988037+02] [l:<myip>:37685 r:<serverip>:443]
buckets/socket_buckets.c: socket_recv error 70014
[2013-07-25T19:28:35.988079+02] buckets/ssl_buckets.c: ssl_decrypt:
70014 0 9
svn: E120108: Unable to connect to a repository at URL
'https://<servername>/svn/testrepo'
svn: E120108: Error running context: The server unexpectedly closed the
connection.
[2013-07-25T19:28:35.988687+02] [l:<myip>:37685 r:<serverip>:443]
outgoing.c: cleanup - closed socket, status 9
[2013-07-25T19:28:35.988750+02] outgoing.c: cleaning up connection
0xb750f018
[2013-07-25T19:28:35.989314+02] outgoing.c: closed connection 0xb750f018

Original issue reported on code.google.com by e...@cs.tu-berlin.de on 25 Jul 2013 at 8:47

GoogleCodeExporter commented 9 years ago
I can reproduce this issue with:
apache 2.2.22 on Ubuntu 13.03
svn trunk + serf trunk@2074

Relevant part of the apache config:
<VirtualHost *:443>
  ServerName lgo-ubuntu1

  SSLEngine on
  SSLCertificateKeyFile /etc/apache2/certs/serfserverkey.pem
  SSLCertificateFile /etc/apache2/certs/serfservercert.pem
  SSLCertificateChainFile /etc/apache2/certs/serfcacerts.pem

<Location "/basicsvn">
  DAV svn
  SVNParentPath "/mnt/share/dev/svn"

  SSLVerifyClient Require
...

Important here is that the SSLVerifyClient directive should be inside the 
Location, not directly under VirtualHost. This will ensure that the ssl 
handshake will trigger a renegotiation.

--------------------------------------------------

This extract of the serf log shows that the renegotiate alert is received and 
read by serf+OpenSSL (1st <<<--------). OpenSSL then responds by writing 620 
bytes to the bio layer.
Then nothing happens and after 10 seconds the server kills the connection (2nd 
<<<--------------) 

[2013-07-25T23:05:34.876972+02] [l:192.168.1.113:57008 r:192.168.1.112:443] 
outgoing.c: --- socket_sendv: 543 bytes. --
[2013-07-25T23:05:34.879514+02] buckets/ssl_buckets.c: ssl_decrypt: begin 8000
[2013-07-25T23:05:34.879541+02] buckets/ssl_buckets.c: bio_bucket_read called 
for 5 bytes
[2013-07-25T23:05:34.879552+02] buckets/ssl_buckets.c: bio_bucket_read received 
0 bytes (70014)
[2013-07-25T23:05:34.879573+02] [l:192.168.1.113:57008 r:192.168.1.112:443] 
buckets/socket_buckets.c: --- socket_recv: 33 bytes. --
[2013-07-25T23:05:34.879585+02] buckets/ssl_buckets.c: ssl_decrypt: read 33 
bytes (8000); status: 0
[2013-07-25T23:05:34.879591+02] buckets/ssl_buckets.c: bio_bucket_read called 
for 5 bytes
[2013-07-25T23:05:34.879596+02] buckets/ssl_buckets.c: bio_bucket_read received 
5 bytes (0)
[2013-07-25T23:05:34.879601+02] buckets/ssl_buckets.c: bio_bucket_read called 
for 28 bytes
[2013-07-25T23:05:34.879605+02] buckets/ssl_buckets.c: bio_bucket_read received 
28 bytes (70014)
[2013-07-25T23:05:34.879627+02] buckets/ssl_buckets.c: SSL_connect:SSL 
renegotiate ciphers                  <<<-----------
[2013-07-25T23:05:34.879646+02] buckets/ssl_buckets.c: bio_bucket_write called 
for 620 bytes
[2013-07-25T23:05:34.879654+02] buckets/ssl_buckets.c: SSL_connect:SSLv3 write 
client hello A
[2013-07-25T23:05:34.879659+02] buckets/ssl_buckets.c: bio_bucket_read called 
for 5 bytes
[2013-07-25T23:05:34.879664+02] buckets/ssl_buckets.c: bio_bucket_read received 
0 bytes (70014)
[2013-07-25T23:05:34.879673+02] buckets/ssl_buckets.c: SSL_connect:error in 
SSLv3 read server hello A
[2013-07-25T23:05:34.879678+02] buckets/ssl_buckets.c: ssl_decrypt: 35 0 9      
                                     <<<------------
[2013-07-25T23:05:44.947063+02] buckets/ssl_buckets.c: ssl_decrypt: begin 8000
[2013-07-25T23:05:44.947116+02] buckets/ssl_buckets.c: bio_bucket_read called 
for 5 bytes
[2013-07-25T23:05:44.947128+02] buckets/ssl_buckets.c: bio_bucket_read received 
0 bytes (70014)
[2013-07-25T23:05:44.947143+02] buckets/ssl_buckets.c: SSL_connect:error in 
SSLv3 read server hello A
[2013-07-25T23:05:44.947153+02] [l:192.168.1.113:57008 r:192.168.1.112:443] 
buckets/socket_buckets.c: socket_recv error 70014

What is strange, and I assume the root cause of this problem, is that the 620 
bytes sent to the bio layer are never written to the network. There should be a 
line "outgoing.c: --- socket_sendv: 620 bytes." somewhere.

The investigation continues.

Original comment by lieven.govaerts@gmail.com on 25 Jul 2013 at 9:14

GoogleCodeExporter commented 9 years ago
Scenario: the server triggers a ssl/tls renegotiation after receiving a request 
but before writing a response.

Issue: The renegotiation request arrives in the ssl layer, and while reading 
that data OpenSSL will write a response.
If the request was the only request pending on the connection (say one opening  
non-pipelined request), serf will have no more requests to send, and won't 
check for socket writability. So the data that OpenSSL has add to the outgoing 
stream will never be written on the socket, and after a timeout the server will 
abort the connection.

The fix check for socket writability not only if there are requests pending, 
but also when the outgoing stream has data pending.

This issue is fixed in r2078.

Original comment by lieven.govaerts@gmail.com on 26 Jul 2013 at 9:10