Closed Night-walker closed 9 years ago
Works fine for me (on Mac).
I run it on Ubuntu 14.04.
# client
(dao) load web.http
= none
(dao) http::Client::Post('http://localhost:8080', 'Hello=World', 'application/x-www-form-urlencoded')
= # after ~30 secs
(dao)
# server
odanylov@odanylov-lt:~/Downloads/dao/modules$ ../bin/dao web/http/samples/sample_post.dao
*** 1436517769.0x7fb873031740.mg_start.10274: [document_root] -> [/home/odanylov/Downloads/dao/modules/]
*** 1436517769.0x7fb873031740.mg_start.10274: [listening_ports] -> [8080]
*** 1436517769.0x7fb873031740.mg_start.10274: [num_threads] -> [4]
*** 1436517769.0x7fb873031740.mg_start.10274: [enable_keep_alive] -> [yes]
*** 1436517769.0x7fb873017700.consume_socket.9702: going idle
*** 1436517769.0x7fb872ffe700.consume_socket.9702: going idle
*** 1436517769.0x7fb872fe5700.consume_socket.9702: going idle
*** 1436517769.0x7fb873030700.consume_socket.9702: going idle
*** 1436517787.0x7fb87304f700.accept_new_connection.9879: Accepted socket 4
*** 1436517787.0x7fb87304f700.produce_socket.9849: queued socket 4
*** 1436517787.0x7fb873017700.consume_socket.9715: grabbed socket 4, going busy
*** 1436517787.0x7fb873017700.handle_request.8039: URL: /
reused = 0 1 1 0 0
*** 1436517827.0x7fb873017700.consume_socket.9702: going idle
The last line of the server log also appears after ~30 secs of hanging on the reused
line.
It hangs on recv()
at the client side.
OK, one problem was with persistent connections not supported by http::Server
. Disabled them. Now I get empty result.
Now it seems to work... but I don't get anything beside the form. No 'POST Variable: ' + X + ' = ' + Y + '</br>\n'
lines which should have been written by the server.
Even more interesting. Sometimes it returns the form without variables, sometimes nothing at all.
I was mistaking, it actually didn't work for me. It seems that the problem is caused by socket closing on the server side (based on the comments where -1
was return by mg_read()
). But I have no idea why this happens.
On Windows, POST data is returned, but in half of the attempts it also returns nothing. But the worst thing is that I am unable to reproduce this behavior while running via debugger: with GDB, everything works perfectly.
It does seem to work when tested with a browser though.
It still does not work on Mac (works on lubuntu though), even after disabling persistent connections. I found that the problem occurs when there is no Content-Length:
in the response header. I begin to believe it is a Civetweb bug, after I reproduced the bug by removing the Content-Length:
part from civetweb/examples/post.c
.
I also observe a few other issues only exists with the Civetweb backend, not with the Marten backend. I just started a new topic #57 to discuss if we should switch the backend back to Marten, and discussed these issues there.
Fixed by coming back to Marten.
The following
hangs with
samples/sample_post.dao
server. Apparently, more data is expected on either end. With http://httpbin.org/post, it works fine and I get back the decoded post data.