mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-11 15:41:08 +02:00
Merge branch 'uncool/dvbsi++' commit 4965619a79
Conflicts: src/gui/widget/hintboxext.cpp src/nhttpd/tuxboxapi/coolstream/controlapi.cpp
This commit is contained in:
@@ -34,18 +34,18 @@
|
||||
#include <system/configure_network.h>
|
||||
#include <cs_api.h>
|
||||
#include <global.h>
|
||||
#include "gui/plugins.h"//for relodplugins
|
||||
#include <gui/plugins.h>//for relodplugins
|
||||
#include <neutrino.h>
|
||||
#ifdef SCREENSHOT
|
||||
#include <driver/screenshot.h>
|
||||
#endif
|
||||
#include "gui/rc_lock.h"
|
||||
#include <gui/rc_lock.h>
|
||||
|
||||
// yhttpd
|
||||
#include "yhttpd.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "ylogging.h"
|
||||
#include "helper.h"
|
||||
#include <yhttpd.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <ylogging.h>
|
||||
#include <helper.h>
|
||||
// nhttpd
|
||||
#include "neutrinoapi.h"
|
||||
#include "controlapi.h"
|
||||
@@ -165,6 +165,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
|
||||
{"epg", &CControlAPI::EpgCGI, ""},
|
||||
{"zapto", &CControlAPI::ZaptoCGI, "text/plain"},
|
||||
{"getonidsid", &CControlAPI::GetChannel_IDCGI, "text/plain"},
|
||||
{"currenttpchannels", &CControlAPI::GetTPChannel_IDCGI, "text/plain"},
|
||||
// boxcontrol - system
|
||||
{"standby", &CControlAPI::StandbyCGI, "text/plain"},
|
||||
{"shutdown", &CControlAPI::ShutdownCGI, "text/plain"},
|
||||
@@ -224,7 +225,6 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
|
||||
void CControlAPI::Execute(CyhookHandler *hh)
|
||||
{
|
||||
int index = -1;
|
||||
std::string yresult;
|
||||
std::string filename = hh->UrlData["filename"];
|
||||
|
||||
log_level_printf(4,"ControlAPI.Execute filename:(%s)\n",filename.c_str());
|
||||
@@ -536,6 +536,12 @@ void CControlAPI::GetChannel_IDCGI(CyhookHandler *hh)
|
||||
hh->printf("%x%04x%04x\n",current_pids.tsid, current_pids.onid, current_pids.sid);
|
||||
}
|
||||
|
||||
// get actual channel_id
|
||||
void CControlAPI::GetTPChannel_IDCGI(CyhookHandler *hh)
|
||||
{
|
||||
SendChannelList(hh, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CControlAPI::MessageCGI(CyhookHandler *hh)
|
||||
{
|
||||
@@ -566,7 +572,7 @@ void CControlAPI::MessageCGI(CyhookHandler *hh)
|
||||
|
||||
if (event != 0)
|
||||
{
|
||||
message=decodeString(message);
|
||||
//message=decodeString(message);
|
||||
NeutrinoAPI->EventServer->sendEvent(event, CEventServer::INITID_HTTPD, (void *) message.c_str(), message.length() + 1);
|
||||
hh->SendOk();
|
||||
}
|
||||
@@ -896,7 +902,6 @@ void CControlAPI::ChannellistCGI(CyhookHandler *hh)
|
||||
std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChannel * channel) {
|
||||
std::string result, firstEPG, secondEPG = "";
|
||||
t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID();
|
||||
int percentage = 100;
|
||||
std::string timestr;
|
||||
|
||||
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
|
||||
@@ -904,6 +909,7 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann
|
||||
event = NeutrinoAPI->ChannelListEvents[channel->channel_id];
|
||||
|
||||
if (event) {
|
||||
int percentage = 100;
|
||||
if (event->duration > 0)
|
||||
percentage = 100 * (time(NULL) - event->startTime) / event->duration;
|
||||
CEitManager::getInstance()->getCurrentNextServiceKey(channel->channel_id, currentNextInfo);
|
||||
@@ -1370,7 +1376,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
else if (hh->ParamList.empty() || hh->ParamList["1"] == "ext") {
|
||||
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
||||
bool isExt = (hh->ParamList["1"] == "ext");
|
||||
CChannelEvent *event;
|
||||
CChannelEvent *event = NULL;
|
||||
NeutrinoAPI->GetChannelEvents();
|
||||
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
@@ -1393,7 +1399,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
// query details for given eventid
|
||||
else if (hh->ParamList["eventid"] != "") {
|
||||
//special epg query
|
||||
uint64_t epgid;
|
||||
uint64_t epgid = 0;
|
||||
sscanf(hh->ParamList["eventid"].c_str(), "%" SCNu64 "", &epgid);
|
||||
CShortEPGData epg;
|
||||
if (CEitManager::getInstance()->getEPGidShort(epgid, &epg)) {
|
||||
@@ -1404,8 +1410,8 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
}
|
||||
else if (hh->ParamList["eventid2fsk"] != "") {
|
||||
if (hh->ParamList["starttime"] != "") {
|
||||
uint64_t epgid;
|
||||
time_t starttime;
|
||||
uint64_t epgid = 0;
|
||||
time_t starttime = 0;
|
||||
sscanf(hh->ParamList["fskid"].c_str(), "%" SCNu64 "", &epgid);
|
||||
sscanf(hh->ParamList["starttime"].c_str(), "%lu", &starttime);
|
||||
CEPGData longepg;
|
||||
@@ -1418,7 +1424,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
}
|
||||
// list EPG for channel id
|
||||
else if (!(hh->ParamList["id"].empty())) {
|
||||
t_channel_id channel_id;
|
||||
t_channel_id channel_id = 0;
|
||||
sscanf(hh->ParamList["id"].c_str(), SCANF_CHANNEL_ID_TYPE, &channel_id);
|
||||
CEitManager::getInstance()->getEventsServiceKey(channel_id, NeutrinoAPI->eList);
|
||||
CChannelEventList::iterator eventIterator;
|
||||
@@ -1435,7 +1441,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
// list EPG for channelID 64Bit
|
||||
else {
|
||||
//eventlist for a chan
|
||||
t_channel_id channel_id;
|
||||
t_channel_id channel_id = 0;
|
||||
sscanf(hh->ParamList["1"].c_str(), SCANF_CHANNEL_ID_TYPE, &channel_id);
|
||||
SendEventList(hh, channel_id);
|
||||
}
|
||||
@@ -1604,17 +1610,22 @@ void CControlAPI::SendEventList(CyhookHandler *hh, t_channel_id channel_id)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CControlAPI::SendChannelList(CyhookHandler *hh)
|
||||
void CControlAPI::SendChannelList(CyhookHandler *hh, bool currentTP)
|
||||
{
|
||||
t_channel_id current_channel = 0;
|
||||
if(currentTP){
|
||||
current_channel = CZapit::getInstance()->GetCurrentChannelID();
|
||||
current_channel=(current_channel>>16);
|
||||
}
|
||||
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
|
||||
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
|
||||
for (; !(cit.EndOfChannels()); cit++) {
|
||||
CZapitChannel * channel = *cit;
|
||||
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
||||
" %s\n",
|
||||
channel->channel_id,
|
||||
channel->getName().c_str());
|
||||
if(!currentTP || (channel->channel_id >>16) == current_channel){
|
||||
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s\n", channel->channel_id, channel->getName().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2012,10 +2023,9 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
||||
void CControlAPI::YWebCGI(CyhookHandler *hh)
|
||||
{
|
||||
bool status=true;
|
||||
int para;
|
||||
if (hh->ParamList["video_stream_pids"] != "")
|
||||
{
|
||||
para=0;
|
||||
int para=0;
|
||||
sscanf( hh->ParamList["video_stream_pids"].c_str(), "%d", ¶);
|
||||
YWeb_SendVideoStreamingPids(hh, para);
|
||||
}
|
||||
@@ -2078,7 +2088,7 @@ std::string CControlAPI::YexecuteScript(CyhookHandler *, std::string cmd)
|
||||
// get file
|
||||
std::string fullfilename;
|
||||
script += ".sh"; //add script extention
|
||||
char cwd[255];
|
||||
char cwd[255]={0};
|
||||
getcwd(cwd, 254);
|
||||
|
||||
for (unsigned int i=0; i<PLUGIN_DIR_COUNT && !found; i++)
|
||||
@@ -2146,13 +2156,16 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
tnull = time(NULL);
|
||||
struct tm *alarmTime=localtime(&tnull);
|
||||
alarmTime->tm_sec = 0;
|
||||
strptime(hh->ParamList["alDate"].c_str(), "%d.%m.%Y", alarmTime);
|
||||
if(sscanf(hh->ParamList["alDate"].c_str(),"%2d.%2d.%4d",&(alarmTime->tm_mday), &(alarmTime->tm_mon), &(alarmTime->tm_year)) == 3)
|
||||
{
|
||||
alarmTime->tm_mon -= 1;
|
||||
alarmTime->tm_year -= 1900;
|
||||
}
|
||||
|
||||
// Alarm Time - Format exact! HH:MM
|
||||
if(hh->ParamList["alTime"] != "")
|
||||
strptime(hh->ParamList["alTime"].c_str(), "%H:%M", alarmTime);
|
||||
sscanf(hh->ParamList["alTime"].c_str(),"%2d.%2d",&(alarmTime->tm_hour), &(alarmTime->tm_min));
|
||||
alHour = alarmTime->tm_hour;
|
||||
|
||||
correctTime(alarmTime);
|
||||
alarmTimeT = mktime(alarmTime);
|
||||
announceTimeT = alarmTimeT;
|
||||
@@ -2160,12 +2173,15 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
stopTime->tm_sec = 0;
|
||||
// Stop Time - Format exact! HH:MM
|
||||
if(hh->ParamList["stTime"] != "")
|
||||
strptime(hh->ParamList["stTime"].c_str(), "%H:%M", stopTime);
|
||||
sscanf(hh->ParamList["stTime"].c_str(),"%2d.%2d",&(stopTime->tm_hour), &(stopTime->tm_min));
|
||||
|
||||
// Stop Date - Format exact! DD.MM.YYYY
|
||||
if(hh->ParamList["stDate"] != "")
|
||||
strptime(hh->ParamList["stDate"].c_str(), "%d.%m.%Y", stopTime);
|
||||
stopTime->tm_sec = 0;
|
||||
if(sscanf(hh->ParamList["stDate"].c_str(),"%2d.%2d.%4d",&(stopTime->tm_mday), &(stopTime->tm_mon), &(stopTime->tm_year)) == 3)
|
||||
{
|
||||
stopTime->tm_mon -= 1;
|
||||
stopTime->tm_year -= 1900;
|
||||
}
|
||||
correctTime(stopTime);
|
||||
stopTimeT = mktime(stopTime);
|
||||
if(hh->ParamList["stDate"] == "" && alHour > stopTime->tm_hour)
|
||||
@@ -2227,9 +2243,9 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
rep = (CTimerd::CTimerEventRepeat) atoi(hh->ParamList["rep"].c_str());
|
||||
else // default: no repeat
|
||||
rep = (CTimerd::CTimerEventRepeat)0;
|
||||
|
||||
if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && hh->ParamList["wd"] != "")
|
||||
NeutrinoAPI->Timerd->getWeekdaysFromStr(&rep, hh->ParamList["wd"].c_str());
|
||||
|
||||
// apids
|
||||
bool changeApids=false;
|
||||
unsigned char apids=0;
|
||||
@@ -2256,6 +2272,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
apids |= TIMERD_APIDS_AC3;
|
||||
}
|
||||
}
|
||||
|
||||
CTimerd::RecordingInfo recinfo;
|
||||
CTimerd::EventInfo eventinfo;
|
||||
eventinfo.epgID = 0;
|
||||
@@ -2266,8 +2283,8 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
// channel by Id or name
|
||||
if(hh->ParamList["channel_id"] != "")
|
||||
sscanf(hh->ParamList["channel_id"].c_str(),
|
||||
SCANF_CHANNEL_ID_TYPE,
|
||||
&eventinfo.channel_id);
|
||||
SCANF_CHANNEL_ID_TYPE,
|
||||
&eventinfo.channel_id);
|
||||
else
|
||||
eventinfo.channel_id = NeutrinoAPI->ChannelNameToChannelId(hh->ParamList["channel_name"]);
|
||||
|
||||
@@ -2290,7 +2307,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
CConfigFile *Config = new CConfigFile(',');
|
||||
Config->loadConfig(NEUTRINO_CONFIGFILE);
|
||||
_rec_dir = Config->getString("network_nfs_recordingdir", "/mnt/filme");
|
||||
delete Config;//Memory leak: Config
|
||||
delete Config;
|
||||
}
|
||||
if(changeApids)
|
||||
eventinfo.apids = apids;
|
||||
@@ -2318,7 +2335,13 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
if(hh->ParamList["id"] != "")
|
||||
{
|
||||
unsigned modyId = atoi(hh->ParamList["id"].c_str());
|
||||
NeutrinoAPI->Timerd->removeTimerEvent(modyId);
|
||||
if(type == CTimerd::TIMER_RECORD)
|
||||
NeutrinoAPI->Timerd->modifyRecordTimerEvent(modyId, announceTimeT, alarmTimeT, stopTimeT, rep,repCount,_rec_dir.c_str());
|
||||
else
|
||||
NeutrinoAPI->Timerd->modifyTimerEvent(modyId, announceTimeT, alarmTimeT, stopTimeT, rep,repCount);
|
||||
// NeutrinoAPI->Timerd->removeTimerEvent(modyId);
|
||||
if(changeApids)
|
||||
NeutrinoAPI->Timerd->modifyTimerAPid(modyId,apids);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2336,15 +2359,18 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
real_alarmTimeT -= pre;
|
||||
}
|
||||
|
||||
for(; timer != timerlist.end(); ++timer)
|
||||
for(; timer != timerlist.end();++timer)
|
||||
if(timer->alarmTime == real_alarmTimeT)
|
||||
{
|
||||
NeutrinoAPI->Timerd->removeTimerEvent(timer->eventID);
|
||||
break;
|
||||
}
|
||||
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
|
||||
}
|
||||
}
|
||||
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
|
||||
else
|
||||
NeutrinoAPI->Timerd->addTimerEvent(type,data,announceTimeT,alarmTimeT,stopTimeT,rep,repCount);
|
||||
|
||||
hh->SendOk();
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -2395,10 +2421,8 @@ void CControlAPI::moveBouquetCGI(CyhookHandler *hh)
|
||||
//-------------------------------------------------------------------------
|
||||
void CControlAPI::deleteBouquetCGI(CyhookHandler *hh)
|
||||
{
|
||||
int selected = -1;
|
||||
|
||||
if (hh->ParamList["selected"] != "") {
|
||||
selected = atoi(hh->ParamList["selected"].c_str());
|
||||
int selected = atoi(hh->ParamList["selected"].c_str());
|
||||
NeutrinoAPI->Zapit->deleteBouquet(selected - 1);
|
||||
hh->SendOk();
|
||||
}
|
||||
@@ -2485,7 +2509,7 @@ void CControlAPI::updateBouquetCGI(CyhookHandler *hh)
|
||||
// host : (optional) ip of dbox
|
||||
void CControlAPI::build_live_url(CyhookHandler *hh)
|
||||
{
|
||||
std::string xpids,port,yresult;
|
||||
std::string xpids;
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
|
||||
if ( mode == CZapitClient::MODE_TV)
|
||||
@@ -2741,18 +2765,13 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
|
||||
if (hh->ParamList["action"] == "list") { // directory list: action=list&path=<path>
|
||||
DIR *dirp;
|
||||
struct dirent*entry;
|
||||
struct stat statbuf;
|
||||
struct passwd *pwd;
|
||||
struct group *grp;
|
||||
struct tm *tm;
|
||||
char datestring[256];
|
||||
|
||||
TOutType outType = hh->outStart();
|
||||
|
||||
std::string path = hh->ParamList["path"];
|
||||
if ((dirp = opendir(path.c_str()))) {
|
||||
bool isFirstLine = true;
|
||||
struct dirent *entry;
|
||||
while ((entry = readdir(dirp))) {
|
||||
std::string item = "";
|
||||
item += hh->outPair("name",
|
||||
@@ -2773,6 +2792,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
std::string fullname = path + entry->d_name;
|
||||
item += hh->outPair("fullname", hh->outValue(fullname), true);
|
||||
|
||||
struct stat statbuf;
|
||||
if (stat(fullname.c_str(), &statbuf) != -1) {
|
||||
item
|
||||
+= hh->outPair(
|
||||
@@ -2786,6 +2806,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
string_printf("%d", statbuf.st_nlink), true);
|
||||
|
||||
/* Print out owner's name if it is found using getpwuid(). */
|
||||
struct passwd *pwd;
|
||||
if ((pwd = getpwuid(statbuf.st_uid)) != NULL) {
|
||||
item += hh->outPair("user", pwd->pw_name, true);
|
||||
}
|
||||
@@ -2794,6 +2815,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
string_printf("%d", statbuf.st_uid), true);
|
||||
}
|
||||
/* Print out group name if it is found using getgrgid(). */
|
||||
struct group *grp;
|
||||
if ((grp = getgrgid(statbuf.st_gid)) != NULL)
|
||||
item += hh->outPair("group", grp->gr_name, true);
|
||||
else {
|
||||
@@ -2804,7 +2826,8 @@ void CControlAPI::FileCGI(CyhookHandler *hh) {
|
||||
item += hh->outPair("size",
|
||||
string_printf("%jd", (intmax_t) statbuf.st_size),
|
||||
true);
|
||||
tm = localtime(&statbuf.st_mtime);
|
||||
struct tm *tm = localtime(&statbuf.st_mtime);
|
||||
char datestring[256] = {0};
|
||||
/* Get localized date string. */
|
||||
strftime(datestring, sizeof(datestring),
|
||||
nl_langinfo(D_T_FMT), tm);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
// yhttpd
|
||||
#include <zapit/channel.h>
|
||||
#include "yhook.h"
|
||||
#include <yhook.h>
|
||||
|
||||
// forward declaration
|
||||
class CNeutrinoAPI;
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
void SendStreamInfo(CyhookHandler *hh);
|
||||
void SendBouquets(CyhookHandler *hh);
|
||||
void SendBouquet(CyhookHandler *hh,int BouquetNr);
|
||||
void SendChannelList(CyhookHandler *hh);
|
||||
void SendChannelList(CyhookHandler *hh, bool currentTP = false);
|
||||
void SendTimers(CyhookHandler *hh);
|
||||
void SendTimersXML(CyhookHandler *hh);
|
||||
void epgDetailList(CyhookHandler *hh);
|
||||
@@ -70,6 +70,7 @@ private:
|
||||
void GetServicesxmlCGI(CyhookHandler *hh);
|
||||
void GetBouquetsxmlCGI(CyhookHandler *hh);
|
||||
void GetChannel_IDCGI(CyhookHandler *hh);
|
||||
void GetTPChannel_IDCGI(CyhookHandler *hh);
|
||||
void MessageCGI(CyhookHandler *hh);
|
||||
void InfoCGI(CyhookHandler *hh);
|
||||
void HWInfoCGI(CyhookHandler *hh);
|
||||
|
@@ -50,7 +50,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */
|
||||
extern CZapitClient::SatelliteList satList;
|
||||
|
||||
// yhttpd
|
||||
#include "ylogging.h"
|
||||
#include <ylogging.h>
|
||||
|
||||
// nhttpd
|
||||
#include "neutrinoapi.h"
|
||||
@@ -266,7 +266,7 @@ bool CNeutrinoAPI::GetChannelEvents(void)
|
||||
if (eList.begin() == eList.end())
|
||||
return false;
|
||||
|
||||
for (eventIterator = eList.begin(); eventIterator != eList.end(); eventIterator++)
|
||||
for (eventIterator = eList.begin(); eventIterator != eList.end(); ++eventIterator)
|
||||
ChannelListEvents[(*eventIterator).get_channel_id()] = &(*eventIterator);
|
||||
|
||||
return true;
|
||||
@@ -457,14 +457,13 @@ std::string CNeutrinoAPI::getAudioInfoAsString(void) {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CNeutrinoAPI::getCryptInfoAsString(void) {
|
||||
unsigned short i;
|
||||
std::stringstream out;
|
||||
std::string casys[11]= {"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"};
|
||||
int caids[] = { 0x600, 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 };
|
||||
|
||||
CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
|
||||
if(channel) {
|
||||
for (i = 0; i < 11; i++) {
|
||||
for (unsigned short i = 0; i < 11; i++) {
|
||||
for(casys_map_iterator_t it = channel->camap.begin(); it != channel->camap.end(); ++it) {
|
||||
int caid = (*it) & 0xFF00;
|
||||
if(caid == caids[i])
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include <zapit/client/zapitclient.h>
|
||||
|
||||
// nhttpd
|
||||
#include "helper.h"
|
||||
#include <helper.h>
|
||||
#include "neutrinoyparser.h"
|
||||
#include "controlapi.h"
|
||||
|
||||
|
@@ -13,9 +13,9 @@
|
||||
#include <netinet/in.h> //ntohs
|
||||
#include <inttypes.h> //ntohs
|
||||
// yhttpd
|
||||
#include "yhttpd.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "mod_yparser.h"
|
||||
#include <yhttpd.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <mod_yparser.h>
|
||||
// tuxbox
|
||||
#include <zapit/client/zapittools.h> //timer list
|
||||
// nhttpd
|
||||
@@ -209,7 +209,7 @@ std::string CNeutrinoYParser::func_mount_set_values(CyhookHandler *hh, std::str
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, std::string para)
|
||||
{
|
||||
std::string ynr, yresult, sel, nr_str, do_show_hidden;
|
||||
std::string yresult, sel, nr_str, do_show_hidden;
|
||||
int nr=1;
|
||||
|
||||
ySplitString(para," ",nr_str, do_show_hidden);
|
||||
@@ -222,7 +222,7 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, st
|
||||
sel=(nr==(i+1)) ? "selected=\"selected\"" : "";
|
||||
if(!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true"))
|
||||
yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(),
|
||||
(encodeString(std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
|
||||
std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()).c_str());
|
||||
//yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(), (encodeString(std::string(g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
|
||||
}
|
||||
return yresult;
|
||||
@@ -268,7 +268,7 @@ std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler *, s
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, std::string para)
|
||||
{
|
||||
std::string abouquet, achannel_id, yresult, sel, sid;
|
||||
std::string abouquet, achannel_id, yresult, sel;
|
||||
|
||||
int bnumber = 1;
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
@@ -556,7 +556,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *,
|
||||
{
|
||||
if(!(isalnum(tags[i].component[0])))
|
||||
tags[i].component=tags[i].component.substr(1,tags[i].component.length()-1);
|
||||
yresult += string_printf("<option value=%05u>%s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,encodeString(tags[i].component).c_str());
|
||||
yresult += string_printf("<option value=%05u>%s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,tags[i].component.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -564,7 +564,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *,
|
||||
{
|
||||
strcpy( pids.APIDs[j].desc, _getISO639Description( pids.APIDs[j].desc ) );
|
||||
}
|
||||
yresult += string_printf("<option value=%05u>%s %s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,encodeString(std::string(pids.APIDs[j].desc)).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": " ");
|
||||
yresult += string_printf("<option value=%05u>%s %s</option>\r\n",idx_as_id ? j : pids.APIDs[j].pid,std::string(pids.APIDs[j].desc).c_str(),pids.APIDs[j].is_ac3 ? " (AC3)": " ");
|
||||
}
|
||||
eit_not_ok=false;
|
||||
break;
|
||||
@@ -596,7 +596,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *,
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CNeutrinoYParser::func_unmount_get_list(CyhookHandler *, std::string)
|
||||
{
|
||||
std::string ysel, ymount, ylocal_dir, yfstype, ynr, yresult, mounts;
|
||||
std::string ysel, ymount, ylocal_dir, yfstype, yresult, mounts;
|
||||
|
||||
std::ifstream in;
|
||||
in.open("/proc/mounts", std::ifstream::in);
|
||||
@@ -832,7 +832,7 @@ std::string CNeutrinoYParser::func_get_timer_list(CyhookHandler *, std::string
|
||||
yresult += string_printf(para.c_str(), classname, zAlarmTime, zStopTime, zRep.c_str(), zRepCount.c_str(),
|
||||
zType.c_str(), sAddData.c_str(),timer->eventID,timer->eventID);
|
||||
}
|
||||
classname = (i++&1)?'a':'b';
|
||||
//classname = (i++&1)?'a':'b';
|
||||
|
||||
return yresult;
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@
|
||||
// c++
|
||||
#include <string>
|
||||
// yhttpd
|
||||
#include "yhttpd.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "mod_yparser.h"
|
||||
#include <yhttpd.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <mod_yparser.h>
|
||||
|
||||
// forward declaration
|
||||
class CNeutrinoAPI;
|
||||
|
@@ -530,7 +530,7 @@ case "$1" in
|
||||
bootlogo_lcd_upload) bootlogo_lcd_upload ;;
|
||||
zapit_upload) zapit_upload $2 ;;
|
||||
kernel-stack) msg=`dmesg`; y_format_message_html ;;
|
||||
ps) msg=`ps`; y_format_message_html ;;
|
||||
ps) msg=`ps aux`; y_format_message_html ;;
|
||||
free) f=`free`; p=`df -h`; msg="RAM Memory use\n-------------------\n$f\n\nPartitions\n-------------------\n$p"
|
||||
y_format_message_html ;;
|
||||
yreboot) reboot; echo "Reboot..." ;;
|
||||
|
@@ -34,28 +34,28 @@ CStringList Cyhttpd::ConfigList;
|
||||
//=============================================================================
|
||||
|
||||
#ifdef Y_CONFIG_USE_AUTHHOOK
|
||||
#include "mod_auth.h"
|
||||
#include <mod_auth.h>
|
||||
static CmAuth *auth = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef Y_CONFIG_USE_WEBLOG
|
||||
#include "mod_weblog.h"
|
||||
#include <mod_weblog.h>
|
||||
static CmWebLog *weblog = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef Y_CONFIG_USE_SENDFILE
|
||||
#include "mod_sendfile.h"
|
||||
#include <mod_sendfile.h>
|
||||
static CmodSendfile *mod_sendfile = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef Y_CONFIG_USE_CACHE
|
||||
#include "mod_cache.h"
|
||||
#include <mod_cache.h>
|
||||
static CmodCache mod_cache; // static instance
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#if defined(CONFIG_SYSTEM_TUXBOX) || defined(CONFIG_SYSTEM_TUXBOX_COOLSTREAM)
|
||||
#include "neutrinoapi.h"
|
||||
#include <neutrinoapi.h>
|
||||
static CNeutrinoAPI *NeutrinoAPI;
|
||||
#endif
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include <iomanip>
|
||||
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include <yconfig.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "helper.h"
|
||||
#include "ylogging.h"
|
||||
@@ -220,10 +220,10 @@ std::string encodeString(std::string decodedString) {
|
||||
unsigned int len = sizeof(char) * decodedString.length() * 5 + 1;
|
||||
std::string result(len, '\0');
|
||||
char *newString = (char *) result.c_str();
|
||||
char *dstring = (char *) decodedString.c_str();
|
||||
char one_char;
|
||||
if (len == result.length()) // got memory needed
|
||||
{
|
||||
char *dstring = (char *) decodedString.c_str();
|
||||
while ((one_char = *dstring++)) /* use the null character as a loop terminator */
|
||||
{
|
||||
if (isalnum(one_char))
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <errno.h>
|
||||
#include <cstring>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include <yconfig.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "ywebserver.h"
|
||||
#include "yconnection.h"
|
||||
@@ -44,6 +44,7 @@ CWebserverConnection::CWebserverConnection(CWebserver *pWebserver) {
|
||||
//-------------------------------------------------------------------------
|
||||
CWebserverConnection::CWebserverConnection() {
|
||||
// aprintf("test CWebserverConnection::CWebserverConnection()\n");
|
||||
Method = M_UNKNOWN;
|
||||
sock = 0;
|
||||
RequestCanceled = 0;
|
||||
keep_alive = 0;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
// c++
|
||||
#include <string>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include <yconfig.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "ywebserver.h"
|
||||
#include "yrequest.h"
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include <yconfig.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "ylogging.h"
|
||||
// tuxbox
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
CStringList HookVarList; // Variables in Hook-Handling passing to other Hooks
|
||||
THttp_Method Method; // HTTP Method (requested)
|
||||
// constructor & deconstructor
|
||||
CyhookHandler(){ContentLength = 0; keep_alive = 0; _outIndent = 0;};
|
||||
CyhookHandler(){ContentLength = 0; keep_alive = 0; _outIndent = 0;status = HANDLED_NONE;Method = M_UNKNOWN;httpStatus = HTTP_NIL;outType = plain;};
|
||||
virtual ~CyhookHandler(){};
|
||||
|
||||
// hook slot handler
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <configfile.h>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include <yconfig.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "ywebserver.h"
|
||||
|
||||
|
@@ -77,7 +77,10 @@ void CLogging::printf(const char *fmt, ...) {
|
||||
va_end(arglist);
|
||||
|
||||
pthread_mutex_lock(&Log_mutex);
|
||||
::printf(buffer);
|
||||
buffer[bufferlen-1]='\0';
|
||||
::printf("%s",buffer);
|
||||
fflush(stdout);
|
||||
|
||||
if (LogToFile) {
|
||||
; //FIXME Logging to File
|
||||
}
|
||||
|
@@ -75,9 +75,8 @@ bool CWebserverRequest::HandleRequest(void) {
|
||||
return false;
|
||||
|
||||
if (Connection->Method == M_GET || Connection->Method == M_HEAD) {
|
||||
std::string tmp_line;
|
||||
//read header (speed up: read rest of request in blockmode)
|
||||
tmp_line = Connection->sock->ReceiveBlock();
|
||||
std::string tmp_line = Connection->sock->ReceiveBlock();
|
||||
if (!Connection->sock->isValid) {
|
||||
Connection->Response.SendError(HTTP_INTERNAL_SERVER_ERROR);
|
||||
return false;
|
||||
@@ -116,7 +115,7 @@ bool CWebserverRequest::HandleRequest(void) {
|
||||
// Split URL into path, filename, fileext .. UrlData[]
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CWebserverRequest::ParseStartLine(std::string start_line) {
|
||||
std::string method, url, http, tmp;
|
||||
std::string method = "", url = "", tmp = "";
|
||||
|
||||
log_level_printf(8, "<ParseStartLine>: line: %s\n", start_line.c_str());
|
||||
if (ySplitString(start_line, " ", method, tmp)) {
|
||||
@@ -155,7 +154,7 @@ bool CWebserverRequest::ParseStartLine(std::string start_line) {
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CWebserverRequest::ParseParams(std::string param_string) {
|
||||
bool ende = false;
|
||||
std::string param, name = "", value, number;
|
||||
std::string param, name = "", value = "", number = "";
|
||||
|
||||
while (!ende) {
|
||||
if (!ySplitStringExact(param_string, "&", param, param_string))
|
||||
@@ -171,6 +170,9 @@ bool CWebserverRequest::ParseParams(std::string param_string) {
|
||||
}
|
||||
number = string_printf("%d", ParameterList.size() + 1);
|
||||
log_level_printf(7, "ParseParams: name: %s value: %s\n", name.c_str(), value.c_str());
|
||||
if(value.empty()){
|
||||
name = trim(decodeString(name));
|
||||
}
|
||||
ParameterList[number] = name;
|
||||
}
|
||||
return true;
|
||||
@@ -188,8 +190,9 @@ bool CWebserverRequest::ParseParams(std::string param_string) {
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CWebserverRequest::ParseHeader(std::string header) {
|
||||
bool ende = false;
|
||||
std::string sheader, name, value;
|
||||
HeaderList.clear();
|
||||
std::string sheader = "", name = "", value = "";
|
||||
if(!HeaderList.empty())
|
||||
HeaderList.clear();
|
||||
|
||||
while (!ende) {
|
||||
if (!ySplitStringExact(header, "\r\n", sheader, header))
|
||||
@@ -209,18 +212,19 @@ bool CWebserverRequest::ParseHeader(std::string header) {
|
||||
// query data is splitted and stored in ParameterList
|
||||
//-----------------------------------------------------------------------------
|
||||
void CWebserverRequest::analyzeURL(std::string url) {
|
||||
ParameterList.clear();
|
||||
if(!ParameterList.empty())
|
||||
ParameterList.clear();
|
||||
// URI decode
|
||||
url = decodeString(url);
|
||||
url = trim(url, "\r\n"); // non-HTTP-Standard: allow \r or \n in URL. Delete it.
|
||||
UrlData["fullurl"] = url;
|
||||
// split Params
|
||||
if (ySplitString(url, "?", UrlData["url"], UrlData["paramstring"])) // split pure URL and all Params
|
||||
if (ySplitString(url, "?", UrlData["url"], UrlData["paramstring"])){ // split pure URL and all Params
|
||||
ParseParams( UrlData["paramstring"]); // split params to ParameterList
|
||||
else
|
||||
}else{
|
||||
// No Params
|
||||
url = decodeString(url);
|
||||
UrlData["url"] = url;
|
||||
|
||||
}
|
||||
if (!ySplitStringLast(UrlData["url"], "/", UrlData["path"],
|
||||
UrlData["filename"])) {
|
||||
UrlData["path"] = "/"; // Set "/" if not contained
|
||||
@@ -240,7 +244,7 @@ void CWebserverRequest::analyzeURL(std::string url) {
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CWebserverRequest::HandlePost() {
|
||||
//read header: line by line
|
||||
std::string raw_header, tmp_line;
|
||||
std::string raw_header = "", tmp_line = "";
|
||||
do {
|
||||
tmp_line = Connection->sock->ReceiveLine();
|
||||
if (tmp_line == "") // Socket empty
|
||||
@@ -270,7 +274,6 @@ bool CWebserverRequest::HandlePost() {
|
||||
{
|
||||
#ifdef Y_CONFIG_FEATURE_UPLOAD
|
||||
std::string boundary = "--" + HeaderList["Content-Type"].substr(t.length(),HeaderList["Content-Type"].length() - t.length());
|
||||
std::string post_header;
|
||||
do
|
||||
{
|
||||
content_len = HandlePostBoundary(boundary, content_len);
|
||||
@@ -285,9 +288,9 @@ bool CWebserverRequest::HandlePost() {
|
||||
{
|
||||
// handle normal form POST
|
||||
log_level_printf(6, "Handle POST application/x-www-form-urlencoded\n");
|
||||
std::string post_header;
|
||||
|
||||
// get message-body
|
||||
post_header = Connection->sock->ReceiveBlock();
|
||||
std::string post_header = Connection->sock->ReceiveBlock();
|
||||
while (post_header.length() < content_len) {
|
||||
post_header += Connection->sock->ReceiveBlock();
|
||||
/* aprintf("POST form less data then expected\n");
|
||||
@@ -384,10 +387,9 @@ bool CWebserverRequest::HandlePost() {
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary,
|
||||
unsigned int content_len) {
|
||||
std::string tmp_line;
|
||||
|
||||
// read boundary
|
||||
tmp_line = Connection->sock->ReceiveLine();
|
||||
std::string tmp_line = Connection->sock->ReceiveLine();
|
||||
content_len -= tmp_line.length();
|
||||
|
||||
log_level_printf(2, "<POST Boundary> Start\n");
|
||||
@@ -412,7 +414,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary,
|
||||
log_level_printf(2,"<POST Boundary> disposition !!this is a file!! found. line:(%s)\n", tmp_line.c_str());
|
||||
// get para from 'content-disposition: form-data; name="pics"; filename="file1.txt"'
|
||||
// set to ParameterList["<name>"]="<filename>"
|
||||
std::string left, right, var_name, var_value;
|
||||
std::string left = "", right = "", var_name = "", var_value = "";
|
||||
if(!ySplitStringExact(tmp_line, "name=\"", left, right))
|
||||
{
|
||||
log_level_printf(7,"<POST Boundary> no var_name START found. line:(%s)\n", tmp_line.c_str());
|
||||
@@ -461,8 +463,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary,
|
||||
}
|
||||
log_level_printf(7,"<POST Boundary> read file Start\n");
|
||||
|
||||
std::string upload_filename;
|
||||
upload_filename = UPLOAD_TMP_FILE;
|
||||
std::string upload_filename = UPLOAD_TMP_FILE;
|
||||
// Hook for Filename naming
|
||||
Connection->HookHandler.Hooks_UploadSetFilename(upload_filename);
|
||||
// Set upload filename to ParameterList["<name>_upload_filename"]="<upload_filename>"
|
||||
@@ -543,7 +544,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary,
|
||||
// this part is a POST variable/parameter
|
||||
{
|
||||
// get var_name from 'content-disposition: form-data; name="var_name"'
|
||||
std::string left, right, var_name, var_value;
|
||||
std::string left = "", right = "", var_name = "", var_value = "";
|
||||
if (!ySplitStringExact(tmp_line, "name=\"", left, right)) {
|
||||
log_level_printf(7, "<POST Boundary> no var_name START found. line:(%s)\n", tmp_line.c_str());
|
||||
return 0;
|
||||
|
@@ -15,8 +15,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include "yhttpd.h"
|
||||
#include <yconfig.h>
|
||||
#include <yhttpd.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "ylogging.h"
|
||||
#include "ywebserver.h"
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// c++
|
||||
#include <string>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include <yconfig.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "yhook.h"
|
||||
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
void printf(const char *fmt, ...);
|
||||
bool Write(char const *text);
|
||||
bool WriteLn(char const *text);
|
||||
bool Write(const std::string text) { return Write(text.c_str()); }
|
||||
bool WriteLn(const std::string text) { return WriteLn(text.c_str()); }
|
||||
bool Write(const std::string &text) { return Write(text.c_str()); }
|
||||
bool WriteLn(const std::string &text) { return WriteLn(text.c_str()); }
|
||||
|
||||
// Headers
|
||||
void SendError(HttpResponseType responseType) {SendHeader(responseType, false, "text/html");}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
// yhttpd
|
||||
#include "yhttpd.h"
|
||||
#include <yhttpd.h>
|
||||
#include "ysocket.h"
|
||||
#include "ylogging.h"
|
||||
// system
|
||||
@@ -64,6 +64,7 @@ CySocket::~CySocket() {
|
||||
// initialize
|
||||
//-----------------------------------------------------------------------------
|
||||
void CySocket::init(void) {
|
||||
BytesSend = 0;
|
||||
handling = false;
|
||||
isOpened = false;
|
||||
isValid = true;
|
||||
@@ -194,8 +195,8 @@ CySocket* CySocket::accept() {
|
||||
#else
|
||||
set_tcp_nodelay();
|
||||
#endif
|
||||
new_ySocket->isOpened = true;
|
||||
}
|
||||
new_ySocket->isOpened = true;
|
||||
// handling = true;
|
||||
return new_ySocket;
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <configfile.h>
|
||||
|
||||
// yhttpd
|
||||
#include "yhttpd.h"
|
||||
#include <yhttpd.h>
|
||||
#include "ytypes_globals.h"
|
||||
#include "ywebserver.h"
|
||||
#include "ylogging.h"
|
||||
@@ -243,7 +243,6 @@ bool CWebserver::run(void) {
|
||||
int CWebserver::AcceptNewConnectionSocket() {
|
||||
int slot = -1;
|
||||
CySocket *connectionSock = NULL;
|
||||
int newfd;
|
||||
|
||||
if (!(connectionSock = listenSocket.accept())) // Blocking wait
|
||||
{
|
||||
@@ -267,7 +266,7 @@ int CWebserver::AcceptNewConnectionSocket() {
|
||||
SocketList[slot] = connectionSock; // put it to list
|
||||
fcntl(connectionSock->get_socket(), F_SETFD, O_NONBLOCK); // set non-blocking
|
||||
open_connections++; // count open connectins
|
||||
newfd = connectionSock->get_socket();
|
||||
int newfd = connectionSock->get_socket();
|
||||
if (newfd > fdmax) // keep track of the maximum fd
|
||||
fdmax = newfd;
|
||||
}
|
||||
@@ -379,7 +378,7 @@ bool CWebserver::CheckKeepAliveAllowedByIP(std::string client_ip) {
|
||||
while (it != conf_no_keep_alive_ips.end()) {
|
||||
if (trim(*it) == client_ip)
|
||||
do_keep_alive = false;
|
||||
it++;
|
||||
++it;
|
||||
}
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return do_keep_alive;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include "mod_auth.h"
|
||||
#include "helper.h"
|
||||
#include <helper.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HOOK: response_hook
|
||||
@@ -65,11 +65,13 @@ bool CmAuth::CheckAuth(CyhookHandler *hh) {
|
||||
// decode Base64 buffer to String
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string CmAuth::decodeBase64(const char *b64buffer) {
|
||||
char *newString, *org_newString; //shorter then b64buffer
|
||||
if(b64buffer==NULL)
|
||||
return "";
|
||||
char *newString; //shorter then b64buffer
|
||||
std::string result;
|
||||
if ((newString = (char *) malloc(sizeof(char) * strlen(b64buffer) + 1))
|
||||
!= NULL) {
|
||||
org_newString = newString;
|
||||
char *org_newString = newString;
|
||||
int i = 0;
|
||||
unsigned long c = 0;
|
||||
|
||||
|
@@ -5,11 +5,12 @@
|
||||
#ifndef __yhttpd_mod_auth_h__
|
||||
#define __yhttpd_mod_auth_h__
|
||||
|
||||
#include "yhook.h"
|
||||
#include <yhook.h>
|
||||
class CmAuth: public Cyhook {
|
||||
public:
|
||||
bool authenticate;
|
||||
CmAuth() {
|
||||
authenticate = false;
|
||||
}
|
||||
;
|
||||
~CmAuth() {
|
||||
|
@@ -8,9 +8,9 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/stat.h>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "helper.h"
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <helper.h>
|
||||
#include "mod_cache.h"
|
||||
|
||||
//=============================================================================
|
||||
@@ -128,7 +128,7 @@ void CmodCache::AddToCache(CyhookHandler *, std::string url,
|
||||
CacheList[url].mime_type = mime_type;
|
||||
CacheList[url].category = category;
|
||||
CacheList[url].created = time(NULL);
|
||||
std::string test = CacheList[url].filename;
|
||||
// std::string test = CacheList[url].filename;
|
||||
}
|
||||
fflush(fd); // flush and close file
|
||||
fclose(fd);
|
||||
@@ -154,7 +154,7 @@ void CmodCache::RemoveCategoryFromCache(std::string category) {
|
||||
do {
|
||||
restart = false;
|
||||
TCacheList::iterator i = CacheList.begin();
|
||||
for (; i != CacheList.end(); i++) {
|
||||
for (; i != CacheList.end(); ++i) {
|
||||
TCache *item = &((*i).second);
|
||||
if (item->category == category) {
|
||||
CacheList.erase(((*i).first));
|
||||
@@ -198,7 +198,7 @@ void CmodCache::yshowCacheInfo(CyhookHandler *hh) {
|
||||
"<tr><td>URL</td><td>Mime</td><td>Filename</td><td>Category</td><td>Created</td><td>Remove</td></tr>\n");
|
||||
pthread_mutex_lock(&mutex);
|
||||
TCacheList::iterator i = CacheList.begin();
|
||||
for (; i != CacheList.end(); i++) {
|
||||
for (; i != CacheList.end(); ++i) {
|
||||
TCache *item = &((*i).second);
|
||||
char timeStr[80];
|
||||
strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime(&(item->created)));
|
||||
|
@@ -11,9 +11,9 @@
|
||||
// c++
|
||||
#include <string>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "yhook.h"
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <yhook.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
|
@@ -47,9 +47,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "helper.h"
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <helper.h>
|
||||
#include "mod_sendfile.h"
|
||||
|
||||
//=============================================================================
|
||||
@@ -64,7 +64,6 @@ CStringList CmodSendfile::sendfileTypes;
|
||||
THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) {
|
||||
hh->status = HANDLED_NONE;
|
||||
|
||||
int filed;
|
||||
log_level_printf(4, "mod_sendfile prepare hook start url:%s\n", hh->UrlData["fullurl"].c_str());
|
||||
std::string mime = sendfileTypes[hh->UrlData["fileext"]];
|
||||
if (((mime != "") || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true"))
|
||||
@@ -73,7 +72,7 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) {
|
||||
// build filename
|
||||
std::string fullfilename = GetFileName(hh, hh->UrlData["path"],
|
||||
hh->UrlData["filename"]);
|
||||
|
||||
int filed;
|
||||
if ((filed = OpenFile(hh, fullfilename)) != -1) //can access file?
|
||||
{
|
||||
struct stat statbuf;
|
||||
@@ -180,7 +179,6 @@ std::string CmodSendfile::GetFileName(CyhookHandler *hh, std::string path, std::
|
||||
//-----------------------------------------------------------------------------
|
||||
int CmodSendfile::OpenFile(CyhookHandler *, std::string fullfilename) {
|
||||
int fd = -1;
|
||||
std::string tmpstring;
|
||||
if (fullfilename.length() > 0) {
|
||||
fd = open(fullfilename.c_str(), O_RDONLY | O_LARGEFILE);
|
||||
if (fd <= 0) {
|
||||
|
@@ -11,9 +11,9 @@
|
||||
// c++
|
||||
#include <string>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "yhook.h"
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <yhook.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class CmodSendfile : public Cyhook
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#define TESTHOOK_H_
|
||||
|
||||
|
||||
#include "yhook.h"
|
||||
#include <yhook.h>
|
||||
class CTesthook : public Cyhook
|
||||
{
|
||||
public:
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mod_weblog.h"
|
||||
#include "helper.h"
|
||||
#include <helper.h>
|
||||
|
||||
//=============================================================================
|
||||
// Initialization of static variables
|
||||
@@ -97,8 +97,8 @@ bool CmWebLog::printf(const char *fmt, ...) {
|
||||
if (!OpenLogFile())
|
||||
return false;
|
||||
bool success = false;
|
||||
char buffer[bufferlen];
|
||||
if (WebLogFile != NULL) {
|
||||
char buffer[bufferlen]={0};
|
||||
pthread_mutex_lock(&WebLog_mutex); // yeah, its mine
|
||||
va_list arglist;
|
||||
va_start(arglist, fmt);
|
||||
@@ -130,6 +130,8 @@ bool CmWebLog::printf(const char *fmt, ...) {
|
||||
//-----------------------------------------------------------------------------
|
||||
void CmWebLog::AddLogEntry_CLF(CyhookHandler *hh)
|
||||
{
|
||||
#if 0
|
||||
//never used
|
||||
std::string cs_method;
|
||||
switch (hh->Method)
|
||||
{
|
||||
@@ -141,6 +143,7 @@ void CmWebLog::AddLogEntry_CLF(CyhookHandler *hh)
|
||||
cs_method = "unknown";
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
std::string c_ip = hh->UrlData["clientaddr"].c_str();
|
||||
std::string request_startline = hh->UrlData["startline"].c_str();
|
||||
int s_status = hh->httpStatus;
|
||||
@@ -315,7 +318,6 @@ void CmWebLog::AddLogEntry_ELF(CyhookHandler *hh)
|
||||
std::string c_ip = hh->UrlData["clientaddr"].c_str();
|
||||
std::string request_startline = hh->UrlData["startline"].c_str();
|
||||
std::string cs_uri = hh->UrlData["fullurl"];
|
||||
std::string cs_uri_stem = hh->UrlData["url"];
|
||||
int sc_status = hh->httpStatus;
|
||||
int bytes = hh->GetContentLength();
|
||||
int cached = (hh->HookVarList["CacheCategory"].empty()) ? 0 : 1;
|
||||
|
@@ -5,8 +5,8 @@
|
||||
#ifndef __yhttpd_mod_weblog_h__
|
||||
#define __yhttpd_mod_weblog_h__
|
||||
|
||||
#include "yconfig.h"
|
||||
#include "yhook.h"
|
||||
#include <yconfig.h>
|
||||
#include <yhook.h>
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defaults
|
||||
#ifndef LOG_FILE
|
||||
|
@@ -18,12 +18,12 @@
|
||||
// tuxbox
|
||||
#include <configfile.h>
|
||||
// yhttpd
|
||||
#include "yconfig.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "helper.h"
|
||||
#include "ylogging.h"
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <helper.h>
|
||||
#include <ylogging.h>
|
||||
#include "mod_yparser.h"
|
||||
#include "ylanguage.h"
|
||||
#include <ylanguage.h>
|
||||
|
||||
//=============================================================================
|
||||
// Initialization of static variables
|
||||
@@ -111,7 +111,7 @@ void CyParser::Execute(CyhookHandler *hh) {
|
||||
if (CLogging::getInstance()->getDebug()) {
|
||||
dprintf("Execute CGI : %s\n", filename.c_str());
|
||||
for (CStringList::iterator it = hh->ParamList.begin(); it
|
||||
!= hh->ParamList.end(); it++)
|
||||
!= hh->ParamList.end(); ++it)
|
||||
dprintf(" Parameter %s : %s\n", it->first.c_str(),
|
||||
it->second.c_str());
|
||||
}
|
||||
@@ -156,7 +156,6 @@ void CyParser::Execute(CyhookHandler *hh) {
|
||||
// mini cgi Engine (Entry for ycgi)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CyParser::cgi(CyhookHandler *hh) {
|
||||
bool ydebug = false;
|
||||
std::string htmlfilename, yresult, ycmd;
|
||||
|
||||
if ( !hh->ParamList.empty() ) {
|
||||
@@ -164,6 +163,7 @@ void CyParser::cgi(CyhookHandler *hh) {
|
||||
htmlfilename = hh->ParamList["tmpl"];
|
||||
else
|
||||
htmlfilename = hh->ParamList["1"];
|
||||
bool ydebug = false;
|
||||
if (hh->ParamList["debug"] != "") // switch debug on
|
||||
ydebug = true;
|
||||
|
||||
@@ -171,7 +171,6 @@ void CyParser::cgi(CyhookHandler *hh) {
|
||||
{
|
||||
ycmd = hh->ParamList["execute"];
|
||||
ycmd = YPARSER_ESCAPE_START + ycmd + YPARSER_ESCAPE_END;
|
||||
ycmd = ycmd;
|
||||
yresult = cgi_cmd_parsing(hh, ycmd, ydebug); // parsing engine
|
||||
}
|
||||
// parsing given file
|
||||
@@ -471,7 +470,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
pthread_mutex_unlock(&yParser_mutex);
|
||||
}
|
||||
} else if (ycmd_type == "file-action") {
|
||||
std::string filename, actionname, content, tmp, ydefault;
|
||||
std::string filename, actionname, content, tmp;
|
||||
if (ySplitString(ycmd_name, ";", filename, tmp)) {
|
||||
ySplitString(tmp, ";", actionname, content);
|
||||
replace(content, "\r\n", "\n");
|
||||
@@ -522,7 +521,6 @@ std::string CyParser::YWeb_cgi_get_ini(CyhookHandler *, std::string filename,
|
||||
//-------------------------------------------------------------------------
|
||||
void CyParser::YWeb_cgi_set_ini(CyhookHandler *, std::string filename,
|
||||
std::string varname, std::string varvalue, std::string yaccess) {
|
||||
std::string result;
|
||||
if ((yaccess == "open") || (yaccess == "")) {
|
||||
yConfig->clear();
|
||||
yConfig->loadConfig(filename);
|
||||
@@ -738,11 +736,11 @@ std::string CyParser::func_get_languages_as_dropdown(CyhookHandler *,
|
||||
std::string para) {
|
||||
std::string yresult, sel;
|
||||
DIR *d;
|
||||
struct dirent *dir;
|
||||
|
||||
std::string act_language = CLanguage::getInstance()->language;
|
||||
d = opendir((CLanguage::getInstance()->language_dir).c_str());
|
||||
if (d != NULL) {
|
||||
struct dirent *dir;
|
||||
while ((dir = readdir(d))) {
|
||||
if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0)
|
||||
continue;
|
||||
|
@@ -16,10 +16,10 @@
|
||||
|
||||
#include <configfile.h>
|
||||
// yhttpd
|
||||
#include "helper.h"
|
||||
#include "yconfig.h"
|
||||
#include "ytypes_globals.h"
|
||||
#include "yhook.h"
|
||||
#include <helper.h>
|
||||
#include <yconfig.h>
|
||||
#include <ytypes_globals.h>
|
||||
#include <yhook.h>
|
||||
|
||||
// forward declaration
|
||||
class CWebserverConnection;
|
||||
|
Reference in New Issue
Block a user