mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 02:11:04 +02:00
(This re-applies most of the patches I've reverted about two hours ago.)
Origin commit data
------------------
Branch: ni/coolstream
Commit: ff46970457
Author: martii <m4rtii@gmx.de>
Date: 2014-07-20 (Sun, 20 Jul 2014)
------------------
This commit was generated by Migit
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
//=============================================================================
|
|
// YHTTPD
|
|
// Response
|
|
//=============================================================================
|
|
|
|
#ifndef __yhttpd_response_h__
|
|
#define __yhttpd_response_h__
|
|
|
|
// c++
|
|
#include <string>
|
|
// yhttpd
|
|
#include <yconfig.h>
|
|
#include "ytypes_globals.h"
|
|
#include "yhook.h"
|
|
|
|
// forward declaration
|
|
class CWebserver;
|
|
class CWebserverConnection;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
class CWebserverResponse
|
|
{
|
|
private:
|
|
|
|
protected:
|
|
bool WriteData(char const *data, long length);
|
|
bool Sendfile(std::string filename, off_t start = 0, off_t end = -1);
|
|
std::string redirectURI; // URI for redirection else: empty
|
|
|
|
public:
|
|
class CWebserver *Webserver;
|
|
class CWebserverConnection *Connection;
|
|
|
|
// con/destructors
|
|
CWebserverResponse();
|
|
CWebserverResponse(CWebserver *pWebserver);
|
|
|
|
// response control
|
|
bool SendResponse(void);
|
|
|
|
// output methods
|
|
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()); }
|
|
|
|
// Headers
|
|
void SendError(HttpResponseType responseType) {SendHeader(responseType, false, "text/html");}
|
|
void SendHeader(HttpResponseType responseType, bool cache=false, std::string ContentType="text/html");
|
|
|
|
// Helpers
|
|
std::string GetContentType(std::string ext);
|
|
};
|
|
|
|
#endif /* __yhttpd_response_h__ */
|