Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion service/http_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

#pragma once

#include <strings.h>

#include <boost/algorithm/string.hpp>

#include <string>
#include <map>
#include <iostream>
Expand Down Expand Up @@ -72,8 +76,17 @@ struct HttpHeader {
ssize_t contentLength;
bool isChunked;

struct NoCaseEqual {
typedef const std::string & String;
bool operator() (String first, String second) const {
return !strcasecmp(first.c_str(), second.c_str());
}
};

typedef std::map<std::string, std::string, NoCaseEqual> HeaderMap;

// The rest of the headers are here
std::map<std::string, std::string> headers;
HeaderMap headers;

std::string getHeader(const std::string & key) const
{
Expand Down