nhttpd: let sendfile() support files >= 2GB

This commit is contained in:
martii
2014-07-20 10:57:18 +02:00
committed by [CST] Focus
parent 0149b27760
commit d71958ba8c
9 changed files with 50 additions and 34 deletions

View File

@@ -47,6 +47,7 @@
//=============================================================================
#ifndef __yhttpd_yhook_h__
#define __yhttpd_yhook_h__
#include <unistd.h>
// C++
#include <string>
#include <list>
@@ -128,7 +129,7 @@ public:
HttpResponseType httpStatus; // http-status code for response
std::string ResponseMimeType; // mime-type for response
std::string NewURL; // new URL for Redirection
long ContentLength; // Length of Response Body
off_t ContentLength; // Length of Response Body
time_t LastModified; // Last Modified Time of Item to send / -1 dynamic content
std::string Sendfile; // Path & Name (local os style) of file to send
bool keep_alive;
@@ -173,8 +174,8 @@ public:
void SetError(HttpResponseType responseType, THandleStatus _status)
{SetError(responseType); status = _status;}
// others
long GetContentLength()
{return (status==HANDLED_SENDFILE)?ContentLength : (long)yresult.length();}
off_t GetContentLength()
{return (status==HANDLED_SENDFILE)?ContentLength : (off_t)yresult.length();}
// output methods
std::string BuildHeader(bool cache = false);
void addResult(const std::string& result) {yresult += result;}