From ad70fe8c64d1acdec15db886f91676b86f5f7bd4 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Fri, 11 Feb 2005 16:44:14 +0000 Subject: - transfer --- server/connectionHTTP.c | 193 +++++++++++++++++++++++++++++------------------- server/connectionHTTP.h | 39 ++++++---- server/livestreamer.c | 75 ++++++++++++++++--- server/livestreamer.h | 12 ++- server/streamer.c | 8 +- server/streamer.h | 4 +- 6 files changed, 219 insertions(+), 112 deletions(-) (limited to 'server') diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c index b8d1b36..c50f010 100644 --- a/server/connectionHTTP.c +++ b/server/connectionHTTP.c @@ -1,75 +1,80 @@ /* - * $Id: connectionHTTP.c,v 1.6 2005/02/10 22:24:26 lordjaxom Exp $ + * $Id: connectionHTTP.c,v 1.7 2005/02/11 16:44:15 lordjaxom Exp $ */ #include "server/connectionHTTP.h" -#include "server/livestreamer.h" #include "server/setup.h" -cConnectionHTTP::cConnectionHTTP(void): cServerConnection("HTTP") { - m_Channel = NULL; - m_Apid = 0; - m_ListChannel = NULL; - m_LiveStreamer = NULL; - m_Status = hsRequest; - m_StreamType = (eStreamType)StreamdevServerSetup.HTTPStreamType; - m_Startup = false; +cConnectionHTTP::cConnectionHTTP(void): + cServerConnection("HTTP"), + m_Status(hsRequest), + m_LiveStreamer(NULL), + m_Channel(NULL), + m_Apid(0), + m_StreamType((eStreamType)StreamdevServerSetup.HTTPStreamType), + m_ListChannel(NULL) +{ + Dprintf("constructor hsRequest\n"); } -cConnectionHTTP::~cConnectionHTTP() { - if (m_LiveStreamer != NULL) delete m_LiveStreamer; +cConnectionHTTP::~cConnectionHTTP() +{ + delete m_LiveStreamer; } -void cConnectionHTTP::Detach(void) { - if (m_LiveStreamer != NULL) m_LiveStreamer->Detach(); -} - -void cConnectionHTTP::Attach(void) { - if (m_LiveStreamer != NULL) m_LiveStreamer->Attach(); -} - -bool cConnectionHTTP::Command(char *Cmd) { +bool cConnectionHTTP::Command(char *Cmd) +{ + Dprintf("command %s\n", Cmd); switch (m_Status) { case hsRequest: - if (strncmp(Cmd, "GET ", 4) == 0) return CmdGET(Cmd + 4); - else { - DeferClose(); - m_Status = hsTransfer; // Ignore following lines - return Respond("HTTP/1.0 400 Bad Request"); - } - break; + Dprintf("Request\n"); + m_Request = Cmd; + m_Status = hsHeaders; + return true; case hsHeaders: if (*Cmd == '\0') { - if (m_ListChannel != NULL) { - m_Status = hsListing; - return Respond("HTTP/1.0 200 OK") - && Respond("Content-Type: text/html") - && Respond("") - && Respond("VDR Channel Listing") - && Respond("