ok, commited to cvs. Dziugas Baltrunas wrote:
> Hi, > > compiled and tested - works as expected. > > On 3/23/06, Alexander Malysh <[EMAIL PROTECTED]> wrote: >> Hi, >> >> how about attached patch? it should work ok but untested. >> >> Thanks, >> Alex >> >> Dziugas Baltrunas wrote: >> >> > Hi, >> > >> > ok, what about putting simple return statement instead of goto error? >> > >> > In case of queued for sending, http_send_reply() will register a >> > callback to receive_request() with a state sending_reply which will >> > close the connection afterwards. So it means that http_send_reply() >> > will destroy the connection anyway. >> > >> > However, above will not work, i.e. client will get a 400 reply but the >> > connection won't be closed because we have p->persistent_conn = 1 as >> > default in client_create() which I think has to be changed into 0. Who >> > said that HTTP 1.1 connection should default to keep-alive anyway? >> > >> > Btw, in order for others to understand what this is all about, given >> > that localhost:13013 is your smsbox up and running, try the following: >> > >> >> telnet localhost 13013 >> > Trying 127.0.0.1... >> > Connected to localhost. >> > Escape character is '^]'. >> > asdf >> > Connection closed by foreign host. >> > >> > Which means that it violates http, gives no indication to client, etc. >> > etc., so this should definitely be changed. Proposed way is the >> > following: >> > >> >> telnet localhost 13013 >> > Trying 127.0.0.1... >> > Connected to localhost. >> > Escape character is '^]'. >> > asdf >> > HTTP/1.1 400 Bad Request >> > Server: Kannel/cvs-20060308 >> > Content-Length: 0 >> > >> > Connection closed by foreign host. >> > >> > On 3/23/06, Alexander Malysh <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> >> >> no go with your patch. http_send_reply is a queuing function. that >> >> means when response could not be sent at once (e.g. client too slow) >> >> response sending will be registered (queued) in fdset. but in your >> >> patch you will destroy httpclient with goto error statement. >> >> >> >> You should split http_send_reply function in a helper function which >> >> just prepare response and main function that send response queued as >> >> earlier. Then here instead of sending through http_send_reply you do >> >> something like: >> >> >> >> Octstr *resp = http_prepare_reply(...) >> >> conn_send(resp); >> >> goto error; >> >> >> >> Thanks, >> >> Alex >> >> >> >> Dziugas Baltrunas schrieb: >> >> > Hi list, >> >> > >> >> > in case of client sends us malformed URL (such as >> >> > /cgi-bin/sendsms?user=test&pass=test&to=12345 &text=test), attached >> >> > patch sends a HTTP 400 Bad request error instead of simply closing >> >> > the socket thus giving no indication to the client. >> >> > >> >> > -- >> >> > Dziugas >> >> > >> >> > >> >> > >> >> > > > -- > Dziugas -- Thanks, Alex
