28 #ifndef HTTP_PARSER_IMPL_HPP 29 #define HTTP_PARSER_IMPL_HPP 41 inline void parser::set_version(std::string
const &
version) {
46 header_list::const_iterator h =
m_headers.find(key);
58 header_list::const_iterator it =
m_headers.find(key);
60 if (it ==
m_headers.end() || it->second.size() == 0) {
92 if (value.size() == 0) {
101 std::stringstream len;
110 if (in.size() == 0) {
114 std::string::const_iterator it;
116 return (it == in.begin());
121 std::string
const & cl_header =
get_header(
"Content-Length");
130 throw exception(
"HTTP message body too large",
136 }
else if (
get_header(
"Transfer-Encoding") ==
"chunked") {
148 m_body.append(buf,processed);
153 throw exception(
"Unexpected body encoding",
156 throw exception(
"Unexpected body encoding",
180 std::stringstream raw;
182 header_list::const_iterator it;
184 raw << it->first <<
": " << it->second <<
"\r\n";
196 #endif // HTTP_PARSER_IMPL_HPP bool get_header_as_plist(std::string const &key, parameter_list &out) const
Extract an HTTP parameter list from a parser header.
static std::string const empty_header
Literal value of an empty header.
void set_body(std::string const &value)
Set body content.
bool parse_parameter_list(std::string const &in, parameter_list &out) const
Extract an HTTP parameter list from a string.
std::vector< std::pair< std::string, attribute_list > > parameter_list
The type of an HTTP parameter list.
size_t m_body_bytes_needed
size_t process_body(char const *buf, size_t len)
Process body data.
bool is_not_token_char(unsigned char c)
Is the character a non-token.
bool prepare_body()
Prepare the parser to begin parsing body data.
void process_header(std::string::iterator begin, std::string::iterator end)
Process a header line.
Table::const_iterator iterator
std::string const & get_header(std::string const &key) const
Get the value of an HTTP header.
static char const header_separator[]
Literal value of the HTTP header separator.
InputIterator extract_parameters(InputIterator begin, InputIterator end, parameter_list ¶meters)
Extract HTTP parameters.
Namespace for the WebSocket++ project.
void append_header(std::string const &key, std::string const &val)
Append a value to an existing HTTP header.
std::string strip_lws(std::string const &input)
void replace_header(std::string const &key, std::string const &val)
Set a value for an HTTP header, replacing an existing value.
std::string raw_headers() const
Generate and return the HTTP headers as a string.
body_encoding::value m_body_encoding
void remove_header(std::string const &key)
Remove a header from the parser.