diff options
author | thlo <t.lohmar@gmx.de> | 2013-05-10 13:17:30 +0200 |
---|---|---|
committer | thlo <t.lohmar@gmx.de> | 2013-05-10 13:17:30 +0200 |
commit | b08431d6b45acada11104c775d3fb56e907dfa5e (patch) | |
tree | 7d638e18ad1e9bd67cd1c66d85c436243e6efef6 | |
parent | 9f8fa7d280397e1d79c0cb57969096b052d194fb (diff) | |
download | vdr-plugin-smarttvweb-b08431d6b45acada11104c775d3fb56e907dfa5e.tar.gz vdr-plugin-smarttvweb-b08431d6b45acada11104c775d3fb56e907dfa5e.tar.bz2 |
HTTP Error responses are numbered (prep for multi-language).
-rw-r--r-- | responsefile.c | 6 | ||||
-rw-r--r-- | responsevdrdir.c | 34 |
2 files changed, 20 insertions, 20 deletions
diff --git a/responsefile.c b/responsefile.c index 9724957..938d8ef 100644 --- a/responsefile.c +++ b/responsefile.c @@ -83,7 +83,7 @@ int cResponseFile::sendFile() { struct stat64 statbuf; if (stat64((mRequest->mPath).c_str(), &statbuf) < 0) { - sendError(404, "Not Found", NULL, "File not found."); + sendError(404, "Not Found", NULL, "003 File not found."); return OKAY; } *(mLog->log())<< DEBUGPREFIX @@ -93,14 +93,14 @@ int cResponseFile::sendFile() { char f[400]; if (openFile((mRequest->mPath).c_str()) == ERROR) { - sendError(403, "Forbidden", NULL, "Access denied."); + sendError(403, "Forbidden", NULL, "001 Access denied."); return OKAY; } mFile = fopen((mRequest->mPath).c_str(), "r"); if (!mFile) { - sendError(403, "Forbidden", NULL, "Access denied."); + sendError(403, "Forbidden", NULL, "001 Access denied."); return OKAY; } diff --git a/responsevdrdir.c b/responsevdrdir.c index 50949d5..0d1498c 100644 --- a/responsevdrdir.c +++ b/responsevdrdir.c @@ -121,7 +121,7 @@ bool cResponseVdrDir::isTimeRequest(struct stat *statbuf) { if (rec == NULL) { *(mLog->log())<< DEBUGPREFIX << " Error: Did not find recording= " << mRequest->mPath << endl; - sendError(404, "Not Found", NULL, "File not found."); + sendError(404, "Not Found", NULL, "003 File not found."); return true; } @@ -129,7 +129,7 @@ bool cResponseVdrDir::isTimeRequest(struct stat *statbuf) { double dur = rec->NumFrames() * fps; bool is_pes = rec->IsPesRecording(); if (dur < time) { - sendError(400, "Bad Request", NULL, "Time to large."); + sendError(400, "Bad Request", NULL, "013 Time to large."); return true; } @@ -150,7 +150,7 @@ bool cResponseVdrDir::isTimeRequest(struct stat *statbuf) { *(mLog->log()) << DEBUGPREFIX << " failed to open idx file = "<< (mRequest->mDir +"/index").c_str() << endl; - sendError(404, "Not Found", NULL, "Failed to open Index file"); + sendError(404, "Not Found", NULL, "004 Failed to open Index file"); return OKAY; } @@ -170,7 +170,7 @@ bool cResponseVdrDir::isTimeRequest(struct stat *statbuf) { *(mLog->log())<<DEBUGPREFIX << " issue while reading, buffered_indexes <=0" << endl; delete[] index_buf; - sendError(404, "Not Found", NULL, "Failed to read Index file"); + sendError(404, "Not Found", NULL, "005 Failed to read Index file"); return OKAY; } @@ -215,7 +215,7 @@ bool cResponseVdrDir::isTimeRequest(struct stat *statbuf) { if (!found_it) { delete[] index_buf; - sendError(404, "Not Found", NULL, "Failed to read Index file"); + sendError(404, "Not Found", NULL, "005 Failed to read Index file"); return OKAY; } @@ -235,7 +235,7 @@ bool cResponseVdrDir::isTimeRequest(struct stat *statbuf) { << " Opening Path= " << pathbuf << endl; if (openFile(pathbuf) != OKAY) { - sendError(403, "Forbidden", NULL, "Access denied."); + sendError(403, "Forbidden", NULL, "001 Access denied."); return true; } @@ -393,7 +393,7 @@ int cResponseVdrDir::sendVdrDir(struct stat *statbuf) { *(mLog->log())<< DEBUGPREFIX << " No video file in the directory" << endl; - sendError(404, "Not Found", NULL, "File not found."); + sendError(404, "Not Found", NULL, "003 File not found."); return OKAY; } @@ -425,7 +425,7 @@ int cResponseVdrDir::sendVdrDir(struct stat *statbuf) { snprintf(pathbuf, sizeof(pathbuf), mFileStructure.c_str(), (mRequest->mPath).c_str(), file_sizes[cur_idx].sIdx); if (openFile(pathbuf) != OKAY) { - sendError(403, "Forbidden", NULL, "Access denied."); + sendError(403, "Forbidden", NULL, "001 Access denied."); return OKAY; } @@ -443,7 +443,7 @@ int cResponseVdrDir::sendVdrDir(struct stat *statbuf) { if (mIsRecording && ((mRequest->rangeHdr).begin > total_file_size)) { *(mLog->log()) << DEBUGPREFIX << " ERROR: Not yet available" << endl; - sendError(404, "Not Found", NULL, "File not found."); + sendError(404, "Not Found", NULL, "003 File not found."); return OKAY; } cur_idx = file_sizes.size() -1; @@ -478,7 +478,7 @@ int cResponseVdrDir::sendVdrDir(struct stat *statbuf) { << file_sizes[cur_idx].sFirstOffset << " rangeHdr.begin= " << (mRequest->rangeHdr).begin << " vdr_no= " << file_sizes[cur_idx].sIdx << endl; *(mLog->log())<< "---------------" << endl; - sendError(403, "Forbidden", NULL, "Access denied."); + sendError(403, "Forbidden", NULL, "001 Access denied."); return OKAY; } mRequest->mDir = mRequest->mPath; @@ -562,7 +562,7 @@ int cResponseVdrDir::sendMediaSegment (struct stat *statbuf) { *(mLog->log()) << DEBUGPREFIX << " failed to open idx file = "<< (mRequest->mDir +"/index").c_str() << endl; - sendError(404, "Not Found", NULL, "Failed to open Index file"); + sendError(404, "Not Found", NULL, "004 Failed to open Index file"); return OKAY; } @@ -581,7 +581,7 @@ int cResponseVdrDir::sendMediaSegment (struct stat *statbuf) { *(mLog->log())<<DEBUGPREFIX << " issue while reading" << endl; delete[] index_buf; - sendError(404, "Not Found", NULL, "Failed to read Index file"); + sendError(404, "Not Found", NULL, "005 Failed to read Index file"); return OKAY; } @@ -671,17 +671,17 @@ int cResponseVdrDir::sendMediaSegment (struct stat *statbuf) { } if (error){ - sendError(404, "Not Found", NULL, "Not all inputs exists"); + sendError(404, "Not Found", NULL, "006 Not all inputs exists"); return OKAY; } // mContentType = VDRDIR; if (openFile(seg_fn) != OKAY) { - *(mLog->log())<< DEBUGPREFIX << " Failed to open file= " << seg_fn - << " mRemLength= " << mRemLength<< endl; - sendError(404, "Not Found", NULL, "File not found."); - return OKAY; + *(mLog->log())<< DEBUGPREFIX << " Failed to open file= " << seg_fn + << " mRemLength= " << mRemLength<< endl; + sendError(404, "Not Found", NULL, "003 File not found."); + return OKAY; } fseek(mFile, start_offset, SEEK_SET); |