Code format
This commit is contained in:
parent
cddaedaff8
commit
f1dec77f46
11
httplib.h
11
httplib.h
@ -141,11 +141,11 @@ using ssize_t = long;
|
|||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
#ifndef S_ISREG
|
#ifndef S_ISREG
|
||||||
#define S_ISREG(m) (((m)&S_IFREG) == S_IFREG)
|
#define S_ISREG(m) (((m) & S_IFREG) == S_IFREG)
|
||||||
#endif // S_ISREG
|
#endif // S_ISREG
|
||||||
|
|
||||||
#ifndef S_ISDIR
|
#ifndef S_ISDIR
|
||||||
#define S_ISDIR(m) (((m)&S_IFDIR) == S_IFDIR)
|
#define S_ISDIR(m) (((m) & S_IFDIR) == S_IFDIR)
|
||||||
#endif // S_ISDIR
|
#endif // S_ISDIR
|
||||||
|
|
||||||
#ifndef NOMINMAX
|
#ifndef NOMINMAX
|
||||||
@ -1989,12 +1989,11 @@ void read_file(const std::string &path, std::string &out);
|
|||||||
std::string trim_copy(const std::string &s);
|
std::string trim_copy(const std::string &s);
|
||||||
|
|
||||||
void split(const char *b, const char *e, char d,
|
void split(const char *b, const char *e, char d,
|
||||||
std::function<void(const char *, const char *)> fn);
|
std::function<void(const char *, const char *)> fn);
|
||||||
|
|
||||||
void split(const char *b, const char *e, char d, size_t m,
|
void split(const char *b, const char *e, char d, size_t m,
|
||||||
std::function<void(const char *, const char *)> fn);
|
std::function<void(const char *, const char *)> fn);
|
||||||
|
|
||||||
|
|
||||||
bool process_client_socket(socket_t sock, time_t read_timeout_sec,
|
bool process_client_socket(socket_t sock, time_t read_timeout_sec,
|
||||||
time_t read_timeout_usec, time_t write_timeout_sec,
|
time_t read_timeout_usec, time_t write_timeout_sec,
|
||||||
time_t write_timeout_usec,
|
time_t write_timeout_usec,
|
||||||
@ -5824,8 +5823,8 @@ inline bool Server::parse_request_line(const char *s, Request &req) const {
|
|||||||
|
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
||||||
detail::split(req.target.data(), req.target.data() + req.target.size(), '?', 2,
|
detail::split(req.target.data(), req.target.data() + req.target.size(), '?',
|
||||||
[&](const char *b, const char *e) {
|
2, [&](const char *b, const char *e) {
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 0:
|
case 0:
|
||||||
req.path = detail::decode_url(std::string(b, e), false);
|
req.path = detail::decode_url(std::string(b, e), false);
|
||||||
|
@ -1848,9 +1848,9 @@ protected:
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.Get("/regex-with-delimiter",
|
.Get("/regex-with-delimiter",
|
||||||
[&](const Request & req, Response &res) {
|
[&](const Request &req, Response & /*res*/) {
|
||||||
ASSERT_TRUE(req.has_param("key"));
|
ASSERT_TRUE(req.has_param("key"));
|
||||||
EXPECT_EQ("^(?.*(value))", req.get_param_value("key"));
|
EXPECT_EQ("^(?.*(value))", req.get_param_value("key"));
|
||||||
})
|
})
|
||||||
.Get("/with-range",
|
.Get("/with-range",
|
||||||
[&](const Request & /*req*/, Response &res) {
|
[&](const Request & /*req*/, Response &res) {
|
||||||
@ -3357,14 +3357,12 @@ TEST_F(ServerTest, GetStreamedChunkedWithGzip2) {
|
|||||||
EXPECT_EQ(std::string("123456789"), res->body);
|
EXPECT_EQ(std::string("123456789"), res->body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_F(ServerTest, SplitDelimiterInPathRegex) {
|
TEST_F(ServerTest, SplitDelimiterInPathRegex) {
|
||||||
auto res = cli_.Get("/regex-with-delimiter?key=^(?.*(value))");
|
auto res = cli_.Get("/regex-with-delimiter?key=^(?.*(value))");
|
||||||
ASSERT_TRUE(res);
|
ASSERT_TRUE(res);
|
||||||
EXPECT_EQ(200, res->status);
|
EXPECT_EQ(200, res->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(GzipDecompressor, ChunkedDecompression) {
|
TEST(GzipDecompressor, ChunkedDecompression) {
|
||||||
std::string data;
|
std::string data;
|
||||||
for (size_t i = 0; i < 32 * 1024; ++i) {
|
for (size_t i = 0; i < 32 * 1024; ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user