don't use std::map.at(). It's not available in older libstdc++ version

Modified Files:
 Tag: v0_4
	CONTRIBUTORS HISTORY remux/extern.c server/connectionHTTP.c
This commit is contained in:
schmirl 2010-07-22 14:18:36 +00:00
parent b2f30affa9
commit db3274c046
4 changed files with 19 additions and 5 deletions

View File

@ -132,3 +132,6 @@ Norman Thiel
vel_tins vel_tins
for reporting that externremux x264 uses value of ABR for VBR for reporting that externremux x264 uses value of ABR for VBR
Matthias Prill
for reporting a compiler error with older libstdc++ versions

View File

@ -1,6 +1,8 @@
VDR Plugin 'streamdev' Revision History VDR Plugin 'streamdev' Revision History
--------------------------------------- ---------------------------------------
- don't use std::map.at(). It's not available in older libstdc++ version
(reported by Matthias Prill)
- fixed extremux x264 using value of ABR for VBR (thanks to vel_tins@vdrportal) - fixed extremux x264 using value of ABR for VBR (thanks to vel_tins@vdrportal)
2010-07-20: Version 0.4.0b 2010-07-20: Version 0.4.0b

View File

@ -151,7 +151,10 @@ cTSExt::cTSExt(cRingBufferLinear *ResultBuffer, const cServerConnection *Connect
// look for section parameters: /path;param1=value1;param2=value2/ // look for section parameters: /path;param1=value1;param2=value2/
std::string::size_type begin, end; std::string::size_type begin, end;
std::string path = Connection->Headers().at("PATH_INFO"); const static std::string PATH_INFO("PATH_INFO");
tStrStrMap::const_iterator it_pathinfo = Connection->Headers().find(PATH_INFO);
const std::string& path = it_pathinfo == Connection->Headers().end() ? "/" : it_pathinfo->second;
begin = path.find(';', 0); begin = path.find(';', 0);
begin = path.find_first_not_of(';', begin); begin = path.find_first_not_of(';', begin);
end = path.find_first_of(";/", begin); end = path.find_first_of(";/", begin);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: connectionHTTP.c,v 1.13.2.4 2010/07/20 12:26:10 schmirl Exp $ * $Id: connectionHTTP.c,v 1.13.2.5 2010/07/22 14:18:36 schmirl Exp $
*/ */
#include <ctype.h> #include <ctype.h>
@ -140,7 +140,12 @@ 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) if (m_ChannelList)
return Respond("%s", true, m_ChannelList->HttpHeader().c_str()); return Respond("%s", true, m_ChannelList->HttpHeader().c_str());
else if (m_Channel != NULL) { else if (m_Channel != NULL) {
@ -176,7 +181,7 @@ bool cConnectionHTTP::ProcessRequest(void)
return Respond("HTTP/1.0 404 not found") return Respond("HTTP/1.0 404 not found")
&& Respond(""); && 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(); DeferClose();
if (m_ChannelList) if (m_ChannelList)
return Respond("%s", true, m_ChannelList->HttpHeader().c_str()); return Respond("%s", true, m_ChannelList->HttpHeader().c_str());
@ -249,7 +254,8 @@ cChannelList* cConnectionHTTP::ChannelListFromString(const std::string& Path, co
const static std::string QUERY_STRING("QUERY_STRING"); const static std::string QUERY_STRING("QUERY_STRING");
const static std::string HOST("HTTP_HOST"); 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; std::string groupTarget;
cChannelIterator *iterator = NULL; cChannelIterator *iterator = NULL;