From c73e6ba3e27d3401fb7b7a0ae69ba158f9299348 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Thu, 11 Jul 2013 18:36:40 +0200 Subject: [PATCH 1/2] Conventional capitalization when writing headers, leniency when reading. --- Subtrees/websocket/src/http/parser.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Subtrees/websocket/src/http/parser.hpp b/Subtrees/websocket/src/http/parser.hpp index 2a4918b60a..72fb0a65de 100644 --- a/Subtrees/websocket/src/http/parser.hpp +++ b/Subtrees/websocket/src/http/parser.hpp @@ -83,7 +83,12 @@ public: } std::string header(const std::string& key) const { - header_list::const_iterator h = m_headers.find(tolower(key)); + header_list::const_iterator h = m_headers.find(key); + if (h != m_headers.end()) { + return h->second; + } + + h = m_headers.find(tolower(key)); if (h == m_headers.end()) { return ""; @@ -97,18 +102,18 @@ public: void add_header(const std::string &key, const std::string &val) { // TODO: prevent use of reserved headers? if (this->header(key) == "") { - m_headers[tolower(key)] = val; + m_headers[key] = val; } else { - m_headers[tolower(key)] += ", " + val; + m_headers[key] += ", " + val; } } void replace_header(const std::string &key, const std::string &val) { - m_headers[tolower(key)] = val; + m_headers[key] = val; } void remove_header(const std::string &key) { - m_headers.erase(tolower(key)); + m_headers.erase(key); } protected: bool parse_headers(std::istream& s) { From 2f320ccb8b9fd648e929ef5a023e08ed48a9df3d Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Thu, 11 Jul 2013 20:45:26 +0200 Subject: [PATCH 2/2] License update. --- LICENSE | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index e0429f8b28..98798675e5 100644 --- a/LICENSE +++ b/LICENSE @@ -11,7 +11,9 @@ Copyright (c) 2011-2012 Jed McCaleb Some code: Copyright (c) 2013 Vinnie Falco Copyright (c) 2013 Bob Way - Contributions from Vinnie Falco and Bob Way provided under the terms of the ISC License: +Copyright (c) 2013 Eric Lombrozo + Contributions from Vinnie Falco, Bob Way, and Eric Lombrozo + provided under the terms of the ISC License: Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.