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

Re: [Libevent-users] https client




10.03.2012, 04:25, "Mark Ellzey" <mthomas@xxxxxxxxxx>:
> On Thu, Mar 08, 2012 at 09:39:23PM +0400, Alexey Ozeritsky wrote:
>
>>  Hello,
>>
>>  I cannot get https client working.
>>  I have tried 2 servers (apache2 and nginx).
>>
>>  libevent 2.0.17+ssl-patches and current git version give the same result.
>>
>>  nginx access_log:
>>  127.0.0.1 - - [08/Mar/2012:21:08:34 +0400] "POST /cgi-bin/test.cgi HTTP/1.1" 400 0 "-" "-"
>>
>>  apache2 error_log:
>>  [Thu Mar 08 21:24:34 2012] [error] [client 127.0.0.1] (70014)End of file found: Error reading request entity data
>>
>>  GET request works fine
>>
>>  Simple program attached.
>>
>>  Thanks.
>
> This is your server (nginx/apache) telling you that POST is not an
> accepted request type for test.cgi.

No, the following works fine:
$ curl -v -k  -X POST --data-binary @test https://127.0.0.1:4443/cgi-bin/test.cgi


I put fprintf(stderr, " write %d %d\n", r, space[i].iov_len); 
next line to SSL_write in bufferevent_openssl.c and see:

$ ./test
new POST request
 write 33 33
 write 17 17
 write 24 24
 write 27 27
 write 2 2
 write -1 104857600
<hang until timeout here>

Then I made a hack:

diff --git a/bufferevent_openssl.c b/bufferevent_openssl.c
index 5f98981..36c8625 100644
--- a/bufferevent_openssl.c
+++ b/bufferevent_openssl.c
@@ -682,13 +682,14 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
                                        if (set_wbor(bev_ssl) < 0)
                                                return -1;
                                bev_ssl->last_write = space[i].iov_len;
+                               blocked = 1;
                                break;
                        default:
                                conn_closed(bev_ssl, BEV_EVENT_WRITING, err, r);
                                bev_ssl->last_write = -1;
+                               blocked = 1;
                                break;
                        }
-                       blocked = 1;
                        break;
                }
        }

All works fine now. 
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.