Will answer myself: simply was inaccurate in response with Content-Length field - forgot to count last \r\n in content body. brokensword wrote: > > Hi. > > I'm testing performance of some hand-made (on sockets) web-server. > Everything looks fine, except "keep-alive http" test case. As I understand > - in "keep-alive http" mode I shouldn't close() socket after each > operation. > So cycle should look like following: > accept() > read() > write() > read() > write() > ... > until I receive "Connection: close" or some error etc. > > After launching ab with -k flag, ab always hangs after first write(). I > see my server's "Hello world" output in ab logs, but ab hangs forever > until timeout fires and I never receive anything from second read(). > > If I change logic to > accept() > read() > write() > close() > accept() > read() > write() > close() > ... > everything works fine with ab -k. > > But I'm losing sense of this keep-alive HTTP protocol feature then :( > > Who can explain? > > If you need a code - you can find it there: > http://zenebo.com/lighttz.c.tar.gz > > just comment there closing of socket in write callback (close(cli->fd)) > and ev_io_stop(EV_A_ w) in read and write callbacks. Also change > Connection: close in http response to Connection: Keep-Alive. > > -- View this message in context: http://old.nabble.com/ApacheBench-%28ab%29-Keep-Alive-feature-behavior-tp29721213p29722914.html Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx