HTTP proxy rewrite, by Wouter Spruit.

This commit is contained in:
Thulinma 2014-06-18 15:00:26 +02:00
parent 00d1dfb1e5
commit 81d56bc04b
13 changed files with 191 additions and 244 deletions

View file

@ -68,34 +68,35 @@ namespace Mist {
}
void Input::checkHeaderTimes(std::string streamFile){
if ( streamFile == "-" ){
return;
}
std::string headerFile = streamFile + ".dtsh";
FILE * tmp = fopen(headerFile.c_str(),"r");
if (tmp == NULL) {
if (tmp == NULL) {
INFO_MSG("can't open file: %s (no header times compared, nothing removed)", headerFile.c_str() );
return;
}
struct stat bufStream;
return;
}
struct stat bufStream;
struct stat bufHeader;
//fstat(fileno(streamFile), &bufStream);
//fstat(fileno(tmp), &bufHeader);
if (stat(streamFile.c_str(), &bufStream) !=0 || stat(headerFile.c_str(), &bufHeader) !=0){
ERROR_MSG("could not get file info (no header times compared, nothing removed)");
ERROR_MSG("could not get file info (no header times compared, nothing removed)");
fclose(tmp);
return;
}
int timeStream = bufStream.st_mtime;
return;
}
int timeStream = bufStream.st_mtime;
int timeHeader = bufHeader.st_mtime;
fclose(tmp);
INFO_MSG("time header: %i time stream: %i ", timeHeader, timeStream);
if (timeHeader < timeStream) {
INFO_MSG("removing old header file: %s ",headerFile.c_str());
//delete filename
remove(headerFile.c_str());
INFO_MSG("removing old header file: %s ",headerFile.c_str());
//delete filename
remove(headerFile.c_str());
}
}
int Input::run() {
if (config->getBool("json")) {
std::cerr << capa.toString() << std::endl;