aboutsummaryrefslogtreecommitdiffstats
path: root/apps/http-proxy/src/HTTP1.xMessageFastParser.cc
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-02-19 15:49:25 +0100
committerMauro Sardara <msardara@cisco.com>2020-02-19 15:55:58 +0100
commit24acbd12881e2cbf3dd209afc384b1ab4cc3faf8 (patch)
tree85e84d242f71c9b527839f116c00c72e0b9ce837 /apps/http-proxy/src/HTTP1.xMessageFastParser.cc
parent0710f1ff754ebf01ae5befabb055349fe472b0c2 (diff)
[HICN-530] Add support for chunked Transfer-Encoding in higet and http-proxy
Change-Id: Ibf954e5e886412a934542a10d94d89bb8a55a676 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'apps/http-proxy/src/HTTP1.xMessageFastParser.cc')
-rw-r--r--apps/http-proxy/src/HTTP1.xMessageFastParser.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/http-proxy/src/HTTP1.xMessageFastParser.cc b/apps/http-proxy/src/HTTP1.xMessageFastParser.cc
index a03871649..729eb3aeb 100644
--- a/apps/http-proxy/src/HTTP1.xMessageFastParser.cc
+++ b/apps/http-proxy/src/HTTP1.xMessageFastParser.cc
@@ -15,17 +15,36 @@
#include "HTTP1.xMessageFastParser.h"
+#include <hicn/transport/http/response.h>
+
#include <experimental/algorithm>
#include <experimental/functional>
#include <iostream>
std::string HTTPMessageFastParser::numbers = "0123456789";
std::string HTTPMessageFastParser::content_length = "Content-Length";
+std::string HTTPMessageFastParser::transfer_encoding = "Transfer-Encoding";
+std::string HTTPMessageFastParser::chunked = "chunked";
std::string HTTPMessageFastParser::cache_control = "Cache-Control";
std::string HTTPMessageFastParser::mpd = "mpd";
std::string HTTPMessageFastParser::connection = "Connection";
std::string HTTPMessageFastParser::separator = "\r\n\r\n";
+HTTPHeaders HTTPMessageFastParser::getHeaders(const uint8_t *headers,
+ std::size_t length) {
+ HTTPHeaders ret;
+ std::string http_version;
+ std::string status_code;
+ std::string status_string;
+
+ if (transport::http::HTTPResponse::parseHeaders(headers, length, ret, http_version,
+ status_code, status_string)) {
+ return ret;
+ }
+
+ throw std::runtime_error("Error parsing response headers.");
+}
+
std::size_t HTTPMessageFastParser::hasBody(const uint8_t *headers,
std::size_t length) {
const char *buffer = reinterpret_cast<const char *>(headers);