mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-08 00:15:04 -05:00
Compare commits
11 Commits
v6.22.3
...
064a61988a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
064a61988a | ||
|
|
2ab7f85ccd | ||
|
|
e4c30eb0dd | ||
|
|
d4e57d9427 | ||
|
|
9a71190ca1 | ||
|
|
a7dcbb143e | ||
|
|
a6a0f80b12 | ||
|
|
682834b87d | ||
|
|
184d6100dc | ||
|
|
0c52d789a9 | ||
|
|
e33334f11a |
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(xmrig)
|
project(xmrig)
|
||||||
|
|
||||||
option(WITH_HWLOC "Enable hwloc support" ON)
|
option(WITH_HWLOC "Enable hwloc support" ON)
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ else()
|
|||||||
set(WITH_VAES OFF)
|
set(WITH_VAES OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_definitions(-DRAPIDJSON_WRITE_DEFAULT_FLAGS=6) # rapidjson::kWriteNanAndInfFlag | rapidjson::kWriteNanAndInfNullFlag
|
||||||
|
|
||||||
if (ARM_V8)
|
if (ARM_V8)
|
||||||
set(ARM_TARGET 8)
|
set(ARM_TARGET 8)
|
||||||
elseif (ARM_V7)
|
elseif (ARM_V7)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (XMRIG_OS_WIN)
|
if (XMRIG_OS_WIN)
|
||||||
add_definitions(-DWIN32 -DXMRIG_OS_WIN)
|
add_definitions(-DWIN32 -DXMRIG_OS_WIN)
|
||||||
elseif(XMRIG_OS_APPLE)
|
elseif(XMRIG_OS_APPLE)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
HWLOC_VERSION_MAJOR="2"
|
HWLOC_VERSION_MAJOR="2"
|
||||||
HWLOC_VERSION_MINOR="11"
|
HWLOC_VERSION_MINOR="12"
|
||||||
HWLOC_VERSION_PATCH="2"
|
HWLOC_VERSION_PATCH="1"
|
||||||
|
|
||||||
HWLOC_VERSION="${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}.${HWLOC_VERSION_PATCH}"
|
HWLOC_VERSION="${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}.${HWLOC_VERSION_PATCH}"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
OPENSSL_VERSION="3.0.15"
|
OPENSSL_VERSION="3.0.16"
|
||||||
|
|
||||||
mkdir -p deps
|
mkdir -p deps
|
||||||
mkdir -p deps/include
|
mkdir -p deps/include
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
UV_VERSION="1.49.2"
|
UV_VERSION="1.51.0"
|
||||||
|
|
||||||
mkdir -p deps
|
mkdir -p deps
|
||||||
mkdir -p deps/include
|
mkdir -p deps/include
|
||||||
|
|||||||
2
src/3rdparty/argon2/CMakeLists.txt
vendored
2
src/3rdparty/argon2/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(argon2 C)
|
project(argon2 C)
|
||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
|||||||
2
src/3rdparty/hwloc/CMakeLists.txt
vendored
2
src/3rdparty/hwloc/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project (hwloc C)
|
project (hwloc C)
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
|||||||
2
src/3rdparty/libethash/CMakeLists.txt
vendored
2
src/3rdparty/libethash/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project (ethash C)
|
project (ethash C)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
|
||||||
|
|||||||
225
src/3rdparty/llhttp/api.c
vendored
225
src/3rdparty/llhttp/api.c
vendored
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "llhttp.h"
|
#include "llhttp.h"
|
||||||
|
|
||||||
#define CALLBACK_MAYBE(PARSER, NAME, ...) \
|
#define CALLBACK_MAYBE(PARSER, NAME) \
|
||||||
do { \
|
do { \
|
||||||
const llhttp_settings_t* settings; \
|
const llhttp_settings_t* settings; \
|
||||||
settings = (const llhttp_settings_t*) (PARSER)->settings; \
|
settings = (const llhttp_settings_t*) (PARSER)->settings; \
|
||||||
@@ -12,7 +12,22 @@
|
|||||||
err = 0; \
|
err = 0; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
err = settings->NAME(__VA_ARGS__); \
|
err = settings->NAME((PARSER)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define SPAN_CALLBACK_MAYBE(PARSER, NAME, START, LEN) \
|
||||||
|
do { \
|
||||||
|
const llhttp_settings_t* settings; \
|
||||||
|
settings = (const llhttp_settings_t*) (PARSER)->settings; \
|
||||||
|
if (settings == NULL || settings->NAME == NULL) { \
|
||||||
|
err = 0; \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
err = settings->NAME((PARSER), (START), (LEN)); \
|
||||||
|
if (err == -1) { \
|
||||||
|
err = HPE_USER; \
|
||||||
|
llhttp_set_error_reason((PARSER), "Span callback error in " #NAME); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
void llhttp_init(llhttp_t* parser, llhttp_type_t type,
|
void llhttp_init(llhttp_t* parser, llhttp_type_t type,
|
||||||
@@ -31,21 +46,25 @@ extern int wasm_on_url(llhttp_t* p, const char* at, size_t length);
|
|||||||
extern int wasm_on_status(llhttp_t* p, const char* at, size_t length);
|
extern int wasm_on_status(llhttp_t* p, const char* at, size_t length);
|
||||||
extern int wasm_on_header_field(llhttp_t* p, const char* at, size_t length);
|
extern int wasm_on_header_field(llhttp_t* p, const char* at, size_t length);
|
||||||
extern int wasm_on_header_value(llhttp_t* p, const char* at, size_t length);
|
extern int wasm_on_header_value(llhttp_t* p, const char* at, size_t length);
|
||||||
extern int wasm_on_headers_complete(llhttp_t * p);
|
extern int wasm_on_headers_complete(llhttp_t * p, int status_code,
|
||||||
|
uint8_t upgrade, int should_keep_alive);
|
||||||
extern int wasm_on_body(llhttp_t* p, const char* at, size_t length);
|
extern int wasm_on_body(llhttp_t* p, const char* at, size_t length);
|
||||||
extern int wasm_on_message_complete(llhttp_t * p);
|
extern int wasm_on_message_complete(llhttp_t * p);
|
||||||
|
|
||||||
|
static int wasm_on_headers_complete_wrap(llhttp_t* p) {
|
||||||
|
return wasm_on_headers_complete(p, p->status_code, p->upgrade,
|
||||||
|
llhttp_should_keep_alive(p));
|
||||||
|
}
|
||||||
|
|
||||||
const llhttp_settings_t wasm_settings = {
|
const llhttp_settings_t wasm_settings = {
|
||||||
wasm_on_message_begin,
|
.on_message_begin = wasm_on_message_begin,
|
||||||
wasm_on_url,
|
.on_url = wasm_on_url,
|
||||||
wasm_on_status,
|
.on_status = wasm_on_status,
|
||||||
wasm_on_header_field,
|
.on_header_field = wasm_on_header_field,
|
||||||
wasm_on_header_value,
|
.on_header_value = wasm_on_header_value,
|
||||||
wasm_on_headers_complete,
|
.on_headers_complete = wasm_on_headers_complete_wrap,
|
||||||
wasm_on_body,
|
.on_body = wasm_on_body,
|
||||||
wasm_on_message_complete,
|
.on_message_complete = wasm_on_message_complete,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -59,6 +78,8 @@ void llhttp_free(llhttp_t* parser) {
|
|||||||
free(parser);
|
free(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // defined(__wasm__)
|
||||||
|
|
||||||
/* Some getters required to get stuff from the parser */
|
/* Some getters required to get stuff from the parser */
|
||||||
|
|
||||||
uint8_t llhttp_get_type(llhttp_t* parser) {
|
uint8_t llhttp_get_type(llhttp_t* parser) {
|
||||||
@@ -85,14 +106,12 @@ uint8_t llhttp_get_upgrade(llhttp_t* parser) {
|
|||||||
return parser->upgrade;
|
return parser->upgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(__wasm__)
|
|
||||||
|
|
||||||
|
|
||||||
void llhttp_reset(llhttp_t* parser) {
|
void llhttp_reset(llhttp_t* parser) {
|
||||||
llhttp_type_t type = parser->type;
|
llhttp_type_t type = parser->type;
|
||||||
const llhttp_settings_t* settings = parser->settings;
|
const llhttp_settings_t* settings = parser->settings;
|
||||||
void* data = parser->data;
|
void* data = parser->data;
|
||||||
uint8_t lenient_flags = parser->lenient_flags;
|
uint16_t lenient_flags = parser->lenient_flags;
|
||||||
|
|
||||||
llhttp__internal_init(parser);
|
llhttp__internal_init(parser);
|
||||||
|
|
||||||
@@ -123,7 +142,7 @@ llhttp_errno_t llhttp_finish(llhttp_t* parser) {
|
|||||||
|
|
||||||
switch (parser->finish) {
|
switch (parser->finish) {
|
||||||
case HTTP_FINISH_SAFE_WITH_CB:
|
case HTTP_FINISH_SAFE_WITH_CB:
|
||||||
CALLBACK_MAYBE(parser, on_message_complete, parser);
|
CALLBACK_MAYBE(parser, on_message_complete);
|
||||||
if (err != HPE_OK) return err;
|
if (err != HPE_OK) return err;
|
||||||
|
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
@@ -199,12 +218,21 @@ const char* llhttp_errno_name(llhttp_errno_t err) {
|
|||||||
const char* llhttp_method_name(llhttp_method_t method) {
|
const char* llhttp_method_name(llhttp_method_t method) {
|
||||||
#define HTTP_METHOD_GEN(NUM, NAME, STRING) case HTTP_##NAME: return #STRING;
|
#define HTTP_METHOD_GEN(NUM, NAME, STRING) case HTTP_##NAME: return #STRING;
|
||||||
switch (method) {
|
switch (method) {
|
||||||
HTTP_METHOD_MAP(HTTP_METHOD_GEN)
|
HTTP_ALL_METHOD_MAP(HTTP_METHOD_GEN)
|
||||||
default: abort();
|
default: abort();
|
||||||
}
|
}
|
||||||
#undef HTTP_METHOD_GEN
|
#undef HTTP_METHOD_GEN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* llhttp_status_name(llhttp_status_t status) {
|
||||||
|
#define HTTP_STATUS_GEN(NUM, NAME, STRING) case HTTP_STATUS_##NAME: return #STRING;
|
||||||
|
switch (status) {
|
||||||
|
HTTP_STATUS_MAP(HTTP_STATUS_GEN)
|
||||||
|
default: abort();
|
||||||
|
}
|
||||||
|
#undef HTTP_STATUS_GEN
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void llhttp_set_lenient_headers(llhttp_t* parser, int enabled) {
|
void llhttp_set_lenient_headers(llhttp_t* parser, int enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
@@ -232,103 +260,236 @@ void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void llhttp_set_lenient_transfer_encoding(llhttp_t* parser, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
parser->lenient_flags |= LENIENT_TRANSFER_ENCODING;
|
||||||
|
} else {
|
||||||
|
parser->lenient_flags &= ~LENIENT_TRANSFER_ENCODING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void llhttp_set_lenient_version(llhttp_t* parser, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
parser->lenient_flags |= LENIENT_VERSION;
|
||||||
|
} else {
|
||||||
|
parser->lenient_flags &= ~LENIENT_VERSION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void llhttp_set_lenient_data_after_close(llhttp_t* parser, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
parser->lenient_flags |= LENIENT_DATA_AFTER_CLOSE;
|
||||||
|
} else {
|
||||||
|
parser->lenient_flags &= ~LENIENT_DATA_AFTER_CLOSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void llhttp_set_lenient_optional_lf_after_cr(llhttp_t* parser, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
parser->lenient_flags |= LENIENT_OPTIONAL_LF_AFTER_CR;
|
||||||
|
} else {
|
||||||
|
parser->lenient_flags &= ~LENIENT_OPTIONAL_LF_AFTER_CR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
parser->lenient_flags |= LENIENT_OPTIONAL_CRLF_AFTER_CHUNK;
|
||||||
|
} else {
|
||||||
|
parser->lenient_flags &= ~LENIENT_OPTIONAL_CRLF_AFTER_CHUNK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void llhttp_set_lenient_optional_cr_before_lf(llhttp_t* parser, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
parser->lenient_flags |= LENIENT_OPTIONAL_CR_BEFORE_LF;
|
||||||
|
} else {
|
||||||
|
parser->lenient_flags &= ~LENIENT_OPTIONAL_CR_BEFORE_LF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
parser->lenient_flags |= LENIENT_SPACES_AFTER_CHUNK_SIZE;
|
||||||
|
} else {
|
||||||
|
parser->lenient_flags &= ~LENIENT_SPACES_AFTER_CHUNK_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_message_begin, s);
|
CALLBACK_MAYBE(s, on_message_begin);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_protocol(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
SPAN_CALLBACK_MAYBE(s, on_protocol, p, endp - p);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_protocol_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
CALLBACK_MAYBE(s, on_protocol_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_url(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_url(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_url, s, p, endp - p);
|
SPAN_CALLBACK_MAYBE(s, on_url, p, endp - p);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_url_complete(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_url_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_url_complete, s);
|
CALLBACK_MAYBE(s, on_url_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_status(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_status(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_status, s, p, endp - p);
|
SPAN_CALLBACK_MAYBE(s, on_status, p, endp - p);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_status_complete(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_status_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_status_complete, s);
|
CALLBACK_MAYBE(s, on_status_complete);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_method(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
SPAN_CALLBACK_MAYBE(s, on_method, p, endp - p);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_method_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
CALLBACK_MAYBE(s, on_method_complete);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_version(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
SPAN_CALLBACK_MAYBE(s, on_version, p, endp - p);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_version_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
CALLBACK_MAYBE(s, on_version_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_header_field(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_header_field(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_header_field, s, p, endp - p);
|
SPAN_CALLBACK_MAYBE(s, on_header_field, p, endp - p);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_header_field_complete(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_header_field_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_header_field_complete, s);
|
CALLBACK_MAYBE(s, on_header_field_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_header_value(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_header_value(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_header_value, s, p, endp - p);
|
SPAN_CALLBACK_MAYBE(s, on_header_value, p, endp - p);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_header_value_complete(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_header_value_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_header_value_complete, s);
|
CALLBACK_MAYBE(s, on_header_value_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_headers_complete(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_headers_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_headers_complete, s);
|
CALLBACK_MAYBE(s, on_headers_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_message_complete(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_message_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_message_complete, s);
|
CALLBACK_MAYBE(s, on_message_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_body(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_body(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_body, s, p, endp - p);
|
SPAN_CALLBACK_MAYBE(s, on_body, p, endp - p);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_chunk_header(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_chunk_header(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_chunk_header, s);
|
CALLBACK_MAYBE(s, on_chunk_header);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_chunk_extension_name(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
SPAN_CALLBACK_MAYBE(s, on_chunk_extension_name, p, endp - p);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_chunk_extension_name_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
CALLBACK_MAYBE(s, on_chunk_extension_name_complete);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_chunk_extension_value(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
SPAN_CALLBACK_MAYBE(s, on_chunk_extension_value, p, endp - p);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_chunk_extension_value_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
CALLBACK_MAYBE(s, on_chunk_extension_value_complete);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) {
|
int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||||
int err;
|
int err;
|
||||||
CALLBACK_MAYBE(s, on_chunk_complete, s);
|
CALLBACK_MAYBE(s, on_chunk_complete);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int llhttp__on_reset(llhttp_t* s, const char* p, const char* endp) {
|
||||||
|
int err;
|
||||||
|
CALLBACK_MAYBE(s, on_reset);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
253
src/3rdparty/llhttp/api.h
vendored
253
src/3rdparty/llhttp/api.h
vendored
@@ -1,253 +0,0 @@
|
|||||||
#ifndef INCLUDE_LLHTTP_API_H_
|
|
||||||
#define INCLUDE_LLHTTP_API_H_
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#if defined(__wasm__)
|
|
||||||
#define LLHTTP_EXPORT __attribute__((visibility("default")))
|
|
||||||
#else
|
|
||||||
#define LLHTTP_EXPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef llhttp__internal_t llhttp_t;
|
|
||||||
typedef struct llhttp_settings_s llhttp_settings_t;
|
|
||||||
|
|
||||||
typedef int (*llhttp_data_cb)(llhttp_t*, const char *at, size_t length);
|
|
||||||
typedef int (*llhttp_cb)(llhttp_t*);
|
|
||||||
|
|
||||||
struct llhttp_settings_s {
|
|
||||||
/* Possible return values 0, -1, `HPE_PAUSED` */
|
|
||||||
llhttp_cb on_message_begin;
|
|
||||||
|
|
||||||
llhttp_data_cb on_url;
|
|
||||||
llhttp_data_cb on_status;
|
|
||||||
llhttp_data_cb on_header_field;
|
|
||||||
llhttp_data_cb on_header_value;
|
|
||||||
|
|
||||||
/* Possible return values:
|
|
||||||
* 0 - Proceed normally
|
|
||||||
* 1 - Assume that request/response has no body, and proceed to parsing the
|
|
||||||
* next message
|
|
||||||
* 2 - Assume absence of body (as above) and make `llhttp_execute()` return
|
|
||||||
* `HPE_PAUSED_UPGRADE`
|
|
||||||
* -1 - Error
|
|
||||||
* `HPE_PAUSED`
|
|
||||||
*/
|
|
||||||
llhttp_cb on_headers_complete;
|
|
||||||
|
|
||||||
llhttp_data_cb on_body;
|
|
||||||
|
|
||||||
/* Possible return values 0, -1, `HPE_PAUSED` */
|
|
||||||
llhttp_cb on_message_complete;
|
|
||||||
|
|
||||||
/* When on_chunk_header is called, the current chunk length is stored
|
|
||||||
* in parser->content_length.
|
|
||||||
* Possible return values 0, -1, `HPE_PAUSED`
|
|
||||||
*/
|
|
||||||
llhttp_cb on_chunk_header;
|
|
||||||
llhttp_cb on_chunk_complete;
|
|
||||||
|
|
||||||
llhttp_cb on_url_complete;
|
|
||||||
llhttp_cb on_status_complete;
|
|
||||||
llhttp_cb on_header_field_complete;
|
|
||||||
llhttp_cb on_header_value_complete;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Initialize the parser with specific type and user settings.
|
|
||||||
*
|
|
||||||
* NOTE: lifetime of `settings` has to be at least the same as the lifetime of
|
|
||||||
* the `parser` here. In practice, `settings` has to be either a static
|
|
||||||
* variable or be allocated with `malloc`, `new`, etc.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_init(llhttp_t* parser, llhttp_type_t type,
|
|
||||||
const llhttp_settings_t* settings);
|
|
||||||
|
|
||||||
#if defined(__wasm__)
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
llhttp_t* llhttp_alloc(llhttp_type_t type);
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_free(llhttp_t* parser);
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
uint8_t llhttp_get_type(llhttp_t* parser);
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
uint8_t llhttp_get_http_major(llhttp_t* parser);
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
uint8_t llhttp_get_http_minor(llhttp_t* parser);
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
uint8_t llhttp_get_method(llhttp_t* parser);
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
int llhttp_get_status_code(llhttp_t* parser);
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
uint8_t llhttp_get_upgrade(llhttp_t* parser);
|
|
||||||
|
|
||||||
#endif // defined(__wasm__)
|
|
||||||
|
|
||||||
/* Reset an already initialized parser back to the start state, preserving the
|
|
||||||
* existing parser type, callback settings, user data, and lenient flags.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_reset(llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Initialize the settings object */
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_settings_init(llhttp_settings_t* settings);
|
|
||||||
|
|
||||||
/* Parse full or partial request/response, invoking user callbacks along the
|
|
||||||
* way.
|
|
||||||
*
|
|
||||||
* If any of `llhttp_data_cb` returns errno not equal to `HPE_OK` - the parsing
|
|
||||||
* interrupts, and such errno is returned from `llhttp_execute()`. If
|
|
||||||
* `HPE_PAUSED` was used as a errno, the execution can be resumed with
|
|
||||||
* `llhttp_resume()` call.
|
|
||||||
*
|
|
||||||
* In a special case of CONNECT/Upgrade request/response `HPE_PAUSED_UPGRADE`
|
|
||||||
* is returned after fully parsing the request/response. If the user wishes to
|
|
||||||
* continue parsing, they need to invoke `llhttp_resume_after_upgrade()`.
|
|
||||||
*
|
|
||||||
* NOTE: if this function ever returns a non-pause type error, it will continue
|
|
||||||
* to return the same error upon each successive call up until `llhttp_init()`
|
|
||||||
* is called.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len);
|
|
||||||
|
|
||||||
/* This method should be called when the other side has no further bytes to
|
|
||||||
* send (e.g. shutdown of readable side of the TCP connection.)
|
|
||||||
*
|
|
||||||
* Requests without `Content-Length` and other messages might require treating
|
|
||||||
* all incoming bytes as the part of the body, up to the last byte of the
|
|
||||||
* connection. This method will invoke `on_message_complete()` callback if the
|
|
||||||
* request was terminated safely. Otherwise a error code would be returned.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
llhttp_errno_t llhttp_finish(llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Returns `1` if the incoming message is parsed until the last byte, and has
|
|
||||||
* to be completed by calling `llhttp_finish()` on EOF
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
int llhttp_message_needs_eof(const llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Returns `1` if there might be any other messages following the last that was
|
|
||||||
* successfully parsed.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
int llhttp_should_keep_alive(const llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Make further calls of `llhttp_execute()` return `HPE_PAUSED` and set
|
|
||||||
* appropriate error reason.
|
|
||||||
*
|
|
||||||
* Important: do not call this from user callbacks! User callbacks must return
|
|
||||||
* `HPE_PAUSED` if pausing is required.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_pause(llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Might be called to resume the execution after the pause in user's callback.
|
|
||||||
* See `llhttp_execute()` above for details.
|
|
||||||
*
|
|
||||||
* Call this only if `llhttp_execute()` returns `HPE_PAUSED`.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_resume(llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Might be called to resume the execution after the pause in user's callback.
|
|
||||||
* See `llhttp_execute()` above for details.
|
|
||||||
*
|
|
||||||
* Call this only if `llhttp_execute()` returns `HPE_PAUSED_UPGRADE`
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_resume_after_upgrade(llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Returns the latest return error */
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
llhttp_errno_t llhttp_get_errno(const llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Returns the verbal explanation of the latest returned error.
|
|
||||||
*
|
|
||||||
* Note: User callback should set error reason when returning the error. See
|
|
||||||
* `llhttp_set_error_reason()` for details.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
const char* llhttp_get_error_reason(const llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Assign verbal description to the returned error. Must be called in user
|
|
||||||
* callbacks right before returning the errno.
|
|
||||||
*
|
|
||||||
* Note: `HPE_USER` error code might be useful in user callbacks.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_set_error_reason(llhttp_t* parser, const char* reason);
|
|
||||||
|
|
||||||
/* Returns the pointer to the last parsed byte before the returned error. The
|
|
||||||
* pointer is relative to the `data` argument of `llhttp_execute()`.
|
|
||||||
*
|
|
||||||
* Note: this method might be useful for counting the number of parsed bytes.
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
const char* llhttp_get_error_pos(const llhttp_t* parser);
|
|
||||||
|
|
||||||
/* Returns textual name of error code */
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
const char* llhttp_errno_name(llhttp_errno_t err);
|
|
||||||
|
|
||||||
/* Returns textual name of HTTP method */
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
const char* llhttp_method_name(llhttp_method_t method);
|
|
||||||
|
|
||||||
|
|
||||||
/* Enables/disables lenient header value parsing (disabled by default).
|
|
||||||
*
|
|
||||||
* Lenient parsing disables header value token checks, extending llhttp's
|
|
||||||
* protocol support to highly non-compliant clients/server. No
|
|
||||||
* `HPE_INVALID_HEADER_TOKEN` will be raised for incorrect header values when
|
|
||||||
* lenient parsing is "on".
|
|
||||||
*
|
|
||||||
* **(USE AT YOUR OWN RISK)**
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_set_lenient_headers(llhttp_t* parser, int enabled);
|
|
||||||
|
|
||||||
|
|
||||||
/* Enables/disables lenient handling of conflicting `Transfer-Encoding` and
|
|
||||||
* `Content-Length` headers (disabled by default).
|
|
||||||
*
|
|
||||||
* Normally `llhttp` would error when `Transfer-Encoding` is present in
|
|
||||||
* conjunction with `Content-Length`. This error is important to prevent HTTP
|
|
||||||
* request smuggling, but may be less desirable for small number of cases
|
|
||||||
* involving legacy servers.
|
|
||||||
*
|
|
||||||
* **(USE AT YOUR OWN RISK)**
|
|
||||||
*/
|
|
||||||
LLHTTP_EXPORT
|
|
||||||
void llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled);
|
|
||||||
|
|
||||||
|
|
||||||
/* Enables/disables lenient handling of `Connection: close` and HTTP/1.0
|
|
||||||
* requests responses.
|
|
||||||
*
|
|
||||||
* Normally `llhttp` would error on (in strict mode) or discard (in loose mode)
|
|
||||||
* the HTTP request/response after the request/response with `Connection: close`
|
|
||||||
* and `Content-Length`. This is important to prevent cache poisoning attacks,
|
|
||||||
* but might interact badly with outdated and insecure clients. With this flag
|
|
||||||
* the extra request/response will be parsed normally.
|
|
||||||
*
|
|
||||||
* **(USE AT YOUR OWN RISK)**
|
|
||||||
*/
|
|
||||||
void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
#endif /* INCLUDE_LLHTTP_API_H_ */
|
|
||||||
29
src/3rdparty/llhttp/http.c
vendored
29
src/3rdparty/llhttp/http.c
vendored
@@ -39,20 +39,41 @@ int llhttp__after_headers_complete(llhttp_t* parser, const char* p,
|
|||||||
int hasBody;
|
int hasBody;
|
||||||
|
|
||||||
hasBody = parser->flags & F_CHUNKED || parser->content_length > 0;
|
hasBody = parser->flags & F_CHUNKED || parser->content_length > 0;
|
||||||
if (parser->upgrade && (parser->method == HTTP_CONNECT ||
|
if (
|
||||||
(parser->flags & F_SKIPBODY) || !hasBody)) {
|
(parser->upgrade && (parser->method == HTTP_CONNECT ||
|
||||||
|
(parser->flags & F_SKIPBODY) || !hasBody)) ||
|
||||||
|
/* See RFC 2616 section 4.4 - 1xx e.g. Continue */
|
||||||
|
(parser->type == HTTP_RESPONSE && parser->status_code == 101)
|
||||||
|
) {
|
||||||
/* Exit, the rest of the message is in a different protocol. */
|
/* Exit, the rest of the message is in a different protocol. */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser->flags & F_SKIPBODY) {
|
if (parser->type == HTTP_RESPONSE && parser->status_code == 100) {
|
||||||
|
/* No body, restart as the message is complete */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See RFC 2616 section 4.4 */
|
||||||
|
if (
|
||||||
|
parser->flags & F_SKIPBODY || /* response to a HEAD request */
|
||||||
|
(
|
||||||
|
parser->type == HTTP_RESPONSE && (
|
||||||
|
parser->status_code == 102 || /* Processing */
|
||||||
|
parser->status_code == 103 || /* Early Hints */
|
||||||
|
parser->status_code == 204 || /* No Content */
|
||||||
|
parser->status_code == 304 /* Not Modified */
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (parser->flags & F_CHUNKED) {
|
} else if (parser->flags & F_CHUNKED) {
|
||||||
/* chunked encoding - ignore Content-Length header, prepare for a chunk */
|
/* chunked encoding - ignore Content-Length header, prepare for a chunk */
|
||||||
return 2;
|
return 2;
|
||||||
} else if (parser->flags & F_TRANSFER_ENCODING) {
|
} else if (parser->flags & F_TRANSFER_ENCODING) {
|
||||||
if (parser->type == HTTP_REQUEST &&
|
if (parser->type == HTTP_REQUEST &&
|
||||||
(parser->lenient_flags & LENIENT_CHUNKED_LENGTH) == 0) {
|
(parser->lenient_flags & LENIENT_CHUNKED_LENGTH) == 0 &&
|
||||||
|
(parser->lenient_flags & LENIENT_TRANSFER_ENCODING) == 0) {
|
||||||
/* RFC 7230 3.3.3 */
|
/* RFC 7230 3.3.3 */
|
||||||
|
|
||||||
/* If a Transfer-Encoding header field
|
/* If a Transfer-Encoding header field
|
||||||
|
|||||||
14123
src/3rdparty/llhttp/llhttp.c
vendored
14123
src/3rdparty/llhttp/llhttp.c
vendored
File diff suppressed because it is too large
Load Diff
441
src/3rdparty/llhttp/llhttp.h
vendored
441
src/3rdparty/llhttp/llhttp.h
vendored
@@ -1,14 +1,11 @@
|
|||||||
|
|
||||||
#ifndef INCLUDE_LLHTTP_H_
|
#ifndef INCLUDE_LLHTTP_H_
|
||||||
#define INCLUDE_LLHTTP_H_
|
#define INCLUDE_LLHTTP_H_
|
||||||
|
|
||||||
#define LLHTTP_VERSION_MAJOR 5
|
#define LLHTTP_VERSION_MAJOR 9
|
||||||
#define LLHTTP_VERSION_MINOR 1
|
#define LLHTTP_VERSION_MINOR 3
|
||||||
#define LLHTTP_VERSION_PATCH 0
|
#define LLHTTP_VERSION_PATCH 0
|
||||||
|
|
||||||
#ifndef LLHTTP_STRICT_MODE
|
|
||||||
# define LLHTTP_STRICT_MODE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INCLUDE_LLHTTP_ITSELF_H_
|
#ifndef INCLUDE_LLHTTP_ITSELF_H_
|
||||||
#define INCLUDE_LLHTTP_ITSELF_H_
|
#define INCLUDE_LLHTTP_ITSELF_H_
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -33,11 +30,12 @@ struct llhttp__internal_s {
|
|||||||
uint8_t http_major;
|
uint8_t http_major;
|
||||||
uint8_t http_minor;
|
uint8_t http_minor;
|
||||||
uint8_t header_state;
|
uint8_t header_state;
|
||||||
uint8_t lenient_flags;
|
uint16_t lenient_flags;
|
||||||
uint8_t upgrade;
|
uint8_t upgrade;
|
||||||
uint8_t finish;
|
uint8_t finish;
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
uint16_t status_code;
|
uint16_t status_code;
|
||||||
|
uint8_t initial_message_completed;
|
||||||
void* settings;
|
void* settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,6 +47,7 @@ int llhttp__internal_execute(llhttp__internal_t* s, const char* p, const char* e
|
|||||||
#endif
|
#endif
|
||||||
#endif /* INCLUDE_LLHTTP_ITSELF_H_ */
|
#endif /* INCLUDE_LLHTTP_ITSELF_H_ */
|
||||||
|
|
||||||
|
|
||||||
#ifndef LLLLHTTP_C_HEADERS_
|
#ifndef LLLLHTTP_C_HEADERS_
|
||||||
#define LLLLHTTP_C_HEADERS_
|
#define LLLLHTTP_C_HEADERS_
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -59,8 +58,10 @@ enum llhttp_errno {
|
|||||||
HPE_OK = 0,
|
HPE_OK = 0,
|
||||||
HPE_INTERNAL = 1,
|
HPE_INTERNAL = 1,
|
||||||
HPE_STRICT = 2,
|
HPE_STRICT = 2,
|
||||||
|
HPE_CR_EXPECTED = 25,
|
||||||
HPE_LF_EXPECTED = 3,
|
HPE_LF_EXPECTED = 3,
|
||||||
HPE_UNEXPECTED_CONTENT_LENGTH = 4,
|
HPE_UNEXPECTED_CONTENT_LENGTH = 4,
|
||||||
|
HPE_UNEXPECTED_SPACE = 30,
|
||||||
HPE_CLOSED_CONNECTION = 5,
|
HPE_CLOSED_CONNECTION = 5,
|
||||||
HPE_INVALID_METHOD = 6,
|
HPE_INVALID_METHOD = 6,
|
||||||
HPE_INVALID_URL = 7,
|
HPE_INVALID_URL = 7,
|
||||||
@@ -80,7 +81,17 @@ enum llhttp_errno {
|
|||||||
HPE_PAUSED = 21,
|
HPE_PAUSED = 21,
|
||||||
HPE_PAUSED_UPGRADE = 22,
|
HPE_PAUSED_UPGRADE = 22,
|
||||||
HPE_PAUSED_H2_UPGRADE = 23,
|
HPE_PAUSED_H2_UPGRADE = 23,
|
||||||
HPE_USER = 24
|
HPE_USER = 24,
|
||||||
|
HPE_CB_URL_COMPLETE = 26,
|
||||||
|
HPE_CB_STATUS_COMPLETE = 27,
|
||||||
|
HPE_CB_METHOD_COMPLETE = 32,
|
||||||
|
HPE_CB_VERSION_COMPLETE = 33,
|
||||||
|
HPE_CB_HEADER_FIELD_COMPLETE = 28,
|
||||||
|
HPE_CB_HEADER_VALUE_COMPLETE = 29,
|
||||||
|
HPE_CB_CHUNK_EXTENSION_NAME_COMPLETE = 34,
|
||||||
|
HPE_CB_CHUNK_EXTENSION_VALUE_COMPLETE = 35,
|
||||||
|
HPE_CB_RESET = 31,
|
||||||
|
HPE_CB_PROTOCOL_COMPLETE = 38
|
||||||
};
|
};
|
||||||
typedef enum llhttp_errno llhttp_errno_t;
|
typedef enum llhttp_errno llhttp_errno_t;
|
||||||
|
|
||||||
@@ -100,7 +111,14 @@ typedef enum llhttp_flags llhttp_flags_t;
|
|||||||
enum llhttp_lenient_flags {
|
enum llhttp_lenient_flags {
|
||||||
LENIENT_HEADERS = 0x1,
|
LENIENT_HEADERS = 0x1,
|
||||||
LENIENT_CHUNKED_LENGTH = 0x2,
|
LENIENT_CHUNKED_LENGTH = 0x2,
|
||||||
LENIENT_KEEP_ALIVE = 0x4
|
LENIENT_KEEP_ALIVE = 0x4,
|
||||||
|
LENIENT_TRANSFER_ENCODING = 0x8,
|
||||||
|
LENIENT_VERSION = 0x10,
|
||||||
|
LENIENT_DATA_AFTER_CLOSE = 0x20,
|
||||||
|
LENIENT_OPTIONAL_LF_AFTER_CR = 0x40,
|
||||||
|
LENIENT_OPTIONAL_CRLF_AFTER_CHUNK = 0x80,
|
||||||
|
LENIENT_OPTIONAL_CR_BEFORE_LF = 0x100,
|
||||||
|
LENIENT_SPACES_AFTER_CHUNK_SIZE = 0x200
|
||||||
};
|
};
|
||||||
typedef enum llhttp_lenient_flags llhttp_lenient_flags_t;
|
typedef enum llhttp_lenient_flags llhttp_lenient_flags_t;
|
||||||
|
|
||||||
@@ -164,16 +182,122 @@ enum llhttp_method {
|
|||||||
HTTP_SET_PARAMETER = 42,
|
HTTP_SET_PARAMETER = 42,
|
||||||
HTTP_REDIRECT = 43,
|
HTTP_REDIRECT = 43,
|
||||||
HTTP_RECORD = 44,
|
HTTP_RECORD = 44,
|
||||||
HTTP_FLUSH = 45
|
HTTP_FLUSH = 45,
|
||||||
|
HTTP_QUERY = 46
|
||||||
};
|
};
|
||||||
typedef enum llhttp_method llhttp_method_t;
|
typedef enum llhttp_method llhttp_method_t;
|
||||||
|
|
||||||
|
enum llhttp_status {
|
||||||
|
HTTP_STATUS_CONTINUE = 100,
|
||||||
|
HTTP_STATUS_SWITCHING_PROTOCOLS = 101,
|
||||||
|
HTTP_STATUS_PROCESSING = 102,
|
||||||
|
HTTP_STATUS_EARLY_HINTS = 103,
|
||||||
|
HTTP_STATUS_RESPONSE_IS_STALE = 110,
|
||||||
|
HTTP_STATUS_REVALIDATION_FAILED = 111,
|
||||||
|
HTTP_STATUS_DISCONNECTED_OPERATION = 112,
|
||||||
|
HTTP_STATUS_HEURISTIC_EXPIRATION = 113,
|
||||||
|
HTTP_STATUS_MISCELLANEOUS_WARNING = 199,
|
||||||
|
HTTP_STATUS_OK = 200,
|
||||||
|
HTTP_STATUS_CREATED = 201,
|
||||||
|
HTTP_STATUS_ACCEPTED = 202,
|
||||||
|
HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203,
|
||||||
|
HTTP_STATUS_NO_CONTENT = 204,
|
||||||
|
HTTP_STATUS_RESET_CONTENT = 205,
|
||||||
|
HTTP_STATUS_PARTIAL_CONTENT = 206,
|
||||||
|
HTTP_STATUS_MULTI_STATUS = 207,
|
||||||
|
HTTP_STATUS_ALREADY_REPORTED = 208,
|
||||||
|
HTTP_STATUS_TRANSFORMATION_APPLIED = 214,
|
||||||
|
HTTP_STATUS_IM_USED = 226,
|
||||||
|
HTTP_STATUS_MISCELLANEOUS_PERSISTENT_WARNING = 299,
|
||||||
|
HTTP_STATUS_MULTIPLE_CHOICES = 300,
|
||||||
|
HTTP_STATUS_MOVED_PERMANENTLY = 301,
|
||||||
|
HTTP_STATUS_FOUND = 302,
|
||||||
|
HTTP_STATUS_SEE_OTHER = 303,
|
||||||
|
HTTP_STATUS_NOT_MODIFIED = 304,
|
||||||
|
HTTP_STATUS_USE_PROXY = 305,
|
||||||
|
HTTP_STATUS_SWITCH_PROXY = 306,
|
||||||
|
HTTP_STATUS_TEMPORARY_REDIRECT = 307,
|
||||||
|
HTTP_STATUS_PERMANENT_REDIRECT = 308,
|
||||||
|
HTTP_STATUS_BAD_REQUEST = 400,
|
||||||
|
HTTP_STATUS_UNAUTHORIZED = 401,
|
||||||
|
HTTP_STATUS_PAYMENT_REQUIRED = 402,
|
||||||
|
HTTP_STATUS_FORBIDDEN = 403,
|
||||||
|
HTTP_STATUS_NOT_FOUND = 404,
|
||||||
|
HTTP_STATUS_METHOD_NOT_ALLOWED = 405,
|
||||||
|
HTTP_STATUS_NOT_ACCEPTABLE = 406,
|
||||||
|
HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407,
|
||||||
|
HTTP_STATUS_REQUEST_TIMEOUT = 408,
|
||||||
|
HTTP_STATUS_CONFLICT = 409,
|
||||||
|
HTTP_STATUS_GONE = 410,
|
||||||
|
HTTP_STATUS_LENGTH_REQUIRED = 411,
|
||||||
|
HTTP_STATUS_PRECONDITION_FAILED = 412,
|
||||||
|
HTTP_STATUS_PAYLOAD_TOO_LARGE = 413,
|
||||||
|
HTTP_STATUS_URI_TOO_LONG = 414,
|
||||||
|
HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415,
|
||||||
|
HTTP_STATUS_RANGE_NOT_SATISFIABLE = 416,
|
||||||
|
HTTP_STATUS_EXPECTATION_FAILED = 417,
|
||||||
|
HTTP_STATUS_IM_A_TEAPOT = 418,
|
||||||
|
HTTP_STATUS_PAGE_EXPIRED = 419,
|
||||||
|
HTTP_STATUS_ENHANCE_YOUR_CALM = 420,
|
||||||
|
HTTP_STATUS_MISDIRECTED_REQUEST = 421,
|
||||||
|
HTTP_STATUS_UNPROCESSABLE_ENTITY = 422,
|
||||||
|
HTTP_STATUS_LOCKED = 423,
|
||||||
|
HTTP_STATUS_FAILED_DEPENDENCY = 424,
|
||||||
|
HTTP_STATUS_TOO_EARLY = 425,
|
||||||
|
HTTP_STATUS_UPGRADE_REQUIRED = 426,
|
||||||
|
HTTP_STATUS_PRECONDITION_REQUIRED = 428,
|
||||||
|
HTTP_STATUS_TOO_MANY_REQUESTS = 429,
|
||||||
|
HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL = 430,
|
||||||
|
HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
|
||||||
|
HTTP_STATUS_LOGIN_TIMEOUT = 440,
|
||||||
|
HTTP_STATUS_NO_RESPONSE = 444,
|
||||||
|
HTTP_STATUS_RETRY_WITH = 449,
|
||||||
|
HTTP_STATUS_BLOCKED_BY_PARENTAL_CONTROL = 450,
|
||||||
|
HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451,
|
||||||
|
HTTP_STATUS_CLIENT_CLOSED_LOAD_BALANCED_REQUEST = 460,
|
||||||
|
HTTP_STATUS_INVALID_X_FORWARDED_FOR = 463,
|
||||||
|
HTTP_STATUS_REQUEST_HEADER_TOO_LARGE = 494,
|
||||||
|
HTTP_STATUS_SSL_CERTIFICATE_ERROR = 495,
|
||||||
|
HTTP_STATUS_SSL_CERTIFICATE_REQUIRED = 496,
|
||||||
|
HTTP_STATUS_HTTP_REQUEST_SENT_TO_HTTPS_PORT = 497,
|
||||||
|
HTTP_STATUS_INVALID_TOKEN = 498,
|
||||||
|
HTTP_STATUS_CLIENT_CLOSED_REQUEST = 499,
|
||||||
|
HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
|
||||||
|
HTTP_STATUS_NOT_IMPLEMENTED = 501,
|
||||||
|
HTTP_STATUS_BAD_GATEWAY = 502,
|
||||||
|
HTTP_STATUS_SERVICE_UNAVAILABLE = 503,
|
||||||
|
HTTP_STATUS_GATEWAY_TIMEOUT = 504,
|
||||||
|
HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505,
|
||||||
|
HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506,
|
||||||
|
HTTP_STATUS_INSUFFICIENT_STORAGE = 507,
|
||||||
|
HTTP_STATUS_LOOP_DETECTED = 508,
|
||||||
|
HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509,
|
||||||
|
HTTP_STATUS_NOT_EXTENDED = 510,
|
||||||
|
HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511,
|
||||||
|
HTTP_STATUS_WEB_SERVER_UNKNOWN_ERROR = 520,
|
||||||
|
HTTP_STATUS_WEB_SERVER_IS_DOWN = 521,
|
||||||
|
HTTP_STATUS_CONNECTION_TIMEOUT = 522,
|
||||||
|
HTTP_STATUS_ORIGIN_IS_UNREACHABLE = 523,
|
||||||
|
HTTP_STATUS_TIMEOUT_OCCURED = 524,
|
||||||
|
HTTP_STATUS_SSL_HANDSHAKE_FAILED = 525,
|
||||||
|
HTTP_STATUS_INVALID_SSL_CERTIFICATE = 526,
|
||||||
|
HTTP_STATUS_RAILGUN_ERROR = 527,
|
||||||
|
HTTP_STATUS_SITE_IS_OVERLOADED = 529,
|
||||||
|
HTTP_STATUS_SITE_IS_FROZEN = 530,
|
||||||
|
HTTP_STATUS_IDENTITY_PROVIDER_AUTHENTICATION_ERROR = 561,
|
||||||
|
HTTP_STATUS_NETWORK_READ_TIMEOUT = 598,
|
||||||
|
HTTP_STATUS_NETWORK_CONNECT_TIMEOUT = 599
|
||||||
|
};
|
||||||
|
typedef enum llhttp_status llhttp_status_t;
|
||||||
|
|
||||||
#define HTTP_ERRNO_MAP(XX) \
|
#define HTTP_ERRNO_MAP(XX) \
|
||||||
XX(0, OK, OK) \
|
XX(0, OK, OK) \
|
||||||
XX(1, INTERNAL, INTERNAL) \
|
XX(1, INTERNAL, INTERNAL) \
|
||||||
XX(2, STRICT, STRICT) \
|
XX(2, STRICT, STRICT) \
|
||||||
|
XX(25, CR_EXPECTED, CR_EXPECTED) \
|
||||||
XX(3, LF_EXPECTED, LF_EXPECTED) \
|
XX(3, LF_EXPECTED, LF_EXPECTED) \
|
||||||
XX(4, UNEXPECTED_CONTENT_LENGTH, UNEXPECTED_CONTENT_LENGTH) \
|
XX(4, UNEXPECTED_CONTENT_LENGTH, UNEXPECTED_CONTENT_LENGTH) \
|
||||||
|
XX(30, UNEXPECTED_SPACE, UNEXPECTED_SPACE) \
|
||||||
XX(5, CLOSED_CONNECTION, CLOSED_CONNECTION) \
|
XX(5, CLOSED_CONNECTION, CLOSED_CONNECTION) \
|
||||||
XX(6, INVALID_METHOD, INVALID_METHOD) \
|
XX(6, INVALID_METHOD, INVALID_METHOD) \
|
||||||
XX(7, INVALID_URL, INVALID_URL) \
|
XX(7, INVALID_URL, INVALID_URL) \
|
||||||
@@ -194,9 +318,74 @@ typedef enum llhttp_method llhttp_method_t;
|
|||||||
XX(22, PAUSED_UPGRADE, PAUSED_UPGRADE) \
|
XX(22, PAUSED_UPGRADE, PAUSED_UPGRADE) \
|
||||||
XX(23, PAUSED_H2_UPGRADE, PAUSED_H2_UPGRADE) \
|
XX(23, PAUSED_H2_UPGRADE, PAUSED_H2_UPGRADE) \
|
||||||
XX(24, USER, USER) \
|
XX(24, USER, USER) \
|
||||||
|
XX(26, CB_URL_COMPLETE, CB_URL_COMPLETE) \
|
||||||
|
XX(27, CB_STATUS_COMPLETE, CB_STATUS_COMPLETE) \
|
||||||
|
XX(32, CB_METHOD_COMPLETE, CB_METHOD_COMPLETE) \
|
||||||
|
XX(33, CB_VERSION_COMPLETE, CB_VERSION_COMPLETE) \
|
||||||
|
XX(28, CB_HEADER_FIELD_COMPLETE, CB_HEADER_FIELD_COMPLETE) \
|
||||||
|
XX(29, CB_HEADER_VALUE_COMPLETE, CB_HEADER_VALUE_COMPLETE) \
|
||||||
|
XX(34, CB_CHUNK_EXTENSION_NAME_COMPLETE, CB_CHUNK_EXTENSION_NAME_COMPLETE) \
|
||||||
|
XX(35, CB_CHUNK_EXTENSION_VALUE_COMPLETE, CB_CHUNK_EXTENSION_VALUE_COMPLETE) \
|
||||||
|
XX(31, CB_RESET, CB_RESET) \
|
||||||
|
XX(38, CB_PROTOCOL_COMPLETE, CB_PROTOCOL_COMPLETE) \
|
||||||
|
|
||||||
|
|
||||||
#define HTTP_METHOD_MAP(XX) \
|
#define HTTP_METHOD_MAP(XX) \
|
||||||
|
XX(0, DELETE, DELETE) \
|
||||||
|
XX(1, GET, GET) \
|
||||||
|
XX(2, HEAD, HEAD) \
|
||||||
|
XX(3, POST, POST) \
|
||||||
|
XX(4, PUT, PUT) \
|
||||||
|
XX(5, CONNECT, CONNECT) \
|
||||||
|
XX(6, OPTIONS, OPTIONS) \
|
||||||
|
XX(7, TRACE, TRACE) \
|
||||||
|
XX(8, COPY, COPY) \
|
||||||
|
XX(9, LOCK, LOCK) \
|
||||||
|
XX(10, MKCOL, MKCOL) \
|
||||||
|
XX(11, MOVE, MOVE) \
|
||||||
|
XX(12, PROPFIND, PROPFIND) \
|
||||||
|
XX(13, PROPPATCH, PROPPATCH) \
|
||||||
|
XX(14, SEARCH, SEARCH) \
|
||||||
|
XX(15, UNLOCK, UNLOCK) \
|
||||||
|
XX(16, BIND, BIND) \
|
||||||
|
XX(17, REBIND, REBIND) \
|
||||||
|
XX(18, UNBIND, UNBIND) \
|
||||||
|
XX(19, ACL, ACL) \
|
||||||
|
XX(20, REPORT, REPORT) \
|
||||||
|
XX(21, MKACTIVITY, MKACTIVITY) \
|
||||||
|
XX(22, CHECKOUT, CHECKOUT) \
|
||||||
|
XX(23, MERGE, MERGE) \
|
||||||
|
XX(24, MSEARCH, M-SEARCH) \
|
||||||
|
XX(25, NOTIFY, NOTIFY) \
|
||||||
|
XX(26, SUBSCRIBE, SUBSCRIBE) \
|
||||||
|
XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \
|
||||||
|
XX(28, PATCH, PATCH) \
|
||||||
|
XX(29, PURGE, PURGE) \
|
||||||
|
XX(30, MKCALENDAR, MKCALENDAR) \
|
||||||
|
XX(31, LINK, LINK) \
|
||||||
|
XX(32, UNLINK, UNLINK) \
|
||||||
|
XX(33, SOURCE, SOURCE) \
|
||||||
|
XX(46, QUERY, QUERY) \
|
||||||
|
|
||||||
|
|
||||||
|
#define RTSP_METHOD_MAP(XX) \
|
||||||
|
XX(1, GET, GET) \
|
||||||
|
XX(3, POST, POST) \
|
||||||
|
XX(6, OPTIONS, OPTIONS) \
|
||||||
|
XX(35, DESCRIBE, DESCRIBE) \
|
||||||
|
XX(36, ANNOUNCE, ANNOUNCE) \
|
||||||
|
XX(37, SETUP, SETUP) \
|
||||||
|
XX(38, PLAY, PLAY) \
|
||||||
|
XX(39, PAUSE, PAUSE) \
|
||||||
|
XX(40, TEARDOWN, TEARDOWN) \
|
||||||
|
XX(41, GET_PARAMETER, GET_PARAMETER) \
|
||||||
|
XX(42, SET_PARAMETER, SET_PARAMETER) \
|
||||||
|
XX(43, REDIRECT, REDIRECT) \
|
||||||
|
XX(44, RECORD, RECORD) \
|
||||||
|
XX(45, FLUSH, FLUSH) \
|
||||||
|
|
||||||
|
|
||||||
|
#define HTTP_ALL_METHOD_MAP(XX) \
|
||||||
XX(0, DELETE, DELETE) \
|
XX(0, DELETE, DELETE) \
|
||||||
XX(1, GET, GET) \
|
XX(1, GET, GET) \
|
||||||
XX(2, HEAD, HEAD) \
|
XX(2, HEAD, HEAD) \
|
||||||
@@ -243,14 +432,117 @@ typedef enum llhttp_method llhttp_method_t;
|
|||||||
XX(43, REDIRECT, REDIRECT) \
|
XX(43, REDIRECT, REDIRECT) \
|
||||||
XX(44, RECORD, RECORD) \
|
XX(44, RECORD, RECORD) \
|
||||||
XX(45, FLUSH, FLUSH) \
|
XX(45, FLUSH, FLUSH) \
|
||||||
|
XX(46, QUERY, QUERY) \
|
||||||
|
|
||||||
|
|
||||||
|
#define HTTP_STATUS_MAP(XX) \
|
||||||
|
XX(100, CONTINUE, CONTINUE) \
|
||||||
|
XX(101, SWITCHING_PROTOCOLS, SWITCHING_PROTOCOLS) \
|
||||||
|
XX(102, PROCESSING, PROCESSING) \
|
||||||
|
XX(103, EARLY_HINTS, EARLY_HINTS) \
|
||||||
|
XX(110, RESPONSE_IS_STALE, RESPONSE_IS_STALE) \
|
||||||
|
XX(111, REVALIDATION_FAILED, REVALIDATION_FAILED) \
|
||||||
|
XX(112, DISCONNECTED_OPERATION, DISCONNECTED_OPERATION) \
|
||||||
|
XX(113, HEURISTIC_EXPIRATION, HEURISTIC_EXPIRATION) \
|
||||||
|
XX(199, MISCELLANEOUS_WARNING, MISCELLANEOUS_WARNING) \
|
||||||
|
XX(200, OK, OK) \
|
||||||
|
XX(201, CREATED, CREATED) \
|
||||||
|
XX(202, ACCEPTED, ACCEPTED) \
|
||||||
|
XX(203, NON_AUTHORITATIVE_INFORMATION, NON_AUTHORITATIVE_INFORMATION) \
|
||||||
|
XX(204, NO_CONTENT, NO_CONTENT) \
|
||||||
|
XX(205, RESET_CONTENT, RESET_CONTENT) \
|
||||||
|
XX(206, PARTIAL_CONTENT, PARTIAL_CONTENT) \
|
||||||
|
XX(207, MULTI_STATUS, MULTI_STATUS) \
|
||||||
|
XX(208, ALREADY_REPORTED, ALREADY_REPORTED) \
|
||||||
|
XX(214, TRANSFORMATION_APPLIED, TRANSFORMATION_APPLIED) \
|
||||||
|
XX(226, IM_USED, IM_USED) \
|
||||||
|
XX(299, MISCELLANEOUS_PERSISTENT_WARNING, MISCELLANEOUS_PERSISTENT_WARNING) \
|
||||||
|
XX(300, MULTIPLE_CHOICES, MULTIPLE_CHOICES) \
|
||||||
|
XX(301, MOVED_PERMANENTLY, MOVED_PERMANENTLY) \
|
||||||
|
XX(302, FOUND, FOUND) \
|
||||||
|
XX(303, SEE_OTHER, SEE_OTHER) \
|
||||||
|
XX(304, NOT_MODIFIED, NOT_MODIFIED) \
|
||||||
|
XX(305, USE_PROXY, USE_PROXY) \
|
||||||
|
XX(306, SWITCH_PROXY, SWITCH_PROXY) \
|
||||||
|
XX(307, TEMPORARY_REDIRECT, TEMPORARY_REDIRECT) \
|
||||||
|
XX(308, PERMANENT_REDIRECT, PERMANENT_REDIRECT) \
|
||||||
|
XX(400, BAD_REQUEST, BAD_REQUEST) \
|
||||||
|
XX(401, UNAUTHORIZED, UNAUTHORIZED) \
|
||||||
|
XX(402, PAYMENT_REQUIRED, PAYMENT_REQUIRED) \
|
||||||
|
XX(403, FORBIDDEN, FORBIDDEN) \
|
||||||
|
XX(404, NOT_FOUND, NOT_FOUND) \
|
||||||
|
XX(405, METHOD_NOT_ALLOWED, METHOD_NOT_ALLOWED) \
|
||||||
|
XX(406, NOT_ACCEPTABLE, NOT_ACCEPTABLE) \
|
||||||
|
XX(407, PROXY_AUTHENTICATION_REQUIRED, PROXY_AUTHENTICATION_REQUIRED) \
|
||||||
|
XX(408, REQUEST_TIMEOUT, REQUEST_TIMEOUT) \
|
||||||
|
XX(409, CONFLICT, CONFLICT) \
|
||||||
|
XX(410, GONE, GONE) \
|
||||||
|
XX(411, LENGTH_REQUIRED, LENGTH_REQUIRED) \
|
||||||
|
XX(412, PRECONDITION_FAILED, PRECONDITION_FAILED) \
|
||||||
|
XX(413, PAYLOAD_TOO_LARGE, PAYLOAD_TOO_LARGE) \
|
||||||
|
XX(414, URI_TOO_LONG, URI_TOO_LONG) \
|
||||||
|
XX(415, UNSUPPORTED_MEDIA_TYPE, UNSUPPORTED_MEDIA_TYPE) \
|
||||||
|
XX(416, RANGE_NOT_SATISFIABLE, RANGE_NOT_SATISFIABLE) \
|
||||||
|
XX(417, EXPECTATION_FAILED, EXPECTATION_FAILED) \
|
||||||
|
XX(418, IM_A_TEAPOT, IM_A_TEAPOT) \
|
||||||
|
XX(419, PAGE_EXPIRED, PAGE_EXPIRED) \
|
||||||
|
XX(420, ENHANCE_YOUR_CALM, ENHANCE_YOUR_CALM) \
|
||||||
|
XX(421, MISDIRECTED_REQUEST, MISDIRECTED_REQUEST) \
|
||||||
|
XX(422, UNPROCESSABLE_ENTITY, UNPROCESSABLE_ENTITY) \
|
||||||
|
XX(423, LOCKED, LOCKED) \
|
||||||
|
XX(424, FAILED_DEPENDENCY, FAILED_DEPENDENCY) \
|
||||||
|
XX(425, TOO_EARLY, TOO_EARLY) \
|
||||||
|
XX(426, UPGRADE_REQUIRED, UPGRADE_REQUIRED) \
|
||||||
|
XX(428, PRECONDITION_REQUIRED, PRECONDITION_REQUIRED) \
|
||||||
|
XX(429, TOO_MANY_REQUESTS, TOO_MANY_REQUESTS) \
|
||||||
|
XX(430, REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL, REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL) \
|
||||||
|
XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_HEADER_FIELDS_TOO_LARGE) \
|
||||||
|
XX(440, LOGIN_TIMEOUT, LOGIN_TIMEOUT) \
|
||||||
|
XX(444, NO_RESPONSE, NO_RESPONSE) \
|
||||||
|
XX(449, RETRY_WITH, RETRY_WITH) \
|
||||||
|
XX(450, BLOCKED_BY_PARENTAL_CONTROL, BLOCKED_BY_PARENTAL_CONTROL) \
|
||||||
|
XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, UNAVAILABLE_FOR_LEGAL_REASONS) \
|
||||||
|
XX(460, CLIENT_CLOSED_LOAD_BALANCED_REQUEST, CLIENT_CLOSED_LOAD_BALANCED_REQUEST) \
|
||||||
|
XX(463, INVALID_X_FORWARDED_FOR, INVALID_X_FORWARDED_FOR) \
|
||||||
|
XX(494, REQUEST_HEADER_TOO_LARGE, REQUEST_HEADER_TOO_LARGE) \
|
||||||
|
XX(495, SSL_CERTIFICATE_ERROR, SSL_CERTIFICATE_ERROR) \
|
||||||
|
XX(496, SSL_CERTIFICATE_REQUIRED, SSL_CERTIFICATE_REQUIRED) \
|
||||||
|
XX(497, HTTP_REQUEST_SENT_TO_HTTPS_PORT, HTTP_REQUEST_SENT_TO_HTTPS_PORT) \
|
||||||
|
XX(498, INVALID_TOKEN, INVALID_TOKEN) \
|
||||||
|
XX(499, CLIENT_CLOSED_REQUEST, CLIENT_CLOSED_REQUEST) \
|
||||||
|
XX(500, INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR) \
|
||||||
|
XX(501, NOT_IMPLEMENTED, NOT_IMPLEMENTED) \
|
||||||
|
XX(502, BAD_GATEWAY, BAD_GATEWAY) \
|
||||||
|
XX(503, SERVICE_UNAVAILABLE, SERVICE_UNAVAILABLE) \
|
||||||
|
XX(504, GATEWAY_TIMEOUT, GATEWAY_TIMEOUT) \
|
||||||
|
XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP_VERSION_NOT_SUPPORTED) \
|
||||||
|
XX(506, VARIANT_ALSO_NEGOTIATES, VARIANT_ALSO_NEGOTIATES) \
|
||||||
|
XX(507, INSUFFICIENT_STORAGE, INSUFFICIENT_STORAGE) \
|
||||||
|
XX(508, LOOP_DETECTED, LOOP_DETECTED) \
|
||||||
|
XX(509, BANDWIDTH_LIMIT_EXCEEDED, BANDWIDTH_LIMIT_EXCEEDED) \
|
||||||
|
XX(510, NOT_EXTENDED, NOT_EXTENDED) \
|
||||||
|
XX(511, NETWORK_AUTHENTICATION_REQUIRED, NETWORK_AUTHENTICATION_REQUIRED) \
|
||||||
|
XX(520, WEB_SERVER_UNKNOWN_ERROR, WEB_SERVER_UNKNOWN_ERROR) \
|
||||||
|
XX(521, WEB_SERVER_IS_DOWN, WEB_SERVER_IS_DOWN) \
|
||||||
|
XX(522, CONNECTION_TIMEOUT, CONNECTION_TIMEOUT) \
|
||||||
|
XX(523, ORIGIN_IS_UNREACHABLE, ORIGIN_IS_UNREACHABLE) \
|
||||||
|
XX(524, TIMEOUT_OCCURED, TIMEOUT_OCCURED) \
|
||||||
|
XX(525, SSL_HANDSHAKE_FAILED, SSL_HANDSHAKE_FAILED) \
|
||||||
|
XX(526, INVALID_SSL_CERTIFICATE, INVALID_SSL_CERTIFICATE) \
|
||||||
|
XX(527, RAILGUN_ERROR, RAILGUN_ERROR) \
|
||||||
|
XX(529, SITE_IS_OVERLOADED, SITE_IS_OVERLOADED) \
|
||||||
|
XX(530, SITE_IS_FROZEN, SITE_IS_FROZEN) \
|
||||||
|
XX(561, IDENTITY_PROVIDER_AUTHENTICATION_ERROR, IDENTITY_PROVIDER_AUTHENTICATION_ERROR) \
|
||||||
|
XX(598, NETWORK_READ_TIMEOUT, NETWORK_READ_TIMEOUT) \
|
||||||
|
XX(599, NETWORK_CONNECT_TIMEOUT, NETWORK_CONNECT_TIMEOUT) \
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
#endif /* LLLLHTTP_C_HEADERS_ */
|
#endif /* LLLLHTTP_C_HEADERS_ */
|
||||||
|
|
||||||
|
|
||||||
#ifndef INCLUDE_LLHTTP_API_H_
|
#ifndef INCLUDE_LLHTTP_API_H_
|
||||||
#define INCLUDE_LLHTTP_API_H_
|
#define INCLUDE_LLHTTP_API_H_
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -274,10 +566,16 @@ struct llhttp_settings_s {
|
|||||||
/* Possible return values 0, -1, `HPE_PAUSED` */
|
/* Possible return values 0, -1, `HPE_PAUSED` */
|
||||||
llhttp_cb on_message_begin;
|
llhttp_cb on_message_begin;
|
||||||
|
|
||||||
|
/* Possible return values 0, -1, HPE_USER */
|
||||||
|
llhttp_data_cb on_protocol;
|
||||||
llhttp_data_cb on_url;
|
llhttp_data_cb on_url;
|
||||||
llhttp_data_cb on_status;
|
llhttp_data_cb on_status;
|
||||||
|
llhttp_data_cb on_method;
|
||||||
|
llhttp_data_cb on_version;
|
||||||
llhttp_data_cb on_header_field;
|
llhttp_data_cb on_header_field;
|
||||||
llhttp_data_cb on_header_value;
|
llhttp_data_cb on_header_value;
|
||||||
|
llhttp_data_cb on_chunk_extension_name;
|
||||||
|
llhttp_data_cb on_chunk_extension_value;
|
||||||
|
|
||||||
/* Possible return values:
|
/* Possible return values:
|
||||||
* 0 - Proceed normally
|
* 0 - Proceed normally
|
||||||
@@ -290,10 +588,20 @@ struct llhttp_settings_s {
|
|||||||
*/
|
*/
|
||||||
llhttp_cb on_headers_complete;
|
llhttp_cb on_headers_complete;
|
||||||
|
|
||||||
|
/* Possible return values 0, -1, HPE_USER */
|
||||||
llhttp_data_cb on_body;
|
llhttp_data_cb on_body;
|
||||||
|
|
||||||
/* Possible return values 0, -1, `HPE_PAUSED` */
|
/* Possible return values 0, -1, `HPE_PAUSED` */
|
||||||
llhttp_cb on_message_complete;
|
llhttp_cb on_message_complete;
|
||||||
|
llhttp_cb on_protocol_complete;
|
||||||
|
llhttp_cb on_url_complete;
|
||||||
|
llhttp_cb on_status_complete;
|
||||||
|
llhttp_cb on_method_complete;
|
||||||
|
llhttp_cb on_version_complete;
|
||||||
|
llhttp_cb on_header_field_complete;
|
||||||
|
llhttp_cb on_header_value_complete;
|
||||||
|
llhttp_cb on_chunk_extension_name_complete;
|
||||||
|
llhttp_cb on_chunk_extension_value_complete;
|
||||||
|
|
||||||
/* When on_chunk_header is called, the current chunk length is stored
|
/* When on_chunk_header is called, the current chunk length is stored
|
||||||
* in parser->content_length.
|
* in parser->content_length.
|
||||||
@@ -301,11 +609,7 @@ struct llhttp_settings_s {
|
|||||||
*/
|
*/
|
||||||
llhttp_cb on_chunk_header;
|
llhttp_cb on_chunk_header;
|
||||||
llhttp_cb on_chunk_complete;
|
llhttp_cb on_chunk_complete;
|
||||||
|
llhttp_cb on_reset;
|
||||||
llhttp_cb on_url_complete;
|
|
||||||
llhttp_cb on_status_complete;
|
|
||||||
llhttp_cb on_header_field_complete;
|
|
||||||
llhttp_cb on_header_value_complete;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Initialize the parser with specific type and user settings.
|
/* Initialize the parser with specific type and user settings.
|
||||||
@@ -318,8 +622,6 @@ LLHTTP_EXPORT
|
|||||||
void llhttp_init(llhttp_t* parser, llhttp_type_t type,
|
void llhttp_init(llhttp_t* parser, llhttp_type_t type,
|
||||||
const llhttp_settings_t* settings);
|
const llhttp_settings_t* settings);
|
||||||
|
|
||||||
#if defined(__wasm__)
|
|
||||||
|
|
||||||
LLHTTP_EXPORT
|
LLHTTP_EXPORT
|
||||||
llhttp_t* llhttp_alloc(llhttp_type_t type);
|
llhttp_t* llhttp_alloc(llhttp_type_t type);
|
||||||
|
|
||||||
@@ -344,8 +646,6 @@ int llhttp_get_status_code(llhttp_t* parser);
|
|||||||
LLHTTP_EXPORT
|
LLHTTP_EXPORT
|
||||||
uint8_t llhttp_get_upgrade(llhttp_t* parser);
|
uint8_t llhttp_get_upgrade(llhttp_t* parser);
|
||||||
|
|
||||||
#endif // defined(__wasm__)
|
|
||||||
|
|
||||||
/* Reset an already initialized parser back to the start state, preserving the
|
/* Reset an already initialized parser back to the start state, preserving the
|
||||||
* existing parser type, callback settings, user data, and lenient flags.
|
* existing parser type, callback settings, user data, and lenient flags.
|
||||||
*/
|
*/
|
||||||
@@ -459,6 +759,9 @@ const char* llhttp_errno_name(llhttp_errno_t err);
|
|||||||
LLHTTP_EXPORT
|
LLHTTP_EXPORT
|
||||||
const char* llhttp_method_name(llhttp_method_t method);
|
const char* llhttp_method_name(llhttp_method_t method);
|
||||||
|
|
||||||
|
/* Returns textual name of HTTP status */
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
const char* llhttp_status_name(llhttp_status_t status);
|
||||||
|
|
||||||
/* Enables/disables lenient header value parsing (disabled by default).
|
/* Enables/disables lenient header value parsing (disabled by default).
|
||||||
*
|
*
|
||||||
@@ -467,7 +770,8 @@ const char* llhttp_method_name(llhttp_method_t method);
|
|||||||
* `HPE_INVALID_HEADER_TOKEN` will be raised for incorrect header values when
|
* `HPE_INVALID_HEADER_TOKEN` will be raised for incorrect header values when
|
||||||
* lenient parsing is "on".
|
* lenient parsing is "on".
|
||||||
*
|
*
|
||||||
* **(USE AT YOUR OWN RISK)**
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* request smuggling attacks. USE WITH CAUTION!**
|
||||||
*/
|
*/
|
||||||
LLHTTP_EXPORT
|
LLHTTP_EXPORT
|
||||||
void llhttp_set_lenient_headers(llhttp_t* parser, int enabled);
|
void llhttp_set_lenient_headers(llhttp_t* parser, int enabled);
|
||||||
@@ -481,7 +785,8 @@ void llhttp_set_lenient_headers(llhttp_t* parser, int enabled);
|
|||||||
* request smuggling, but may be less desirable for small number of cases
|
* request smuggling, but may be less desirable for small number of cases
|
||||||
* involving legacy servers.
|
* involving legacy servers.
|
||||||
*
|
*
|
||||||
* **(USE AT YOUR OWN RISK)**
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* request smuggling attacks. USE WITH CAUTION!**
|
||||||
*/
|
*/
|
||||||
LLHTTP_EXPORT
|
LLHTTP_EXPORT
|
||||||
void llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled);
|
void llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled);
|
||||||
@@ -496,13 +801,105 @@ void llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled);
|
|||||||
* but might interact badly with outdated and insecure clients. With this flag
|
* but might interact badly with outdated and insecure clients. With this flag
|
||||||
* the extra request/response will be parsed normally.
|
* the extra request/response will be parsed normally.
|
||||||
*
|
*
|
||||||
* **(USE AT YOUR OWN RISK)**
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* poisoning attacks. USE WITH CAUTION!**
|
||||||
*/
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled);
|
void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
|
/* Enables/disables lenient handling of `Transfer-Encoding` header.
|
||||||
|
*
|
||||||
|
* Normally `llhttp` would error when a `Transfer-Encoding` has `chunked` value
|
||||||
|
* and another value after it (either in a single header or in multiple
|
||||||
|
* headers whose value are internally joined using `, `).
|
||||||
|
* This is mandated by the spec to reliably determine request body size and thus
|
||||||
|
* avoid request smuggling.
|
||||||
|
* With this flag the extra value will be parsed normally.
|
||||||
|
*
|
||||||
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* request smuggling attacks. USE WITH CAUTION!**
|
||||||
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
void llhttp_set_lenient_transfer_encoding(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
|
/* Enables/disables lenient handling of HTTP version.
|
||||||
|
*
|
||||||
|
* Normally `llhttp` would error when the HTTP version in the request or status line
|
||||||
|
* is not `0.9`, `1.0`, `1.1` or `2.0`.
|
||||||
|
* With this flag the invalid value will be parsed normally.
|
||||||
|
*
|
||||||
|
* **Enabling this flag can pose a security issue since you will allow unsupported
|
||||||
|
* HTTP versions. USE WITH CAUTION!**
|
||||||
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
void llhttp_set_lenient_version(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
|
/* Enables/disables lenient handling of additional data received after a message ends
|
||||||
|
* and keep-alive is disabled.
|
||||||
|
*
|
||||||
|
* Normally `llhttp` would error when additional unexpected data is received if the message
|
||||||
|
* contains the `Connection` header with `close` value.
|
||||||
|
* With this flag the extra data will discarded without throwing an error.
|
||||||
|
*
|
||||||
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* poisoning attacks. USE WITH CAUTION!**
|
||||||
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
void llhttp_set_lenient_data_after_close(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
|
/* Enables/disables lenient handling of incomplete CRLF sequences.
|
||||||
|
*
|
||||||
|
* Normally `llhttp` would error when a CR is not followed by LF when terminating the
|
||||||
|
* request line, the status line, the headers or a chunk header.
|
||||||
|
* With this flag only a CR is required to terminate such sections.
|
||||||
|
*
|
||||||
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* request smuggling attacks. USE WITH CAUTION!**
|
||||||
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
void llhttp_set_lenient_optional_lf_after_cr(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enables/disables lenient handling of line separators.
|
||||||
|
*
|
||||||
|
* Normally `llhttp` would error when a LF is not preceded by CR when terminating the
|
||||||
|
* request line, the status line, the headers, a chunk header or a chunk data.
|
||||||
|
* With this flag only a LF is required to terminate such sections.
|
||||||
|
*
|
||||||
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* request smuggling attacks. USE WITH CAUTION!**
|
||||||
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
void llhttp_set_lenient_optional_cr_before_lf(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
|
/* Enables/disables lenient handling of chunks not separated via CRLF.
|
||||||
|
*
|
||||||
|
* Normally `llhttp` would error when after a chunk data a CRLF is missing before
|
||||||
|
* starting a new chunk.
|
||||||
|
* With this flag the new chunk can start immediately after the previous one.
|
||||||
|
*
|
||||||
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* request smuggling attacks. USE WITH CAUTION!**
|
||||||
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
void llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
|
/* Enables/disables lenient handling of spaces after chunk size.
|
||||||
|
*
|
||||||
|
* Normally `llhttp` would error when after a chunk size is followed by one or more
|
||||||
|
* spaces are present instead of a CRLF or `;`.
|
||||||
|
* With this flag this check is disabled.
|
||||||
|
*
|
||||||
|
* **Enabling this flag can pose a security issue since you will be exposed to
|
||||||
|
* request smuggling attacks. USE WITH CAUTION!**
|
||||||
|
*/
|
||||||
|
LLHTTP_EXPORT
|
||||||
|
void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
#endif /* INCLUDE_LLHTTP_API_H_ */
|
#endif /* INCLUDE_LLHTTP_API_H_ */
|
||||||
|
|
||||||
|
|
||||||
#endif /* INCLUDE_LLHTTP_H_ */
|
#endif /* INCLUDE_LLHTTP_H_ */
|
||||||
|
|||||||
7
src/3rdparty/rapidjson/allocators.h
vendored
7
src/3rdparty/rapidjson/allocators.h
vendored
@@ -19,6 +19,7 @@
|
|||||||
#include "internal/meta.h"
|
#include "internal/meta.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#if RAPIDJSON_HAS_CXX11
|
#if RAPIDJSON_HAS_CXX11
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -433,7 +434,7 @@ namespace internal {
|
|||||||
template<typename T, typename A>
|
template<typename T, typename A>
|
||||||
inline T* Realloc(A& a, T* old_p, size_t old_n, size_t new_n)
|
inline T* Realloc(A& a, T* old_p, size_t old_n, size_t new_n)
|
||||||
{
|
{
|
||||||
RAPIDJSON_NOEXCEPT_ASSERT(old_n <= SIZE_MAX / sizeof(T) && new_n <= SIZE_MAX / sizeof(T));
|
RAPIDJSON_NOEXCEPT_ASSERT(old_n <= (std::numeric_limits<size_t>::max)() / sizeof(T) && new_n <= (std::numeric_limits<size_t>::max)() / sizeof(T));
|
||||||
return static_cast<T*>(a.Realloc(old_p, old_n * sizeof(T), new_n * sizeof(T)));
|
return static_cast<T*>(a.Realloc(old_p, old_n * sizeof(T), new_n * sizeof(T)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,9 +497,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* implicit */
|
/* implicit */
|
||||||
StdAllocator(const BaseAllocator& allocator) RAPIDJSON_NOEXCEPT :
|
StdAllocator(const BaseAllocator& baseAllocator) RAPIDJSON_NOEXCEPT :
|
||||||
allocator_type(),
|
allocator_type(),
|
||||||
baseAllocator_(allocator)
|
baseAllocator_(baseAllocator)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~StdAllocator() RAPIDJSON_NOEXCEPT
|
~StdAllocator() RAPIDJSON_NOEXCEPT
|
||||||
|
|||||||
41
src/3rdparty/rapidjson/document.h
vendored
41
src/3rdparty/rapidjson/document.h
vendored
@@ -75,7 +75,7 @@ class GenericDocument;
|
|||||||
User can define this to use CrtAllocator or MemoryPoolAllocator.
|
User can define this to use CrtAllocator or MemoryPoolAllocator.
|
||||||
*/
|
*/
|
||||||
#ifndef RAPIDJSON_DEFAULT_ALLOCATOR
|
#ifndef RAPIDJSON_DEFAULT_ALLOCATOR
|
||||||
#define RAPIDJSON_DEFAULT_ALLOCATOR MemoryPoolAllocator<CrtAllocator>
|
#define RAPIDJSON_DEFAULT_ALLOCATOR ::RAPIDJSON_NAMESPACE::MemoryPoolAllocator<::RAPIDJSON_NAMESPACE::CrtAllocator>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! \def RAPIDJSON_DEFAULT_STACK_ALLOCATOR
|
/*! \def RAPIDJSON_DEFAULT_STACK_ALLOCATOR
|
||||||
@@ -85,7 +85,7 @@ class GenericDocument;
|
|||||||
User can define this to use CrtAllocator or MemoryPoolAllocator.
|
User can define this to use CrtAllocator or MemoryPoolAllocator.
|
||||||
*/
|
*/
|
||||||
#ifndef RAPIDJSON_DEFAULT_STACK_ALLOCATOR
|
#ifndef RAPIDJSON_DEFAULT_STACK_ALLOCATOR
|
||||||
#define RAPIDJSON_DEFAULT_STACK_ALLOCATOR CrtAllocator
|
#define RAPIDJSON_DEFAULT_STACK_ALLOCATOR ::RAPIDJSON_NAMESPACE::CrtAllocator
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! \def RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY
|
/*! \def RAPIDJSON_VALUE_DEFAULT_OBJECT_CAPACITY
|
||||||
@@ -1033,7 +1033,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
for (ConstMemberIterator lhsMemberItr = MemberBegin(); lhsMemberItr != MemberEnd(); ++lhsMemberItr) {
|
for (ConstMemberIterator lhsMemberItr = MemberBegin(); lhsMemberItr != MemberEnd(); ++lhsMemberItr) {
|
||||||
typename RhsType::ConstMemberIterator rhsMemberItr = rhs.FindMember(lhsMemberItr->name);
|
typename RhsType::ConstMemberIterator rhsMemberItr = rhs.FindMember(lhsMemberItr->name);
|
||||||
if (rhsMemberItr == rhs.MemberEnd() || lhsMemberItr->value != rhsMemberItr->value)
|
if (rhsMemberItr == rhs.MemberEnd() || (!(lhsMemberItr->value == rhsMemberItr->value)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -1042,7 +1042,7 @@ public:
|
|||||||
if (data_.a.size != rhs.data_.a.size)
|
if (data_.a.size != rhs.data_.a.size)
|
||||||
return false;
|
return false;
|
||||||
for (SizeType i = 0; i < data_.a.size; i++)
|
for (SizeType i = 0; i < data_.a.size; i++)
|
||||||
if ((*this)[i] != rhs[i])
|
if (!((*this)[i] == rhs[i]))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -1078,6 +1078,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>,internal::IsGenericValue<T> >), (bool)) operator==(const T& rhs) const { return *this == GenericValue(rhs); }
|
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>,internal::IsGenericValue<T> >), (bool)) operator==(const T& rhs) const { return *this == GenericValue(rhs); }
|
||||||
|
|
||||||
|
#ifndef __cpp_impl_three_way_comparison
|
||||||
//! Not-equal-to operator
|
//! Not-equal-to operator
|
||||||
/*! \return !(*this == rhs)
|
/*! \return !(*this == rhs)
|
||||||
*/
|
*/
|
||||||
@@ -1092,7 +1093,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator!=(const T& rhs) const { return !(*this == rhs); }
|
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator!=(const T& rhs) const { return !(*this == rhs); }
|
||||||
|
|
||||||
#ifndef __cpp_lib_three_way_comparison
|
|
||||||
//! Equal-to operator with arbitrary types (symmetric version)
|
//! Equal-to operator with arbitrary types (symmetric version)
|
||||||
/*! \return (rhs == lhs)
|
/*! \return (rhs == lhs)
|
||||||
*/
|
*/
|
||||||
@@ -1230,13 +1230,28 @@ public:
|
|||||||
else {
|
else {
|
||||||
RAPIDJSON_ASSERT(false); // see above note
|
RAPIDJSON_ASSERT(false); // see above note
|
||||||
|
|
||||||
// This will generate -Wexit-time-destructors in clang
|
#if RAPIDJSON_HAS_CXX11
|
||||||
// static GenericValue NullValue;
|
// Use thread-local storage to prevent races between threads.
|
||||||
// return NullValue;
|
// Use static buffer and placement-new to prevent destruction, with
|
||||||
|
// alignas() to ensure proper alignment.
|
||||||
// Use static buffer and placement-new to prevent destruction
|
alignas(GenericValue) thread_local static char buffer[sizeof(GenericValue)];
|
||||||
static char buffer[sizeof(GenericValue)];
|
|
||||||
return *new (buffer) GenericValue();
|
return *new (buffer) GenericValue();
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER < 1900
|
||||||
|
// There's no way to solve both thread locality and proper alignment
|
||||||
|
// simultaneously.
|
||||||
|
__declspec(thread) static char buffer[sizeof(GenericValue)];
|
||||||
|
return *new (buffer) GenericValue();
|
||||||
|
#elif defined(__GNUC__) || defined(__clang__)
|
||||||
|
// This will generate -Wexit-time-destructors in clang, but that's
|
||||||
|
// better than having under-alignment.
|
||||||
|
__thread static GenericValue buffer;
|
||||||
|
return buffer;
|
||||||
|
#else
|
||||||
|
// Don't know what compiler this is, so don't know how to ensure
|
||||||
|
// thread-locality.
|
||||||
|
static GenericValue buffer;
|
||||||
|
return buffer;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template <typename SourceAllocator>
|
template <typename SourceAllocator>
|
||||||
@@ -2430,13 +2445,14 @@ private:
|
|||||||
data_.f.flags = kShortStringFlag;
|
data_.f.flags = kShortStringFlag;
|
||||||
data_.ss.SetLength(s.length);
|
data_.ss.SetLength(s.length);
|
||||||
str = data_.ss.str;
|
str = data_.ss.str;
|
||||||
|
std::memmove(str, s, s.length * sizeof(Ch));
|
||||||
} else {
|
} else {
|
||||||
data_.f.flags = kCopyStringFlag;
|
data_.f.flags = kCopyStringFlag;
|
||||||
data_.s.length = s.length;
|
data_.s.length = s.length;
|
||||||
str = static_cast<Ch *>(allocator.Malloc((s.length + 1) * sizeof(Ch)));
|
str = static_cast<Ch *>(allocator.Malloc((s.length + 1) * sizeof(Ch)));
|
||||||
SetStringPointer(str);
|
SetStringPointer(str);
|
||||||
}
|
|
||||||
std::memcpy(str, s, s.length * sizeof(Ch));
|
std::memcpy(str, s, s.length * sizeof(Ch));
|
||||||
|
}
|
||||||
str[s.length] = '\0';
|
str[s.length] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2486,6 +2502,7 @@ public:
|
|||||||
typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
|
typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
|
||||||
typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of the document.
|
typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of the document.
|
||||||
typedef Allocator AllocatorType; //!< Allocator type from template parameter.
|
typedef Allocator AllocatorType; //!< Allocator type from template parameter.
|
||||||
|
typedef StackAllocator StackAllocatorType; //!< StackAllocator type from template parameter.
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
/*! Creates an empty document of specified type.
|
/*! Creates an empty document of specified type.
|
||||||
|
|||||||
4
src/3rdparty/rapidjson/encodings.h
vendored
4
src/3rdparty/rapidjson/encodings.h
vendored
@@ -177,10 +177,10 @@ struct UTF8 {
|
|||||||
|
|
||||||
template <typename InputStream, typename OutputStream>
|
template <typename InputStream, typename OutputStream>
|
||||||
static bool Validate(InputStream& is, OutputStream& os) {
|
static bool Validate(InputStream& is, OutputStream& os) {
|
||||||
#define RAPIDJSON_COPY() os.Put(c = is.Take())
|
#define RAPIDJSON_COPY() if (c != '\0') os.Put(c = is.Take())
|
||||||
#define RAPIDJSON_TRANS(mask) result &= ((GetRange(static_cast<unsigned char>(c)) & mask) != 0)
|
#define RAPIDJSON_TRANS(mask) result &= ((GetRange(static_cast<unsigned char>(c)) & mask) != 0)
|
||||||
#define RAPIDJSON_TAIL() RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x70)
|
#define RAPIDJSON_TAIL() RAPIDJSON_COPY(); RAPIDJSON_TRANS(0x70)
|
||||||
Ch c;
|
Ch c = static_cast<Ch>(-1);
|
||||||
RAPIDJSON_COPY();
|
RAPIDJSON_COPY();
|
||||||
if (!(c & 0x80))
|
if (!(c & 0x80))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
56
src/3rdparty/rapidjson/error/en.h
vendored
56
src/3rdparty/rapidjson/error/en.h
vendored
@@ -104,11 +104,65 @@ inline const RAPIDJSON_ERROR_CHARTYPE* GetValidateError_En(ValidateErrorCode val
|
|||||||
case kValidateErrorType: return RAPIDJSON_ERROR_STRING("Property has a type '%actual' that is not in the following list: '%expected'.");
|
case kValidateErrorType: return RAPIDJSON_ERROR_STRING("Property has a type '%actual' that is not in the following list: '%expected'.");
|
||||||
|
|
||||||
case kValidateErrorOneOf: return RAPIDJSON_ERROR_STRING("Property did not match any of the sub-schemas specified by 'oneOf', refer to following errors.");
|
case kValidateErrorOneOf: return RAPIDJSON_ERROR_STRING("Property did not match any of the sub-schemas specified by 'oneOf', refer to following errors.");
|
||||||
case kValidateErrorOneOfMatch: return RAPIDJSON_ERROR_STRING("Property matched more than one of the sub-schemas specified by 'oneOf'.");
|
case kValidateErrorOneOfMatch: return RAPIDJSON_ERROR_STRING("Property matched more than one of the sub-schemas specified by 'oneOf', indices '%matches'.");
|
||||||
case kValidateErrorAllOf: return RAPIDJSON_ERROR_STRING("Property did not match all of the sub-schemas specified by 'allOf', refer to following errors.");
|
case kValidateErrorAllOf: return RAPIDJSON_ERROR_STRING("Property did not match all of the sub-schemas specified by 'allOf', refer to following errors.");
|
||||||
case kValidateErrorAnyOf: return RAPIDJSON_ERROR_STRING("Property did not match any of the sub-schemas specified by 'anyOf', refer to following errors.");
|
case kValidateErrorAnyOf: return RAPIDJSON_ERROR_STRING("Property did not match any of the sub-schemas specified by 'anyOf', refer to following errors.");
|
||||||
case kValidateErrorNot: return RAPIDJSON_ERROR_STRING("Property matched the sub-schema specified by 'not'.");
|
case kValidateErrorNot: return RAPIDJSON_ERROR_STRING("Property matched the sub-schema specified by 'not'.");
|
||||||
|
|
||||||
|
case kValidateErrorReadOnly: return RAPIDJSON_ERROR_STRING("Property is read-only but has been provided when validation is for writing.");
|
||||||
|
case kValidateErrorWriteOnly: return RAPIDJSON_ERROR_STRING("Property is write-only but has been provided when validation is for reading.");
|
||||||
|
|
||||||
|
default: return RAPIDJSON_ERROR_STRING("Unknown error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Maps error code of schema document compilation into error message.
|
||||||
|
/*!
|
||||||
|
\ingroup RAPIDJSON_ERRORS
|
||||||
|
\param schemaErrorCode Error code obtained from compiling the schema document.
|
||||||
|
\return the error message.
|
||||||
|
\note User can make a copy of this function for localization.
|
||||||
|
Using switch-case is safer for future modification of error codes.
|
||||||
|
*/
|
||||||
|
inline const RAPIDJSON_ERROR_CHARTYPE* GetSchemaError_En(SchemaErrorCode schemaErrorCode) {
|
||||||
|
switch (schemaErrorCode) {
|
||||||
|
case kSchemaErrorNone: return RAPIDJSON_ERROR_STRING("No error.");
|
||||||
|
|
||||||
|
case kSchemaErrorStartUnknown: return RAPIDJSON_ERROR_STRING("Pointer '%value' to start of schema does not resolve to a location in the document.");
|
||||||
|
case kSchemaErrorRefPlainName: return RAPIDJSON_ERROR_STRING("$ref fragment '%value' must be a JSON pointer.");
|
||||||
|
case kSchemaErrorRefInvalid: return RAPIDJSON_ERROR_STRING("$ref must not be an empty string.");
|
||||||
|
case kSchemaErrorRefPointerInvalid: return RAPIDJSON_ERROR_STRING("$ref fragment '%value' is not a valid JSON pointer at offset '%offset'.");
|
||||||
|
case kSchemaErrorRefUnknown: return RAPIDJSON_ERROR_STRING("$ref '%value' does not resolve to a location in the target document.");
|
||||||
|
case kSchemaErrorRefCyclical: return RAPIDJSON_ERROR_STRING("$ref '%value' is cyclical.");
|
||||||
|
case kSchemaErrorRefNoRemoteProvider: return RAPIDJSON_ERROR_STRING("$ref is remote but there is no remote provider.");
|
||||||
|
case kSchemaErrorRefNoRemoteSchema: return RAPIDJSON_ERROR_STRING("$ref '%value' is remote but the remote provider did not return a schema.");
|
||||||
|
case kSchemaErrorRegexInvalid: return RAPIDJSON_ERROR_STRING("Invalid regular expression '%value' in 'pattern' or 'patternProperties'.");
|
||||||
|
case kSchemaErrorSpecUnknown: return RAPIDJSON_ERROR_STRING("JSON schema draft or OpenAPI version is not recognized.");
|
||||||
|
case kSchemaErrorSpecUnsupported: return RAPIDJSON_ERROR_STRING("JSON schema draft or OpenAPI version is not supported.");
|
||||||
|
case kSchemaErrorSpecIllegal: return RAPIDJSON_ERROR_STRING("Both JSON schema draft and OpenAPI version found in document.");
|
||||||
|
case kSchemaErrorReadOnlyAndWriteOnly: return RAPIDJSON_ERROR_STRING("Property must not be both 'readOnly' and 'writeOnly'.");
|
||||||
|
|
||||||
|
default: return RAPIDJSON_ERROR_STRING("Unknown error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Maps error code of pointer parse into error message.
|
||||||
|
/*!
|
||||||
|
\ingroup RAPIDJSON_ERRORS
|
||||||
|
\param pointerParseErrorCode Error code obtained from pointer parse.
|
||||||
|
\return the error message.
|
||||||
|
\note User can make a copy of this function for localization.
|
||||||
|
Using switch-case is safer for future modification of error codes.
|
||||||
|
*/
|
||||||
|
inline const RAPIDJSON_ERROR_CHARTYPE* GetPointerParseError_En(PointerParseErrorCode pointerParseErrorCode) {
|
||||||
|
switch (pointerParseErrorCode) {
|
||||||
|
case kPointerParseErrorNone: return RAPIDJSON_ERROR_STRING("No error.");
|
||||||
|
|
||||||
|
case kPointerParseErrorTokenMustBeginWithSolidus: return RAPIDJSON_ERROR_STRING("A token must begin with a '/'.");
|
||||||
|
case kPointerParseErrorInvalidEscape: return RAPIDJSON_ERROR_STRING("Invalid escape.");
|
||||||
|
case kPointerParseErrorInvalidPercentEncoding: return RAPIDJSON_ERROR_STRING("Invalid percent encoding in URI fragment.");
|
||||||
|
case kPointerParseErrorCharacterMustPercentEncode: return RAPIDJSON_ERROR_STRING("A character must be percent encoded in a URI fragment.");
|
||||||
|
|
||||||
default: return RAPIDJSON_ERROR_STRING("Unknown error.");
|
default: return RAPIDJSON_ERROR_STRING("Unknown error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
77
src/3rdparty/rapidjson/error/error.h
vendored
77
src/3rdparty/rapidjson/error/error.h
vendored
@@ -42,7 +42,7 @@ RAPIDJSON_DIAG_OFF(padded)
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// RAPIDJSON_ERROR_STRING
|
// RAPIDJSON_ERROR_STRING
|
||||||
|
|
||||||
//! Macro for converting string literial to \ref RAPIDJSON_ERROR_CHARTYPE[].
|
//! Macro for converting string literal to \ref RAPIDJSON_ERROR_CHARTYPE[].
|
||||||
/*! \ingroup RAPIDJSON_ERRORS
|
/*! \ingroup RAPIDJSON_ERRORS
|
||||||
By default this conversion macro does nothing.
|
By default this conversion macro does nothing.
|
||||||
On Windows, user can define this macro as \c _T(x) for supporting both
|
On Windows, user can define this macro as \c _T(x) for supporting both
|
||||||
@@ -185,14 +185,17 @@ enum ValidateErrorCode {
|
|||||||
kValidateErrorPatternProperties, //!< See other errors.
|
kValidateErrorPatternProperties, //!< See other errors.
|
||||||
kValidateErrorDependencies, //!< Object has missing property or schema dependencies.
|
kValidateErrorDependencies, //!< Object has missing property or schema dependencies.
|
||||||
|
|
||||||
kValidateErrorEnum, //!< Property has a value that is not one of its allowed enumerated values
|
kValidateErrorEnum, //!< Property has a value that is not one of its allowed enumerated values.
|
||||||
kValidateErrorType, //!< Property has a type that is not allowed by the schema..
|
kValidateErrorType, //!< Property has a type that is not allowed by the schema.
|
||||||
|
|
||||||
kValidateErrorOneOf, //!< Property did not match any of the sub-schemas specified by 'oneOf'.
|
kValidateErrorOneOf, //!< Property did not match any of the sub-schemas specified by 'oneOf'.
|
||||||
kValidateErrorOneOfMatch, //!< Property matched more than one of the sub-schemas specified by 'oneOf'.
|
kValidateErrorOneOfMatch, //!< Property matched more than one of the sub-schemas specified by 'oneOf'.
|
||||||
kValidateErrorAllOf, //!< Property did not match all of the sub-schemas specified by 'allOf'.
|
kValidateErrorAllOf, //!< Property did not match all of the sub-schemas specified by 'allOf'.
|
||||||
kValidateErrorAnyOf, //!< Property did not match any of the sub-schemas specified by 'anyOf'.
|
kValidateErrorAnyOf, //!< Property did not match any of the sub-schemas specified by 'anyOf'.
|
||||||
kValidateErrorNot //!< Property matched the sub-schema specified by 'not'.
|
kValidateErrorNot, //!< Property matched the sub-schema specified by 'not'.
|
||||||
|
|
||||||
|
kValidateErrorReadOnly, //!< Property is read-only but has been provided when validation is for writing
|
||||||
|
kValidateErrorWriteOnly //!< Property is write-only but has been provided when validation is for reading
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Function pointer type of GetValidateError().
|
//! Function pointer type of GetValidateError().
|
||||||
@@ -207,6 +210,72 @@ enum ValidateErrorCode {
|
|||||||
*/
|
*/
|
||||||
typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetValidateErrorFunc)(ValidateErrorCode);
|
typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetValidateErrorFunc)(ValidateErrorCode);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SchemaErrorCode
|
||||||
|
|
||||||
|
//! Error codes when validating.
|
||||||
|
/*! \ingroup RAPIDJSON_ERRORS
|
||||||
|
\see GenericSchemaValidator
|
||||||
|
*/
|
||||||
|
enum SchemaErrorCode {
|
||||||
|
kSchemaErrorNone = 0, //!< No error.
|
||||||
|
|
||||||
|
kSchemaErrorStartUnknown, //!< Pointer to start of schema does not resolve to a location in the document
|
||||||
|
kSchemaErrorRefPlainName, //!< $ref fragment must be a JSON pointer
|
||||||
|
kSchemaErrorRefInvalid, //!< $ref must not be an empty string
|
||||||
|
kSchemaErrorRefPointerInvalid, //!< $ref fragment is not a valid JSON pointer at offset
|
||||||
|
kSchemaErrorRefUnknown, //!< $ref does not resolve to a location in the target document
|
||||||
|
kSchemaErrorRefCyclical, //!< $ref is cyclical
|
||||||
|
kSchemaErrorRefNoRemoteProvider, //!< $ref is remote but there is no remote provider
|
||||||
|
kSchemaErrorRefNoRemoteSchema, //!< $ref is remote but the remote provider did not return a schema
|
||||||
|
kSchemaErrorRegexInvalid, //!< Invalid regular expression in 'pattern' or 'patternProperties'
|
||||||
|
kSchemaErrorSpecUnknown, //!< JSON schema draft or OpenAPI version is not recognized
|
||||||
|
kSchemaErrorSpecUnsupported, //!< JSON schema draft or OpenAPI version is not supported
|
||||||
|
kSchemaErrorSpecIllegal, //!< Both JSON schema draft and OpenAPI version found in document
|
||||||
|
kSchemaErrorReadOnlyAndWriteOnly //!< Property must not be both 'readOnly' and 'writeOnly'
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Function pointer type of GetSchemaError().
|
||||||
|
/*! \ingroup RAPIDJSON_ERRORS
|
||||||
|
|
||||||
|
This is the prototype for \c GetSchemaError_X(), where \c X is a locale.
|
||||||
|
User can dynamically change locale in runtime, e.g.:
|
||||||
|
\code
|
||||||
|
GetSchemaErrorFunc GetSchemaError = GetSchemaError_En; // or whatever
|
||||||
|
const RAPIDJSON_ERROR_CHARTYPE* s = GetSchemaError(validator.GetInvalidSchemaCode());
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
|
typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetSchemaErrorFunc)(SchemaErrorCode);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// PointerParseErrorCode
|
||||||
|
|
||||||
|
//! Error code of JSON pointer parsing.
|
||||||
|
/*! \ingroup RAPIDJSON_ERRORS
|
||||||
|
\see GenericPointer::GenericPointer, GenericPointer::GetParseErrorCode
|
||||||
|
*/
|
||||||
|
enum PointerParseErrorCode {
|
||||||
|
kPointerParseErrorNone = 0, //!< The parse is successful
|
||||||
|
|
||||||
|
kPointerParseErrorTokenMustBeginWithSolidus, //!< A token must begin with a '/'
|
||||||
|
kPointerParseErrorInvalidEscape, //!< Invalid escape
|
||||||
|
kPointerParseErrorInvalidPercentEncoding, //!< Invalid percent encoding in URI fragment
|
||||||
|
kPointerParseErrorCharacterMustPercentEncode //!< A character must percent encoded in URI fragment
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Function pointer type of GetPointerParseError().
|
||||||
|
/*! \ingroup RAPIDJSON_ERRORS
|
||||||
|
|
||||||
|
This is the prototype for \c GetPointerParseError_X(), where \c X is a locale.
|
||||||
|
User can dynamically change locale in runtime, e.g.:
|
||||||
|
\code
|
||||||
|
GetPointerParseErrorFunc GetPointerParseError = GetPointerParseError_En; // or whatever
|
||||||
|
const RAPIDJSON_ERROR_CHARTYPE* s = GetPointerParseError(pointer.GetParseErrorCode());
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
|
typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetPointerParseErrorFunc)(PointerParseErrorCode);
|
||||||
|
|
||||||
|
|
||||||
RAPIDJSON_NAMESPACE_END
|
RAPIDJSON_NAMESPACE_END
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
|||||||
6
src/3rdparty/rapidjson/internal/biginteger.h
vendored
6
src/3rdparty/rapidjson/internal/biginteger.h
vendored
@@ -19,7 +19,11 @@
|
|||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && defined(_M_AMD64)
|
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && defined(_M_AMD64)
|
||||||
#include <intrin.h> // for _umul128
|
#include <intrin.h> // for _umul128
|
||||||
|
#if !defined(_ARM64EC_)
|
||||||
#pragma intrinsic(_umul128)
|
#pragma intrinsic(_umul128)
|
||||||
|
#else
|
||||||
|
#pragma comment(lib,"softintrin")
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RAPIDJSON_NAMESPACE_BEGIN
|
RAPIDJSON_NAMESPACE_BEGIN
|
||||||
@@ -255,7 +259,7 @@ private:
|
|||||||
if (low < k)
|
if (low < k)
|
||||||
(*outHigh)++;
|
(*outHigh)++;
|
||||||
return low;
|
return low;
|
||||||
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
|
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
|
||||||
__extension__ typedef unsigned __int128 uint128;
|
__extension__ typedef unsigned __int128 uint128;
|
||||||
uint128 p = static_cast<uint128>(a) * static_cast<uint128>(b);
|
uint128 p = static_cast<uint128>(a) * static_cast<uint128>(b);
|
||||||
p += k;
|
p += k;
|
||||||
|
|||||||
6
src/3rdparty/rapidjson/internal/diyfp.h
vendored
6
src/3rdparty/rapidjson/internal/diyfp.h
vendored
@@ -25,7 +25,11 @@
|
|||||||
|
|
||||||
#if defined(_MSC_VER) && defined(_M_AMD64) && !defined(__INTEL_COMPILER)
|
#if defined(_MSC_VER) && defined(_M_AMD64) && !defined(__INTEL_COMPILER)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
|
#if !defined(_ARM64EC_)
|
||||||
#pragma intrinsic(_umul128)
|
#pragma intrinsic(_umul128)
|
||||||
|
#else
|
||||||
|
#pragma comment(lib,"softintrin")
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RAPIDJSON_NAMESPACE_BEGIN
|
RAPIDJSON_NAMESPACE_BEGIN
|
||||||
@@ -75,7 +79,7 @@ struct DiyFp {
|
|||||||
if (l & (uint64_t(1) << 63)) // rounding
|
if (l & (uint64_t(1) << 63)) // rounding
|
||||||
h++;
|
h++;
|
||||||
return DiyFp(h, e + rhs.e + 64);
|
return DiyFp(h, e + rhs.e + 64);
|
||||||
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
|
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
|
||||||
__extension__ typedef unsigned __int128 uint128;
|
__extension__ typedef unsigned __int128 uint128;
|
||||||
uint128 p = static_cast<uint128>(f) * static_cast<uint128>(rhs.f);
|
uint128 p = static_cast<uint128>(f) * static_cast<uint128>(rhs.f);
|
||||||
uint64_t h = static_cast<uint64_t>(p >> 64);
|
uint64_t h = static_cast<uint64_t>(p >> 64);
|
||||||
|
|||||||
10
src/3rdparty/rapidjson/internal/dtoa.h
vendored
10
src/3rdparty/rapidjson/internal/dtoa.h
vendored
@@ -58,11 +58,11 @@ inline int CountDecimalDigit32(uint32_t n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) {
|
inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) {
|
||||||
static const uint64_t kPow10[] = { 1U, 10U, 100U, 1000U, 10000U, 100000U, 1000000U, 10000000U, 100000000U,
|
static const uint64_t kPow10[] = { 1ULL, 10ULL, 100ULL, 1000ULL, 10000ULL, 100000ULL, 1000000ULL, 10000000ULL, 100000000ULL,
|
||||||
1000000000U, 10000000000U, 100000000000U, 1000000000000U,
|
1000000000ULL, 10000000000ULL, 100000000000ULL, 1000000000000ULL,
|
||||||
10000000000000U, 100000000000000U, 1000000000000000U,
|
10000000000000ULL, 100000000000000ULL, 1000000000000000ULL,
|
||||||
10000000000000000U, 100000000000000000U, 1000000000000000000U,
|
10000000000000000ULL, 100000000000000000ULL, 1000000000000000000ULL,
|
||||||
10000000000000000000U };
|
10000000000000000000ULL };
|
||||||
const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);
|
const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);
|
||||||
const DiyFp wp_w = Mp - W;
|
const DiyFp wp_w = Mp - W;
|
||||||
uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);
|
uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);
|
||||||
|
|||||||
2
src/3rdparty/rapidjson/internal/regex.h
vendored
2
src/3rdparty/rapidjson/internal/regex.h
vendored
@@ -615,7 +615,7 @@ public:
|
|||||||
RAPIDJSON_ASSERT(regex_.IsValid());
|
RAPIDJSON_ASSERT(regex_.IsValid());
|
||||||
if (!allocator_)
|
if (!allocator_)
|
||||||
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
|
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
|
||||||
stateSet_ = static_cast<unsigned*>(allocator_->Malloc(GetStateSetSize()));
|
stateSet_ = static_cast<uint32_t*>(allocator_->Malloc(GetStateSetSize()));
|
||||||
state0_.template Reserve<SizeType>(regex_.stateCount_);
|
state0_.template Reserve<SizeType>(regex_.stateCount_);
|
||||||
state1_.template Reserve<SizeType>(regex_.stateCount_);
|
state1_.template Reserve<SizeType>(regex_.stateCount_);
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/3rdparty/rapidjson/internal/strtod.h
vendored
2
src/3rdparty/rapidjson/internal/strtod.h
vendored
@@ -134,7 +134,7 @@ inline bool StrtodDiyFp(const Ch* decimals, int dLen, int dExp, double* result)
|
|||||||
int i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999
|
int i = 0; // 2^64 - 1 = 18446744073709551615, 1844674407370955161 = 0x1999999999999999
|
||||||
for (; i < dLen; i++) {
|
for (; i < dLen; i++) {
|
||||||
if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) ||
|
if (significand > RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) ||
|
||||||
(significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] > Ch('5')))
|
(significand == RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) && decimals[i] >= Ch('5')))
|
||||||
break;
|
break;
|
||||||
significand = significand * 10u + static_cast<unsigned>(decimals[i] - Ch('0'));
|
significand = significand * 10u + static_cast<unsigned>(decimals[i] - Ch('0'));
|
||||||
}
|
}
|
||||||
|
|||||||
36
src/3rdparty/rapidjson/pointer.h
vendored
36
src/3rdparty/rapidjson/pointer.h
vendored
@@ -18,6 +18,7 @@
|
|||||||
#include "document.h"
|
#include "document.h"
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
#include "internal/itoa.h"
|
#include "internal/itoa.h"
|
||||||
|
#include "error/error.h" // PointerParseErrorCode
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
RAPIDJSON_DIAG_PUSH
|
RAPIDJSON_DIAG_PUSH
|
||||||
@@ -27,23 +28,16 @@ RAPIDJSON_DIAG_PUSH
|
|||||||
RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated
|
RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(RAPIDJSON_CPLUSPLUS) && RAPIDJSON_CPLUSPLUS >= 201703L
|
||||||
|
#define RAPIDJSON_IF_CONSTEXPR if constexpr
|
||||||
|
#else
|
||||||
|
#define RAPIDJSON_IF_CONSTEXPR if
|
||||||
|
#endif
|
||||||
|
|
||||||
RAPIDJSON_NAMESPACE_BEGIN
|
RAPIDJSON_NAMESPACE_BEGIN
|
||||||
|
|
||||||
static const SizeType kPointerInvalidIndex = ~SizeType(0); //!< Represents an invalid index in GenericPointer::Token
|
static const SizeType kPointerInvalidIndex = ~SizeType(0); //!< Represents an invalid index in GenericPointer::Token
|
||||||
|
|
||||||
//! Error code of parsing.
|
|
||||||
/*! \ingroup RAPIDJSON_ERRORS
|
|
||||||
\see GenericPointer::GenericPointer, GenericPointer::GetParseErrorCode
|
|
||||||
*/
|
|
||||||
enum PointerParseErrorCode {
|
|
||||||
kPointerParseErrorNone = 0, //!< The parse is successful
|
|
||||||
|
|
||||||
kPointerParseErrorTokenMustBeginWithSolidus, //!< A token must begin with a '/'
|
|
||||||
kPointerParseErrorInvalidEscape, //!< Invalid escape
|
|
||||||
kPointerParseErrorInvalidPercentEncoding, //!< Invalid percent encoding in URI fragment
|
|
||||||
kPointerParseErrorCharacterMustPercentEncode //!< A character must percent encoded in URI fragment
|
|
||||||
};
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// GenericPointer
|
// GenericPointer
|
||||||
|
|
||||||
@@ -303,7 +297,7 @@ public:
|
|||||||
SizeType length = static_cast<SizeType>(end - buffer);
|
SizeType length = static_cast<SizeType>(end - buffer);
|
||||||
buffer[length] = '\0';
|
buffer[length] = '\0';
|
||||||
|
|
||||||
if (sizeof(Ch) == 1) {
|
RAPIDJSON_IF_CONSTEXPR (sizeof(Ch) == 1) {
|
||||||
Token token = { reinterpret_cast<Ch*>(buffer), length, index };
|
Token token = { reinterpret_cast<Ch*>(buffer), length, index };
|
||||||
return Append(token, allocator);
|
return Append(token, allocator);
|
||||||
}
|
}
|
||||||
@@ -902,10 +896,16 @@ private:
|
|||||||
std::memcpy(nameBuffer_, rhs.nameBuffer_, nameBufferSize * sizeof(Ch));
|
std::memcpy(nameBuffer_, rhs.nameBuffer_, nameBufferSize * sizeof(Ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust pointers to name buffer
|
// The names of each token point to a string in the nameBuffer_. The
|
||||||
std::ptrdiff_t diff = nameBuffer_ - rhs.nameBuffer_;
|
// previous memcpy copied over string pointers into the rhs.nameBuffer_,
|
||||||
for (Token *t = tokens_; t != tokens_ + rhs.tokenCount_; ++t)
|
// but they should point to the strings in the new nameBuffer_.
|
||||||
t->name += diff;
|
for (size_t i = 0; i < rhs.tokenCount_; ++i) {
|
||||||
|
// The offset between the string address and the name buffer should
|
||||||
|
// still be constant, so we can just get this offset and set each new
|
||||||
|
// token name according the new buffer start + the known offset.
|
||||||
|
std::ptrdiff_t name_offset = rhs.tokens_[i].name - rhs.nameBuffer_;
|
||||||
|
tokens_[i].name = nameBuffer_ + name_offset;
|
||||||
|
}
|
||||||
|
|
||||||
return nameBuffer_ + nameBufferSize;
|
return nameBuffer_ + nameBufferSize;
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/3rdparty/rapidjson/rapidjson.h
vendored
2
src/3rdparty/rapidjson/rapidjson.h
vendored
@@ -268,7 +268,7 @@
|
|||||||
# elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
# elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
||||||
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
|
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
|
||||||
// Detect with architecture macros
|
// Detect with architecture macros
|
||||||
# elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || defined(__hpux) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__)
|
# elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || defined(__hpux) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__)
|
||||||
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
|
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
|
||||||
# elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || defined(__bfin__)
|
# elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || defined(__bfin__)
|
||||||
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
|
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
|
||||||
|
|||||||
8
src/3rdparty/rapidjson/reader.h
vendored
8
src/3rdparty/rapidjson/reader.h
vendored
@@ -1433,7 +1433,7 @@ private:
|
|||||||
class NumberStream<InputStream, StackCharacter, true, false> : public NumberStream<InputStream, StackCharacter, false, false> {
|
class NumberStream<InputStream, StackCharacter, true, false> : public NumberStream<InputStream, StackCharacter, false, false> {
|
||||||
typedef NumberStream<InputStream, StackCharacter, false, false> Base;
|
typedef NumberStream<InputStream, StackCharacter, false, false> Base;
|
||||||
public:
|
public:
|
||||||
NumberStream(GenericReader& reader, InputStream& is) : Base(reader, is), stackStream(reader.stack_) {}
|
NumberStream(GenericReader& reader, InputStream& s) : Base(reader, s), stackStream(reader.stack_) {}
|
||||||
|
|
||||||
RAPIDJSON_FORCEINLINE Ch TakePush() {
|
RAPIDJSON_FORCEINLINE Ch TakePush() {
|
||||||
stackStream.Put(static_cast<StackCharacter>(Base::is.Peek()));
|
stackStream.Put(static_cast<StackCharacter>(Base::is.Peek()));
|
||||||
@@ -1459,7 +1459,7 @@ private:
|
|||||||
class NumberStream<InputStream, StackCharacter, true, true> : public NumberStream<InputStream, StackCharacter, true, false> {
|
class NumberStream<InputStream, StackCharacter, true, true> : public NumberStream<InputStream, StackCharacter, true, false> {
|
||||||
typedef NumberStream<InputStream, StackCharacter, true, false> Base;
|
typedef NumberStream<InputStream, StackCharacter, true, false> Base;
|
||||||
public:
|
public:
|
||||||
NumberStream(GenericReader& reader, InputStream& is) : Base(reader, is) {}
|
NumberStream(GenericReader& reader, InputStream& s) : Base(reader, s) {}
|
||||||
|
|
||||||
RAPIDJSON_FORCEINLINE Ch Take() { return Base::TakePush(); }
|
RAPIDJSON_FORCEINLINE Ch Take() { return Base::TakePush(); }
|
||||||
};
|
};
|
||||||
@@ -1584,7 +1584,7 @@ private:
|
|||||||
// Parse frac = decimal-point 1*DIGIT
|
// Parse frac = decimal-point 1*DIGIT
|
||||||
int expFrac = 0;
|
int expFrac = 0;
|
||||||
size_t decimalPosition;
|
size_t decimalPosition;
|
||||||
if (Consume(s, '.')) {
|
if (!useNanOrInf && Consume(s, '.')) {
|
||||||
decimalPosition = s.Length();
|
decimalPosition = s.Length();
|
||||||
|
|
||||||
if (RAPIDJSON_UNLIKELY(!(s.Peek() >= '0' && s.Peek() <= '9')))
|
if (RAPIDJSON_UNLIKELY(!(s.Peek() >= '0' && s.Peek() <= '9')))
|
||||||
@@ -1631,7 +1631,7 @@ private:
|
|||||||
|
|
||||||
// Parse exp = e [ minus / plus ] 1*DIGIT
|
// Parse exp = e [ minus / plus ] 1*DIGIT
|
||||||
int exp = 0;
|
int exp = 0;
|
||||||
if (Consume(s, 'e') || Consume(s, 'E')) {
|
if (!useNanOrInf && (Consume(s, 'e') || Consume(s, 'E'))) {
|
||||||
if (!useDouble) {
|
if (!useDouble) {
|
||||||
d = static_cast<double>(use64bit ? i64 : i);
|
d = static_cast<double>(use64bit ? i64 : i);
|
||||||
useDouble = true;
|
useDouble = true;
|
||||||
|
|||||||
756
src/3rdparty/rapidjson/schema.h
vendored
756
src/3rdparty/rapidjson/schema.h
vendored
File diff suppressed because it is too large
Load Diff
35
src/3rdparty/rapidjson/uri.h
vendored
35
src/3rdparty/rapidjson/uri.h
vendored
@@ -238,20 +238,27 @@ private:
|
|||||||
|
|
||||||
// Allocate one block containing each part of the URI (5) plus base plus full URI, all null terminated.
|
// Allocate one block containing each part of the URI (5) plus base plus full URI, all null terminated.
|
||||||
// Order: scheme, auth, path, query, frag, base, uri
|
// Order: scheme, auth, path, query, frag, base, uri
|
||||||
|
// Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
|
||||||
size_t total = (3 * len + 7) * sizeof(Ch);
|
size_t total = (3 * len + 7) * sizeof(Ch);
|
||||||
scheme_ = static_cast<Ch*>(allocator_->Malloc(total));
|
scheme_ = static_cast<Ch*>(allocator_->Malloc(total));
|
||||||
*scheme_ = '\0';
|
*scheme_ = '\0';
|
||||||
auth_ = scheme_ + 1;
|
auth_ = scheme_;
|
||||||
|
auth_++;
|
||||||
*auth_ = '\0';
|
*auth_ = '\0';
|
||||||
path_ = auth_ + 1;
|
path_ = auth_;
|
||||||
|
path_++;
|
||||||
*path_ = '\0';
|
*path_ = '\0';
|
||||||
query_ = path_ + 1;
|
query_ = path_;
|
||||||
|
query_++;
|
||||||
*query_ = '\0';
|
*query_ = '\0';
|
||||||
frag_ = query_ + 1;
|
frag_ = query_;
|
||||||
|
frag_++;
|
||||||
*frag_ = '\0';
|
*frag_ = '\0';
|
||||||
base_ = frag_ + 1;
|
base_ = frag_;
|
||||||
|
base_++;
|
||||||
*base_ = '\0';
|
*base_ = '\0';
|
||||||
uri_ = base_ + 1;
|
uri_ = base_;
|
||||||
|
uri_++;
|
||||||
*uri_ = '\0';
|
*uri_ = '\0';
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
@@ -293,7 +300,9 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Look for auth (//([^/?#]*))?
|
// Look for auth (//([^/?#]*))?
|
||||||
auth_ = scheme_ + GetSchemeStringLength() + 1;
|
// Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
|
||||||
|
auth_ = scheme_ + GetSchemeStringLength();
|
||||||
|
auth_++;
|
||||||
*auth_ = '\0';
|
*auth_ = '\0';
|
||||||
if (start < len - 1 && uri[start] == '/' && uri[start + 1] == '/') {
|
if (start < len - 1 && uri[start] == '/' && uri[start + 1] == '/') {
|
||||||
pos2 = start + 2;
|
pos2 = start + 2;
|
||||||
@@ -308,7 +317,9 @@ private:
|
|||||||
start = pos2;
|
start = pos2;
|
||||||
}
|
}
|
||||||
// Look for path ([^?#]*)
|
// Look for path ([^?#]*)
|
||||||
path_ = auth_ + GetAuthStringLength() + 1;
|
// Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
|
||||||
|
path_ = auth_ + GetAuthStringLength();
|
||||||
|
path_++;
|
||||||
*path_ = '\0';
|
*path_ = '\0';
|
||||||
if (start < len) {
|
if (start < len) {
|
||||||
pos2 = start;
|
pos2 = start;
|
||||||
@@ -326,7 +337,9 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Look for query (\?([^#]*))?
|
// Look for query (\?([^#]*))?
|
||||||
query_ = path_ + GetPathStringLength() + 1;
|
// Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
|
||||||
|
query_ = path_ + GetPathStringLength();
|
||||||
|
query_++;
|
||||||
*query_ = '\0';
|
*query_ = '\0';
|
||||||
if (start < len && uri[start] == '?') {
|
if (start < len && uri[start] == '?') {
|
||||||
pos2 = start + 1;
|
pos2 = start + 1;
|
||||||
@@ -341,7 +354,9 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Look for fragment (#(.*))?
|
// Look for fragment (#(.*))?
|
||||||
frag_ = query_ + GetQueryStringLength() + 1;
|
// Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
|
||||||
|
frag_ = query_ + GetQueryStringLength();
|
||||||
|
frag_++;
|
||||||
*frag_ = '\0';
|
*frag_ = '\0';
|
||||||
if (start < len && uri[start] == '#') {
|
if (start < len && uri[start] == '#') {
|
||||||
std::memcpy(frag_, &uri[start], (len - start) * sizeof(Ch));
|
std::memcpy(frag_, &uri[start], (len - start) * sizeof(Ch));
|
||||||
|
|||||||
13
src/3rdparty/rapidjson/writer.h
vendored
13
src/3rdparty/rapidjson/writer.h
vendored
@@ -67,6 +67,7 @@ enum WriteFlag {
|
|||||||
kWriteNoFlags = 0, //!< No flags are set.
|
kWriteNoFlags = 0, //!< No flags are set.
|
||||||
kWriteValidateEncodingFlag = 1, //!< Validate encoding of JSON strings.
|
kWriteValidateEncodingFlag = 1, //!< Validate encoding of JSON strings.
|
||||||
kWriteNanAndInfFlag = 2, //!< Allow writing of Infinity, -Infinity and NaN.
|
kWriteNanAndInfFlag = 2, //!< Allow writing of Infinity, -Infinity and NaN.
|
||||||
|
kWriteNanAndInfNullFlag = 4, //!< Allow writing of Infinity, -Infinity and NaN as null.
|
||||||
kWriteDefaultFlags = RAPIDJSON_WRITE_DEFAULT_FLAGS //!< Default write flags. Can be customized by defining RAPIDJSON_WRITE_DEFAULT_FLAGS
|
kWriteDefaultFlags = RAPIDJSON_WRITE_DEFAULT_FLAGS //!< Default write flags. Can be customized by defining RAPIDJSON_WRITE_DEFAULT_FLAGS
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -349,8 +350,13 @@ protected:
|
|||||||
|
|
||||||
bool WriteDouble(double d) {
|
bool WriteDouble(double d) {
|
||||||
if (internal::Double(d).IsNanOrInf()) {
|
if (internal::Double(d).IsNanOrInf()) {
|
||||||
if (!(writeFlags & kWriteNanAndInfFlag))
|
if (!(writeFlags & kWriteNanAndInfFlag) && !(writeFlags & kWriteNanAndInfNullFlag))
|
||||||
return false;
|
return false;
|
||||||
|
if (writeFlags & kWriteNanAndInfNullFlag) {
|
||||||
|
PutReserve(*os_, 4);
|
||||||
|
PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'u'); PutUnsafe(*os_, 'l'); PutUnsafe(*os_, 'l');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (internal::Double(d).IsNan()) {
|
if (internal::Double(d).IsNan()) {
|
||||||
PutReserve(*os_, 3);
|
PutReserve(*os_, 3);
|
||||||
PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
|
PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
|
||||||
@@ -549,6 +555,11 @@ inline bool Writer<StringBuffer>::WriteDouble(double d) {
|
|||||||
// Note: This code path can only be reached if (RAPIDJSON_WRITE_DEFAULT_FLAGS & kWriteNanAndInfFlag).
|
// Note: This code path can only be reached if (RAPIDJSON_WRITE_DEFAULT_FLAGS & kWriteNanAndInfFlag).
|
||||||
if (!(kWriteDefaultFlags & kWriteNanAndInfFlag))
|
if (!(kWriteDefaultFlags & kWriteNanAndInfFlag))
|
||||||
return false;
|
return false;
|
||||||
|
if (kWriteDefaultFlags & kWriteNanAndInfNullFlag) {
|
||||||
|
PutReserve(*os_, 4);
|
||||||
|
PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'u'); PutUnsafe(*os_, 'l'); PutUnsafe(*os_, 'l');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (internal::Double(d).IsNan()) {
|
if (internal::Double(d).IsNan()) {
|
||||||
PutReserve(*os_, 3);
|
PutReserve(*os_, 3);
|
||||||
PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
|
PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
|
||||||
|
|||||||
@@ -322,7 +322,8 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
|||||||
|
|
||||||
if (L3_exclusive) {
|
if (L3_exclusive) {
|
||||||
if (vendor() == VENDOR_AMD) {
|
if (vendor() == VENDOR_AMD) {
|
||||||
extra += std::min<size_t>(l2->attr->cache.size, scratchpad);
|
// For some reason, AMD CPUs can use only half of the exclusive L2/L3 cache combo efficiently
|
||||||
|
extra += std::min<size_t>(l2->attr->cache.size / 2, scratchpad);
|
||||||
}
|
}
|
||||||
else if (l2->attr->cache.size >= scratchpad) {
|
else if (l2->attr->cache.size >= scratchpad) {
|
||||||
extra += scratchpad;
|
extra += scratchpad;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2025 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "base/api/Api.h"
|
#include "base/api/Api.h"
|
||||||
|
#include "3rdparty/rapidjson/writer.h"
|
||||||
#include "base/api/interfaces/IApiListener.h"
|
#include "base/api/interfaces/IApiListener.h"
|
||||||
#include "base/api/requests/HttpApiRequest.h"
|
#include "base/api/requests/HttpApiRequest.h"
|
||||||
#include "base/crypto/keccak.h"
|
#include "base/crypto/keccak.h"
|
||||||
@@ -31,7 +32,6 @@
|
|||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "base/tools/Cvt.h"
|
#include "base/tools/Cvt.h"
|
||||||
#include "core/config/Config.h"
|
#include "core/config/Config.h"
|
||||||
#include "core/Controller.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +46,12 @@
|
|||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
static_assert(
|
||||||
|
RAPIDJSON_WRITE_DEFAULT_FLAGS == (rapidjson::kWriteNanAndInfFlag | rapidjson::kWriteNanAndInfNullFlag),
|
||||||
|
"(rapidjson::kWriteNanAndInfFlag | rapidjson::kWriteNanAndInfNullFlag) required"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
static rapidjson::Value getResources(rapidjson::Document &doc)
|
static rapidjson::Value getResources(rapidjson::Document &doc)
|
||||||
{
|
{
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* XMRig
|
/* XMRig
|
||||||
* Copyright (c) 2014-2019 heapwolf <https://github.com/heapwolf>
|
* Copyright (c) 2014-2019 heapwolf <https://github.com/heapwolf>
|
||||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
* Copyright (c) 2018-2025 SChernykh <https://github.com/SChernykh>
|
||||||
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
* Copyright (c) 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "base/net/http/HttpData.h"
|
#include "base/net/http/HttpData.h"
|
||||||
#include "3rdparty/llhttp/llhttp.h"
|
#include "3rdparty/llhttp/llhttp.h"
|
||||||
#include "3rdparty/rapidjson/document.h"
|
#include "3rdparty/rapidjson/document.h"
|
||||||
@@ -29,76 +28,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
||||||
/* Status Codes */
|
|
||||||
#define HTTP_STATUS_MAP(XX) \
|
|
||||||
XX(100, CONTINUE, Continue) \
|
|
||||||
XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \
|
|
||||||
XX(102, PROCESSING, Processing) \
|
|
||||||
XX(200, OK, OK) \
|
|
||||||
XX(201, CREATED, Created) \
|
|
||||||
XX(202, ACCEPTED, Accepted) \
|
|
||||||
XX(203, NON_AUTHORITATIVE_INFORMATION, Non-Authoritative Information) \
|
|
||||||
XX(204, NO_CONTENT, No Content) \
|
|
||||||
XX(205, RESET_CONTENT, Reset Content) \
|
|
||||||
XX(206, PARTIAL_CONTENT, Partial Content) \
|
|
||||||
XX(207, MULTI_STATUS, Multi-Status) \
|
|
||||||
XX(208, ALREADY_REPORTED, Already Reported) \
|
|
||||||
XX(226, IM_USED, IM Used) \
|
|
||||||
XX(300, MULTIPLE_CHOICES, Multiple Choices) \
|
|
||||||
XX(301, MOVED_PERMANENTLY, Moved Permanently) \
|
|
||||||
XX(302, FOUND, Found) \
|
|
||||||
XX(303, SEE_OTHER, See Other) \
|
|
||||||
XX(304, NOT_MODIFIED, Not Modified) \
|
|
||||||
XX(305, USE_PROXY, Use Proxy) \
|
|
||||||
XX(307, TEMPORARY_REDIRECT, Temporary Redirect) \
|
|
||||||
XX(308, PERMANENT_REDIRECT, Permanent Redirect) \
|
|
||||||
XX(400, BAD_REQUEST, Bad Request) \
|
|
||||||
XX(401, UNAUTHORIZED, Unauthorized) \
|
|
||||||
XX(402, PAYMENT_REQUIRED, Payment Required) \
|
|
||||||
XX(403, FORBIDDEN, Forbidden) \
|
|
||||||
XX(404, NOT_FOUND, Not Found) \
|
|
||||||
XX(405, METHOD_NOT_ALLOWED, Method Not Allowed) \
|
|
||||||
XX(406, NOT_ACCEPTABLE, Not Acceptable) \
|
|
||||||
XX(407, PROXY_AUTHENTICATION_REQUIRED, Proxy Authentication Required) \
|
|
||||||
XX(408, REQUEST_TIMEOUT, Request Timeout) \
|
|
||||||
XX(409, CONFLICT, Conflict) \
|
|
||||||
XX(410, GONE, Gone) \
|
|
||||||
XX(411, LENGTH_REQUIRED, Length Required) \
|
|
||||||
XX(412, PRECONDITION_FAILED, Precondition Failed) \
|
|
||||||
XX(413, PAYLOAD_TOO_LARGE, Payload Too Large) \
|
|
||||||
XX(414, URI_TOO_LONG, URI Too Long) \
|
|
||||||
XX(415, UNSUPPORTED_MEDIA_TYPE, Unsupported Media Type) \
|
|
||||||
XX(416, RANGE_NOT_SATISFIABLE, Range Not Satisfiable) \
|
|
||||||
XX(417, EXPECTATION_FAILED, Expectation Failed) \
|
|
||||||
XX(421, MISDIRECTED_REQUEST, Misdirected Request) \
|
|
||||||
XX(422, UNPROCESSABLE_ENTITY, Unprocessable Entity) \
|
|
||||||
XX(423, LOCKED, Locked) \
|
|
||||||
XX(424, FAILED_DEPENDENCY, Failed Dependency) \
|
|
||||||
XX(426, UPGRADE_REQUIRED, Upgrade Required) \
|
|
||||||
XX(428, PRECONDITION_REQUIRED, Precondition Required) \
|
|
||||||
XX(429, TOO_MANY_REQUESTS, Too Many Requests) \
|
|
||||||
XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, Request Header Fields Too Large) \
|
|
||||||
XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, Unavailable For Legal Reasons) \
|
|
||||||
XX(500, INTERNAL_SERVER_ERROR, Internal Server Error) \
|
|
||||||
XX(501, NOT_IMPLEMENTED, Not Implemented) \
|
|
||||||
XX(502, BAD_GATEWAY, Bad Gateway) \
|
|
||||||
XX(503, SERVICE_UNAVAILABLE, Service Unavailable) \
|
|
||||||
XX(504, GATEWAY_TIMEOUT, Gateway Timeout) \
|
|
||||||
XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP Version Not Supported) \
|
|
||||||
XX(506, VARIANT_ALSO_NEGOTIATES, Variant Also Negotiates) \
|
|
||||||
XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \
|
|
||||||
XX(508, LOOP_DETECTED, Loop Detected) \
|
|
||||||
XX(510, NOT_EXTENDED, Not Extended) \
|
|
||||||
XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) \
|
|
||||||
|
|
||||||
enum http_status
|
|
||||||
{
|
|
||||||
# define XX(num, name, string) HTTP_STATUS_##name = num,
|
|
||||||
HTTP_STATUS_MAP(XX)
|
|
||||||
# undef XX
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
@@ -108,17 +37,6 @@ const std::string HttpData::kContentTypeL = "content-type";
|
|||||||
const std::string HttpData::kTextPlain = "text/plain";
|
const std::string HttpData::kTextPlain = "text/plain";
|
||||||
|
|
||||||
|
|
||||||
static const char *http_status_str(enum http_status s)
|
|
||||||
{
|
|
||||||
switch (s) {
|
|
||||||
# define XX(num, name, string) case HTTP_STATUS_##name: return #string;
|
|
||||||
HTTP_STATUS_MAP(XX)
|
|
||||||
# undef XX
|
|
||||||
default: return "<unknown>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace xmrig
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
@@ -173,5 +91,5 @@ const char *xmrig::HttpData::statusName(int status)
|
|||||||
return uv_strerror(status);
|
return uv_strerror(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return http_status_str(static_cast<http_status>(status));
|
return llhttp_status_name(static_cast<llhttp_status>(status));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(GhostRider)
|
project(GhostRider)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#define APP_ID "xmrig"
|
#define APP_ID "xmrig"
|
||||||
#define APP_NAME "XMRig"
|
#define APP_NAME "XMRig"
|
||||||
#define APP_DESC "XMRig miner"
|
#define APP_DESC "XMRig miner"
|
||||||
#define APP_VERSION "6.22.3"
|
#define APP_VERSION "6.22.4-dev"
|
||||||
#define APP_DOMAIN "xmrig.com"
|
#define APP_DOMAIN "xmrig.com"
|
||||||
#define APP_SITE "www.xmrig.com"
|
#define APP_SITE "www.xmrig.com"
|
||||||
#define APP_COPYRIGHT "Copyright (C) 2016-2025 xmrig.com"
|
#define APP_COPYRIGHT "Copyright (C) 2016-2025 xmrig.com"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#define APP_VER_MAJOR 6
|
#define APP_VER_MAJOR 6
|
||||||
#define APP_VER_MINOR 22
|
#define APP_VER_MINOR 22
|
||||||
#define APP_VER_PATCH 3
|
#define APP_VER_PATCH 4
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# if (_MSC_VER >= 1930)
|
# if (_MSC_VER >= 1930)
|
||||||
|
|||||||
Reference in New Issue
Block a user