51 lines
935 B
C++
51 lines
935 B
C++
#ifndef CCWeb_Response_H
|
|
#define CCWeb_Response_H
|
|
#pragma once
|
|
|
|
#include "CCRequest.h"
|
|
#include "../../include/CCSocket.h"
|
|
#include "CCString.h"
|
|
#include "mutex"
|
|
|
|
class HTTPResponse: public CCRequest, public CORS {
|
|
public:
|
|
HTTPResponse() = default;
|
|
HTTPResponse(CCSocket& socket,CORS& cors);
|
|
void HtmlTextWrite(const CCString& str);
|
|
bool HtmlWrite(const CCString& str);
|
|
void Write(const CCString& str,const char* type = "text/plain");
|
|
bool WriteFile(const CCString& Path);
|
|
void Send(const CCString& string);
|
|
void ResponseOK();
|
|
|
|
|
|
private:
|
|
bool SendResources(const char* Path, const char* Mode = "rb");
|
|
CCSocket Client;
|
|
std::mutex Mutex;
|
|
CORS CORSConfig;
|
|
|
|
|
|
private:
|
|
|
|
|
|
};
|
|
|
|
|
|
class CCResponse:public HTTPResponse
|
|
{
|
|
public:
|
|
|
|
public:
|
|
CCResponse() = default;
|
|
CCResponse(CCSocket& socket,CORS& cors);
|
|
HTTPResponse GetWiter();
|
|
|
|
private:
|
|
CCSocket Client;
|
|
CORS Cors;
|
|
};
|
|
|
|
|
|
#endif
|