mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 04:16:50 +01:00
Added SimpleWebServerRequest.
This commit is contained in:
parent
92040597e9
commit
617d3e6321
@ -26,6 +26,7 @@ sources = [
|
||||
|
||||
"http_server_simple/http_server_simple.cpp",
|
||||
"http_server_simple/web_server_simple.cpp",
|
||||
"http_server_simple/simple_web_server_request.cpp",
|
||||
]
|
||||
|
||||
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
||||
|
@ -102,6 +102,7 @@ void HTTPServerSimple::_send_response() {
|
||||
s += "Cache-Control: no-store, max-age=0\r\n";
|
||||
s += "\r\n";
|
||||
CharString cs = s.utf8();
|
||||
|
||||
Error err = peer->put_data((const uint8_t *)cs.get_data(), cs.size() - 1);
|
||||
if (err != OK) {
|
||||
memdelete(f);
|
||||
@ -120,6 +121,7 @@ void HTTPServerSimple::_send_response() {
|
||||
ERR_FAIL();
|
||||
}
|
||||
}
|
||||
|
||||
memdelete(f);
|
||||
}
|
||||
|
||||
|
78
modules/web/http_server_simple/simple_web_server_request.cpp
Normal file
78
modules/web/http_server_simple/simple_web_server_request.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
#include "simple_web_server_request.h"
|
||||
|
||||
#include "../http/web_server.h"
|
||||
#include "../http/web_server_cookie.h"
|
||||
#include "core/object.h"
|
||||
|
||||
#include "../http/http_session.h"
|
||||
|
||||
#include "../http/http_session_manager.h"
|
||||
#include "../http/web_node.h"
|
||||
|
||||
#include "../http/web_permission.h"
|
||||
|
||||
String SimpleWebServerRequest::get_cookie(const String &key) {
|
||||
return "";
|
||||
}
|
||||
|
||||
void SimpleWebServerRequest::add_cookie(const Ref<WebServerCookie> &cookie) {
|
||||
}
|
||||
|
||||
void SimpleWebServerRequest::remove_cookie(const String &key) {
|
||||
}
|
||||
|
||||
HTTPServerEnums::HTTPMethod SimpleWebServerRequest::get_method() const {
|
||||
return HTTPServerEnums::HTTP_METHOD_GET;
|
||||
}
|
||||
|
||||
void SimpleWebServerRequest::parse_files() {
|
||||
}
|
||||
int SimpleWebServerRequest::get_file_count() const {
|
||||
return 0;
|
||||
}
|
||||
int SimpleWebServerRequest::get_file_length(const int index) const {
|
||||
return 0;
|
||||
}
|
||||
const uint8_t *SimpleWebServerRequest::get_file_data(const int index) const {
|
||||
return nullptr;
|
||||
}
|
||||
String SimpleWebServerRequest::get_file_data_str(const int index) const {
|
||||
return "";
|
||||
}
|
||||
|
||||
String SimpleWebServerRequest::get_parameter(const String &key) const {
|
||||
return "";
|
||||
}
|
||||
|
||||
void SimpleWebServerRequest::send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code) {
|
||||
}
|
||||
|
||||
void SimpleWebServerRequest::send() {
|
||||
// if (connection_closed) {
|
||||
// SimpleWebServerRequestPool::return_request(this);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// SimpleWebServerRequestPool::return_request(this);
|
||||
}
|
||||
|
||||
void SimpleWebServerRequest::send_file(const String &p_file_path) {
|
||||
// SimpleWebServerRequestPool::return_request(this);
|
||||
}
|
||||
|
||||
String SimpleWebServerRequest::parser_get_path() {
|
||||
return "";
|
||||
}
|
||||
|
||||
String SimpleWebServerRequest::get_host() const {
|
||||
return "";
|
||||
}
|
||||
|
||||
SimpleWebServerRequest::SimpleWebServerRequest() {
|
||||
}
|
||||
|
||||
SimpleWebServerRequest::~SimpleWebServerRequest() {
|
||||
}
|
||||
|
||||
void SimpleWebServerRequest::_bind_methods() {
|
||||
}
|
51
modules/web/http_server_simple/simple_web_server_request.h
Normal file
51
modules/web/http_server_simple/simple_web_server_request.h
Normal file
@ -0,0 +1,51 @@
|
||||
#ifndef SIMPLE_WEB_SERVER_REQUEST_H
|
||||
#define SIMPLE_WEB_SERVER_REQUEST_H
|
||||
|
||||
#include "core/dictionary.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "../http/web_server_request.h"
|
||||
|
||||
#include "../http/http_server_enums.h"
|
||||
|
||||
class WebServer;
|
||||
class WebServerCookie;
|
||||
class HTTPSession;
|
||||
class WebPermission;
|
||||
class WebNode;
|
||||
|
||||
class SimpleWebServerRequest : public WebServerRequest {
|
||||
GDCLASS(SimpleWebServerRequest, WebServerRequest);
|
||||
|
||||
public:
|
||||
virtual String get_cookie(const String &key);
|
||||
virtual void add_cookie(const Ref<WebServerCookie> &cookie);
|
||||
virtual void remove_cookie(const String &key);
|
||||
|
||||
virtual HTTPServerEnums::HTTPMethod get_method() const;
|
||||
|
||||
virtual void parse_files();
|
||||
virtual int get_file_count() const;
|
||||
virtual int get_file_length(const int index) const;
|
||||
virtual const uint8_t *get_file_data(const int index) const;
|
||||
virtual String get_file_data_str(const int index) const;
|
||||
|
||||
virtual String get_parameter(const String &key) const;
|
||||
|
||||
virtual void send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code = HTTPServerEnums::HTTP_STATUS_CODE_302_FOUND);
|
||||
virtual void send();
|
||||
virtual void send_file(const String &p_file_path);
|
||||
virtual String parser_get_path();
|
||||
virtual String get_host() const;
|
||||
|
||||
virtual String get_path_full() const;
|
||||
|
||||
SimpleWebServerRequest();
|
||||
~SimpleWebServerRequest();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user