Fix CI. Http parsing optimisation.
This commit is contained in:
parent
5b2b92835e
commit
4624155351
@ -13,17 +13,11 @@
|
|||||||
#include "Socket.h"
|
#include "Socket.h"
|
||||||
#include "Sendable.h"
|
#include "Sendable.h"
|
||||||
|
|
||||||
#ifdef ENABLE_TESTING
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace fr
|
namespace fr
|
||||||
{
|
{
|
||||||
class Http : public Sendable
|
class Http : public Sendable
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_TESTING
|
friend class HttpTest_test_string_split_Test;
|
||||||
FRIEND_TEST(HttpTest, test_string_split);
|
|
||||||
#endif
|
|
||||||
public:
|
public:
|
||||||
enum class RequestVersion
|
enum class RequestVersion
|
||||||
{
|
{
|
||||||
|
|||||||
@ -121,7 +121,7 @@ namespace fr
|
|||||||
private:
|
private:
|
||||||
mutable std::string payload;
|
mutable std::string payload;
|
||||||
Opcode opcode;
|
Opcode opcode;
|
||||||
bool final;
|
uint8_t final;
|
||||||
static uint32_t current_mask_key;
|
static uint32_t current_mask_key;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace fr
|
|||||||
|
|
||||||
fr::Socket::Status HttpRequest::parse(const char *request, size_t requestsz)
|
fr::Socket::Status HttpRequest::parse(const char *request, size_t requestsz)
|
||||||
{
|
{
|
||||||
body += std::string(request, requestsz);
|
body.append(request, requestsz);
|
||||||
|
|
||||||
//Ensure that the whole header has been parsed first
|
//Ensure that the whole header has been parsed first
|
||||||
if(!header_ended)
|
if(!header_ended)
|
||||||
@ -182,8 +182,7 @@ namespace fr
|
|||||||
auto post = parse_argument_list(body.substr(post_begin, body.size() - post_begin - (body.size() - post_end)));
|
auto post = parse_argument_list(body.substr(post_begin, body.size() - post_begin - (body.size() - post_end)));
|
||||||
for(auto &c : post)
|
for(auto &c : post)
|
||||||
{
|
{
|
||||||
std::transform(c.first.begin(), c.first.end(), c.first.begin(), ::tolower);
|
this->post(std::move(c.first)) = std::move(c.second);
|
||||||
post_data.emplace(std::move(c.first), std::move(c.second));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace fr
|
|||||||
{
|
{
|
||||||
fr::Socket::Status HttpResponse::parse(const char *response_data, size_t datasz)
|
fr::Socket::Status HttpResponse::parse(const char *response_data, size_t datasz)
|
||||||
{
|
{
|
||||||
body += std::string(response_data, datasz);
|
body.append(response_data, datasz);
|
||||||
|
|
||||||
//Ensure that the whole header has been parsed first
|
//Ensure that the whole header has been parsed first
|
||||||
if(!header_ended)
|
if(!header_ended)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user