[Icecast-dev] [PATCH 14/31] Add POST support. WARNING, still no AUTH

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

This adds the hability to use POST requests into IceCast, allowing to push with
any client.
This still doesn't support AUTH, but implementing some kind of HTTP auth
should be straight forward.
This can be usefull to push directly from FFMPEG into IceCast without having to
wrap around Icy.

Signed-off-by: Niv Sardi <nsardi at smartjog.com>
---
 src/connection.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 8549f58..ed8bea9 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -78,6 +78,7 @@

    Icecast auth style uses HTTP and Basic Authorization.
 */
+#define NOAUTH_SOURCE_AUTH 2
 #define SHOUTCAST_SOURCE_AUTH 1
 #define ICECAST_SOURCE_AUTH 0

@@ -960,7 +961,13 @@ int connection_check_pass (http_parser_t *parser, const
char *user, const char *
     }
     return ret;
 }
+/* XXX(xaiki): This may need AUTH support */
+static void _handle_post_request (client_t *client, const char *uri)
+{
+    INFO1("Source logging in at mountpoint \"%s\"", uri);

+    source_startup (client, uri, NOAUTH_SOURCE_AUTH);
+}

 /* only called for native icecast source clients */
 static void _handle_source_request (client_t *client, const char *uri)
@@ -1276,6 +1283,9 @@ static void _handle_connection(void)
         if (parser->req_type == httpp_req_source) {
             _handle_source_request (client, uri);
         }
+        else if (parser->req_type == httpp_req_post) {
+            _handle_post_request (client, uri);
+        }
         else if (parser->req_type == httpp_req_stats) {
             _handle_stats_request (client, uri);
         }
--
1.7.1