summaryrefslogtreecommitdiff
path: root/vdr-smarttvweb/httpresource.c
diff options
context:
space:
mode:
Diffstat (limited to 'vdr-smarttvweb/httpresource.c')
-rwxr-xr-xvdr-smarttvweb/httpresource.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/vdr-smarttvweb/httpresource.c b/vdr-smarttvweb/httpresource.c
index adffffc..3e1e21c 100755
--- a/vdr-smarttvweb/httpresource.c
+++ b/vdr-smarttvweb/httpresource.c
@@ -326,7 +326,7 @@ int cHttpResource::processRequest() {
#ifndef DEBUG
*(mLog->log())<< DEBUGPREFIX << " processRequest for mPath= " << mPath << DEBUGHDR << endl;
#endif
- struct stat statbuf;
+ struct stat64 statbuf;
bool ok_to_serve = false;
if (mMethod.compare("POST")==0) {
@@ -400,7 +400,7 @@ int cHttpResource::processRequest() {
if (mPath.compare("/widget.conf") == 0) {
mPath = mFactory->getConfigDir() + "/widget.conf";
- if (stat(mPath.c_str(), &statbuf) < 0) {
+ if (stat64(mPath.c_str(), &statbuf) < 0) {
sendError(404, "Not Found", NULL, "File not found.");
return OKAY;
}
@@ -415,7 +415,7 @@ int cHttpResource::processRequest() {
if (mPath.compare("/favicon.ico") == 0) {
mPath = mFactory->getConfigDir() + "/web/favicon.ico";
- if (stat(mPath.c_str(), &statbuf) < 0) {
+ if (stat64(mPath.c_str(), &statbuf) < 0) {
sendError(404, "Not Found", NULL, "File not found.");
return OKAY;
}
@@ -464,7 +464,7 @@ int cHttpResource::processRequest() {
}
- if (stat(mPath.c_str(), &statbuf) < 0) {
+ if (stat64(mPath.c_str(), &statbuf) < 0) {
// checking, whether the file or directory exists
*(mLog->log())<< DEBUGPREFIX
<< " File Not found " << mPath << endl;
@@ -831,7 +831,7 @@ void cHttpResource::sendError(int status, const char *title, const char *extra,
}
-int cHttpResource::sendDir(struct stat *statbuf) {
+int cHttpResource::sendDir(struct stat64 *statbuf) {
char pathbuf[4096];
char f[400];
int len;
@@ -851,7 +851,7 @@ int cHttpResource::sendDir(struct stat *statbuf) {
}
snprintf(pathbuf, sizeof(pathbuf), "%sindex.html", mPath.c_str());
- if (stat(pathbuf, statbuf) >= 0) {
+ if (stat64(pathbuf, statbuf) >= 0) {
mPath = pathbuf;
mFileSize = statbuf->st_size;
mContentType = SINGLEFILE;
@@ -895,7 +895,7 @@ int cHttpResource::sendDir(struct stat *statbuf) {
// printf (" -Entry: %s\n", de->d_name);
strcat(pathbuf, de->d_name);
- stat(pathbuf, statbuf);
+ stat64(pathbuf, statbuf);
tm = gmtime(&(statbuf->st_mtime));
strftime(timebuf, sizeof(timebuf), "%d-%b-%Y %H:%M:%S", tm);
@@ -1045,7 +1045,7 @@ int cHttpResource::getQueryAttributeValue(vector<sQueryAVP> *avps, string attr,
return found;
}
-int cHttpResource::parseFiles(vector<sFileEntry> *entries, string prefix, string dir_base, string dir_name, struct stat *statbuf) {
+int cHttpResource::parseFiles(vector<sFileEntry> *entries, string prefix, string dir_base, string dir_name, struct stat64 *statbuf) {
char pathbuf[4096];
string link;
DIR *dir;
@@ -1063,7 +1063,7 @@ int cHttpResource::parseFiles(vector<sFileEntry> *entries, string prefix, string
#endif
dir = opendir(dir_comp.c_str());
- if (stat(dir_comp.c_str(), statbuf) < 0)
+ if (stat64(dir_comp.c_str(), statbuf) < 0)
return ERROR;
while ((de = readdir(dir)) != NULL) {
@@ -1074,7 +1074,7 @@ int cHttpResource::parseFiles(vector<sFileEntry> *entries, string prefix, string
strcpy(pathbuf, dir_comp.c_str());
strcat(pathbuf, de->d_name);
- stat(pathbuf, statbuf);
+ stat64(pathbuf, statbuf);
if (S_ISDIR(statbuf->st_mode)) {
if (strcmp(&(pathbuf[strlen(pathbuf)-4]), ".rec") == 0) {
@@ -1105,14 +1105,15 @@ int cHttpResource::parseFiles(vector<sFileEntry> *entries, string prefix, string
}
}
else {
- entries->push_back(sFileEntry(prefix+de->d_name, pathbuf, 1));
+ if ((de->d_name)[0] != '.' )
+ entries->push_back(sFileEntry(prefix+de->d_name, pathbuf, 1));
}
}
closedir(dir);
return OKAY;
}
-int cHttpResource::sendManifest (struct stat *statbuf, bool is_hls) {
+int cHttpResource::sendManifest (struct stat64 *statbuf, bool is_hls) {
#ifndef STANDALONE
size_t pos = mPath.find_last_of ("/");
@@ -1255,7 +1256,7 @@ void cHttpResource::writeMPD(double duration, float seg_dur, int end_seg) {
sendHeaders(200, "OK", NULL, "application/x-mpegURL", mResponseMessage->size(), -1);
}
-int cHttpResource::sendMediaSegment (struct stat *statbuf) {
+int cHttpResource::sendMediaSegment (struct stat64 *statbuf) {
#ifndef STANDALONE
*(mLog->log()) << DEBUGPREFIX << " sendMediaSegment " << mPath << endl;
@@ -1374,7 +1375,7 @@ int cHttpResource::sendMediaSegment (struct stat *statbuf) {
<< endl;
#endif
snprintf(seg_fn, sizeof(seg_fn), mFileStructure.c_str(), mDir.c_str(), mVdrIdx);
- if (stat(seg_fn, statbuf) < 0) {
+ if (stat64(seg_fn, statbuf) < 0) {
*(mLog->log()) << DEBUGPREFIX
<< " file= " <<seg_fn << " does not exist"
<< endl;
@@ -1386,7 +1387,7 @@ int cHttpResource::sendMediaSegment (struct stat *statbuf) {
// loop over all idx files between start_idx and end_idx
for (int idx = (start_idx+1); idx < end_idx; idx ++) {
snprintf(seg_fn, sizeof(seg_fn), mFileStructure.c_str(), mDir.c_str(), idx);
- if (stat(seg_fn, statbuf) < 0) {
+ if (stat64(seg_fn, statbuf) < 0) {
*(mLog->log()) << DEBUGPREFIX
<< " for loop file= " <<seg_fn << " does not exist"
<< endl;
@@ -1428,7 +1429,7 @@ int cHttpResource::sendMediaSegment (struct stat *statbuf) {
return OKAY;
}
-int cHttpResource::sendMediaXml (struct stat *statbuf) {
+int cHttpResource::sendMediaXml (struct stat64 *statbuf) {
char pathbuf[4096];
string link;
string media_folder = mFactory->getConfig()->getMediaFolder();
@@ -1478,7 +1479,7 @@ int cHttpResource::sendMediaXml (struct stat *statbuf) {
return OKAY;
}
-int cHttpResource::sendVdrStatusXml (struct stat *statbuf) {
+int cHttpResource::sendVdrStatusXml (struct stat64 *statbuf) {
#ifndef STANDALONE
@@ -1517,7 +1518,7 @@ int cHttpResource::sendVdrStatusXml (struct stat *statbuf) {
return OKAY;
}
-int cHttpResource::sendEpgXml (struct stat *statbuf) {
+int cHttpResource::sendEpgXml (struct stat64 *statbuf) {
#ifndef STANDALONE
char f[400];
@@ -1684,7 +1685,7 @@ int cHttpResource::sendEpgXml (struct stat *statbuf) {
return OKAY;
}
-int cHttpResource::sendChannelsXml (struct stat *statbuf) {
+int cHttpResource::sendChannelsXml (struct stat64 *statbuf) {
#ifndef STANDALONE
char f[400];
@@ -1876,7 +1877,7 @@ int cHttpResource::receiveResume() {
return OKAY;
}
-//int cHttpResource::sendResumeXml (struct stat *statbuf) {
+//int cHttpResource::sendResumeXml (struct stat64 *statbuf) {
int cHttpResource::sendResumeXml () {
#ifndef STANDALONE
@@ -1969,7 +1970,7 @@ int cHttpResource::deleteRecording() {
}
-int cHttpResource::sendRecordingsXml(struct stat *statbuf) {
+int cHttpResource::sendRecordingsXml(struct stat64 *statbuf) {
#ifndef STANDALONE
mResponseMessage = new string();
@@ -2175,7 +2176,7 @@ int cHttpResource::sendRecordingsXml(struct stat *statbuf) {
return OKAY;
}
-bool cHttpResource::isTimeRequest(struct stat *statbuf) {
+bool cHttpResource::isTimeRequest(struct stat64 *statbuf) {
vector<sQueryAVP> avps;
parseQueryLine(&avps);
@@ -2334,7 +2335,7 @@ bool cHttpResource::isTimeRequest(struct stat *statbuf) {
int vdr_idx = mVdrIdx;
while (more_to_go) {
snprintf(pathbuf, sizeof(pathbuf), mFileStructure.c_str(), mPath.c_str(), vdr_idx);
- if (stat(pathbuf, statbuf) >= 0) {
+ if (stat64(pathbuf, statbuf) >= 0) {
*(mLog->log())<< " found for " << pathbuf << endl;
file_size += statbuf->st_size;
}
@@ -2359,7 +2360,7 @@ bool cHttpResource::isTimeRequest(struct stat *statbuf) {
return true;
}
-int cHttpResource::sendVdrDir(struct stat *statbuf) {
+int cHttpResource::sendVdrDir(struct stat64 *statbuf) {
#ifndef DEBUG
*(mLog->log())<< DEBUGPREFIX << " *** sendVdrDir mPath= " << mPath << endl;
@@ -2397,7 +2398,7 @@ int cHttpResource::sendVdrDir(struct stat *statbuf) {
while (more_to_go) {
vdr_idx ++;
snprintf(pathbuf, sizeof(pathbuf), mFileStructure.c_str(), mPath.c_str(), vdr_idx);
- if (stat(pathbuf, statbuf) >= 0) {
+ if (stat64(pathbuf, statbuf) >= 0) {
#ifndef DEBUG
*(mLog->log())<< " found for " << pathbuf << endl;
#endif
@@ -2583,7 +2584,7 @@ void cHttpResource::sendHeaders(int status, const char *title, const char *extra
}
-int cHttpResource::sendFile(struct stat *statbuf) {
+int cHttpResource::sendFile(struct stat64 *statbuf) {
// Send the First Datachunk, incl all headers
*(mLog->log())<< DEBUGPREFIX