mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
code formatting (also disabled formatting where not applicable)
This commit is contained in:
parent
15908e5498
commit
175b004c26
@ -283,6 +283,7 @@ namespace crow
|
||||
}
|
||||
} // namespace crow
|
||||
|
||||
// clang-format off
|
||||
#ifndef CROW_MSVC_WORKAROUND
|
||||
constexpr crow::HTTPMethod operator"" _method(const char* str, size_t /*len*/)
|
||||
{
|
||||
@ -330,3 +331,4 @@ constexpr crow::HTTPMethod operator"" _method(const char* str, size_t /*len*/)
|
||||
throw std::runtime_error("invalid http method");
|
||||
}
|
||||
#endif
|
||||
// clang-format on
|
||||
|
@ -277,8 +277,8 @@ namespace crow
|
||||
{
|
||||
if (req.get_header_value("upgrade") == "h2")
|
||||
{
|
||||
// TODO(ipkn): HTTP/2
|
||||
// currently, ignore upgrade header
|
||||
// TODO(ipkn): HTTP/2
|
||||
// currently, ignore upgrade header
|
||||
}
|
||||
}
|
||||
else if (req.get_header_value("upgrade") == "h2c")
|
||||
|
@ -11,6 +11,7 @@
|
||||
* 350258965909f249f9c59823aac240313e0d0120 (cannot be implemented due to upgrade)
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "crow/common.h"
|
||||
namespace crow
|
||||
@ -2013,3 +2014,5 @@ http_parser_set_max_header_size(uint32_t size) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
@ -32,7 +32,7 @@ namespace crow
|
||||
#ifdef CROW_ENABLE_COMPRESSION
|
||||
bool compressed = true; ///< If compression is enabled and this is false, the individual response will not be compressed.
|
||||
#endif
|
||||
bool skip_body = false; ///< Whether this is a response to a HEAD request.
|
||||
bool skip_body = false; ///< Whether this is a response to a HEAD request.
|
||||
bool manual_length_header = false; ///< Whether Crow should automatically add a "Content-Length" header.
|
||||
|
||||
/// Set the value of an existing header in the response.
|
||||
|
@ -1051,9 +1051,9 @@ namespace crow
|
||||
break;
|
||||
default:
|
||||
if (CROW_LIKELY(state == NumberParsingState::ZeroFirst ||
|
||||
state == NumberParsingState::Digits ||
|
||||
state == NumberParsingState::DigitsAfterPoints ||
|
||||
state == NumberParsingState::DigitsAfterE))
|
||||
state == NumberParsingState::Digits ||
|
||||
state == NumberParsingState::DigitsAfterPoints ||
|
||||
state == NumberParsingState::DigitsAfterE))
|
||||
return {type::Number, start, data};
|
||||
else
|
||||
return {};
|
||||
|
@ -96,10 +96,10 @@ namespace crow
|
||||
size_t found = header.find("boundary=");
|
||||
if (found)
|
||||
{
|
||||
std::string to_return (header.substr(found + 9));
|
||||
std::string to_return(header.substr(found + 9));
|
||||
if (to_return[0] == '\"')
|
||||
{
|
||||
to_return = to_return.substr(1, to_return.length()-2);
|
||||
to_return = to_return.substr(1, to_return.length() - 2);
|
||||
}
|
||||
return to_return;
|
||||
}
|
||||
|
@ -697,7 +697,6 @@ namespace crow
|
||||
checkForSpecialEntries = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace utility
|
||||
|
@ -1141,12 +1141,14 @@ TEST_CASE("template_basic")
|
||||
|
||||
TEST_CASE("template_function")
|
||||
{
|
||||
auto t = crow::mustache::compile("attack of {{func}}");
|
||||
crow::mustache::context ctx;
|
||||
ctx["name"] = "killer tomatoes";
|
||||
ctx["func"] = [&](std::string){return std::string("{{name}}, IN SPACE!");};
|
||||
auto result = t.render(ctx);
|
||||
CHECK("attack of killer tomatoes, IN SPACE!" == result);
|
||||
auto t = crow::mustache::compile("attack of {{func}}");
|
||||
crow::mustache::context ctx;
|
||||
ctx["name"] = "killer tomatoes";
|
||||
ctx["func"] = [&](std::string) {
|
||||
return std::string("{{name}}, IN SPACE!");
|
||||
};
|
||||
auto result = t.render(ctx);
|
||||
CHECK("attack of killer tomatoes, IN SPACE!" == result);
|
||||
}
|
||||
|
||||
TEST_CASE("template_load")
|
||||
@ -2135,14 +2137,14 @@ TEST_CASE("zlib_compression")
|
||||
std::string response_deflate;
|
||||
std::string response_gzip;
|
||||
|
||||
for (unsigned i{0}; i<2048; i++)
|
||||
for (unsigned i{0}; i < 2048; i++)
|
||||
{
|
||||
if (buf_deflate[i] == 0)
|
||||
{
|
||||
bool end = true;
|
||||
for(unsigned j=i;j<2048;j++)
|
||||
for (unsigned j = i; j < 2048; j++)
|
||||
{
|
||||
if (buf_deflate[j]!=0)
|
||||
if (buf_deflate[j] != 0)
|
||||
{
|
||||
end = false;
|
||||
break;
|
||||
@ -2158,14 +2160,14 @@ TEST_CASE("zlib_compression")
|
||||
response_deflate.push_back(buf_deflate[i]);
|
||||
}
|
||||
|
||||
for (unsigned i{0}; i<2048; i++)
|
||||
for (unsigned i{0}; i < 2048; i++)
|
||||
{
|
||||
if (buf_gzip[i] == 0)
|
||||
{
|
||||
bool end = true;
|
||||
for(unsigned j=i;j<2048;j++)
|
||||
for (unsigned j = i; j < 2048; j++)
|
||||
{
|
||||
if (buf_gzip[j]!=0)
|
||||
if (buf_gzip[j] != 0)
|
||||
{
|
||||
end = false;
|
||||
break;
|
||||
@ -2181,8 +2183,8 @@ TEST_CASE("zlib_compression")
|
||||
response_gzip.push_back(buf_gzip[i]);
|
||||
}
|
||||
|
||||
response_deflate = inflate_string(response_deflate.substr(response_deflate.find("\r\n\r\n")+4));
|
||||
response_gzip = inflate_string(response_gzip.substr(response_gzip.find("\r\n\r\n")+4));
|
||||
response_deflate = inflate_string(response_deflate.substr(response_deflate.find("\r\n\r\n") + 4));
|
||||
response_gzip = inflate_string(response_gzip.substr(response_gzip.find("\r\n\r\n") + 4));
|
||||
|
||||
socket[0].close();
|
||||
socket[1].close();
|
||||
|
Loading…
Reference in New Issue
Block a user