mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 17:31:20 +02:00
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@27 e54a6e83-5905-42d5-8d5c-058d10e6a962
57 lines
1.4 KiB
C++
57 lines
1.4 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);
|
|
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__ */
|