[Icecast-dev] [PATCH 26/31] Connection: handle_client returns err to client (via client_send_400)

Niv Sardi
Fri, 30 Jul 2010 14:54:48 -0000

src/connection.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 5024690..5627933 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1283,17 +1283,15 @@ static int _handle_client (client_t *client)

     if (strcmp("ICE",  httpp_getvar(parser, HTTPP_VAR_PROTOCOL))
&&
         strcmp("HTTP", httpp_getvar(parser, HTTPP_VAR_PROTOCOL))) {
-        ERROR0("Bad HTTP protocol detected");
-        client_destroy (client);
-        return 0;
+        client_send_400 (client, "Bad HTTP protocol");
+        return -EINPROGRESS;
     }

     uri = util_normalise_uri(rawuri);

-    if (uri == NULL)
-    {
-        client_destroy (client);
-        return 0;
+    if (uri == NULL) {
+        client_send_400 (client, "Couldn't normalize uri");
+        return -EINPROGRESS;
     }

     if (parser->req_type == httpp_req_source) {
@@ -1309,8 +1307,8 @@ static int _handle_client (client_t *client)
         _handle_get_request (client, uri);
     }
     else {
-        ERROR0("Wrong request type from client");
-        client_send_400 (client, "unknown request");
+        client_send_400 (client, "Wrong request type from client");
+        return -EINPROGRESS;
     }

     free(uri);
--
1.7.1