mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix styling violations
This commit is contained in:
parent
4667b801d3
commit
102ee55183
2 changed files with 8 additions and 5 deletions
|
|
@ -98,6 +98,7 @@ local _udp_server_callbacks = {}
|
||||||
local _udp_client_datagram_callbacks = {}
|
local _udp_client_datagram_callbacks = {}
|
||||||
local _udp_client_open_callbacks = {}
|
local _udp_client_open_callbacks = {}
|
||||||
local _http_response_callbacks = {}
|
local _http_response_callbacks = {}
|
||||||
|
local _http_server_handlers = {}
|
||||||
|
|
||||||
local http_request = network.__request
|
local http_request = network.__request
|
||||||
local open_tcp = network.__open_tcp
|
local open_tcp = network.__open_tcp
|
||||||
|
|
@ -225,8 +226,6 @@ network.udp_connect = function (address, port, datagramHandler, openCallback)
|
||||||
return socket
|
return socket
|
||||||
end
|
end
|
||||||
|
|
||||||
local _http_server_handlers = {}
|
|
||||||
|
|
||||||
local HttpRequest = {__index={
|
local HttpRequest = {__index={
|
||||||
respond=function(self, status, body, headers)
|
respond=function(self, status, body, headers)
|
||||||
if self.responded then
|
if self.responded then
|
||||||
|
|
@ -244,7 +243,7 @@ local HttpRequest = {__index={
|
||||||
}}
|
}}
|
||||||
|
|
||||||
network.http_open = function(port, handler, timeout_ms)
|
network.http_open = function(port, handler, timeout_ms)
|
||||||
if handler == nil then
|
if type(handler) ~= "function" then
|
||||||
error "http server cannot be opened without a request handler"
|
error "http server cannot be opened without a request handler"
|
||||||
end
|
end
|
||||||
local socket = setmetatable({id=http_open(port, timeout_ms or 60000)}, ServerSocket)
|
local socket = setmetatable({id=http_open(port, timeout_ms or 60000)}, ServerSocket)
|
||||||
|
|
|
||||||
|
|
@ -1031,10 +1031,14 @@ namespace {
|
||||||
size_t pos = lineEnd == std::string::npos ? head.size() : lineEnd + 2;
|
size_t pos = lineEnd == std::string::npos ? head.size() : lineEnd + 2;
|
||||||
while (pos < head.size()) {
|
while (pos < head.size()) {
|
||||||
size_t next = head.find("\r\n", pos);
|
size_t next = head.find("\r\n", pos);
|
||||||
if (next == std::string::npos) next = head.size();
|
if (next == std::string::npos) {
|
||||||
|
next = head.size();
|
||||||
|
}
|
||||||
std::string line = head.substr(pos, next - pos);
|
std::string line = head.substr(pos, next - pos);
|
||||||
pos = next + 2;
|
pos = next + 2;
|
||||||
if (line.empty() || line.find(':') == std::string::npos) continue;
|
if (line.empty() || line.find(':') == std::string::npos) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto [name, value] = util::split_at(line, ':');
|
auto [name, value] = util::split_at(line, ':');
|
||||||
util::trim(name);
|
util::trim(name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue