diff options
author | Frank Schmirler <vdr@schmirler.de> | 2010-12-02 09:57:17 +0100 |
---|---|---|
committer | Frank Schmirler <vdr@schmirler.de> | 2010-12-02 09:57:17 +0100 |
commit | 2ec54f75051001accc03c32b42df70cd4a19febd (patch) | |
tree | 836d96c9a4688a01745719787a7a0e83804356f8 /server/connectionHTTP.c | |
parent | e0a00f90aece9cfc54f3d5a1d9098fa29d9dc468 (diff) | |
download | vdr-plugin-streamdev-2ec54f75051001accc03c32b42df70cd4a19febd.tar.gz vdr-plugin-streamdev-2ec54f75051001accc03c32b42df70cd4a19febd.tar.bz2 |
Snapshot 2010-09-15
Diffstat (limited to 'server/connectionHTTP.c')
-rw-r--r-- | server/connectionHTTP.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c index 028b9ea..54ccf5a 100644 --- a/server/connectionHTTP.c +++ b/server/connectionHTTP.c @@ -1,5 +1,5 @@ /* - * $Id: connectionHTTP.c,v 1.19 2010/07/20 12:26:29 schmirl Exp $ + * $Id: connectionHTTP.c,v 1.21 2010/08/03 10:46:41 schmirl Exp $ */ #include <ctype.h> @@ -140,11 +140,18 @@ bool cConnectionHTTP::ProcessRequest(void) } } - if (Headers().at(REQUEST_METHOD).compare("GET") == 0 && ProcessURI(Headers().at(PATH_INFO))) { + tStrStrMap::const_iterator it_method = Headers().find(REQUEST_METHOD); + tStrStrMap::const_iterator it_pathinfo = Headers().find(PATH_INFO); + if (it_method == Headers().end() || it_pathinfo == Headers().end()) { + // should never happen + esyslog("streamdev-server connectionHTTP: Missing method or pathinfo"); + } else if (it_method->second.compare("GET") == 0 && ProcessURI(it_pathinfo->second)) { if (m_ChannelList) return Respond("%s", true, m_ChannelList->HttpHeader().c_str()); else if (m_Channel != NULL) { - cDevice *device = GetDevice(m_Channel, 0); + cDevice *device = NULL; + if (ProvidesChannel(m_Channel, 0)) + device = GetDevice(m_Channel, 0); if (device != NULL) { device->SwitchChannel(m_Channel, false); m_LiveStreamer = new cStreamdevLiveStreamer(0, this); @@ -176,13 +183,12 @@ bool cConnectionHTTP::ProcessRequest(void) return Respond("HTTP/1.0 404 not found") && Respond(""); } - } else if (Headers().at(REQUEST_METHOD).compare("HEAD") == 0 && ProcessURI(Headers().at(PATH_INFO))) { + } else if (it_method->second.compare("HEAD") == 0 && ProcessURI(it_pathinfo->second)) { DeferClose(); if (m_ChannelList) return Respond("%s", true, m_ChannelList->HttpHeader().c_str()); else if (m_Channel != NULL) { - cDevice *device = GetDevice(m_Channel, 0); - if (device != NULL) { + if (ProvidesChannel(m_Channel, 0)) { if (m_StreamType == stEXT) { // TODO return Respond("HTTP/1.0 200 OK") @@ -249,7 +255,8 @@ cChannelList* cConnectionHTTP::ChannelListFromString(const std::string& Path, co const static std::string QUERY_STRING("QUERY_STRING"); const static std::string HOST("HTTP_HOST"); - const std::string query = Headers().at(QUERY_STRING); + tStrStrMap::const_iterator it_query = Headers().find(QUERY_STRING); + const std::string& query = it_query == Headers().end() ? "" : it_query->second; std::string groupTarget; cChannelIterator *iterator = NULL; |