]> git.sesse.net Git - cubemap/blobdiff - input.cpp
Fix URL parsing of HTTP inputs with no port.
[cubemap] / input.cpp
index 3f6a9d73ee42095b7462ba32a93088c5a60aadfb..d37b7d997e16f41f5afbe6d4421e5d669ad4d516 100644 (file)
--- a/input.cpp
+++ b/input.cpp
@@ -1,10 +1,10 @@
-#include <string.h>
+#include <stddef.h>
 #include <string>
 
 #include "httpinput.h"
-#include "udpinput.h"
 #include "input.h"
 #include "state.pb.h"
+#include "udpinput.h"
 
 using namespace std;
 
@@ -49,21 +49,21 @@ bool parse_url(const string &url, string *protocol, string *host, string *port,
 
        // http://foo/bar
        *port = *protocol;
-       *path = rest;
+       *path = "/" + rest;
        return true;
 }
 
-Input *create_input(const std::string &stream_id, const std::string &url)
+Input *create_input(const std::string &url)
 {
        string protocol, host, port, path;
        if (!parse_url(url, &protocol, &host, &port, &path)) {
                return NULL;
        }
        if (protocol == "http") {
-               return new HTTPInput(stream_id, url);
+               return new HTTPInput(url);
        }
        if (protocol == "udp") {
-               return new UDPInput(stream_id, url);
+               return new UDPInput(url);
        }
        return NULL;
 }