From 26a55acc6c05e0525826da210083ed5cb6533625 Mon Sep 17 00:00:00 2001 From: Ronald Landheer-Cieslak Date: Thu, 12 Mar 2009 17:01:41 -0400 Subject: [PATCH] add Request::getHeaderValue --- lib/Spin/Details/Request.cpp | 26 ++++++++++++++++++++++++++ lib/Spin/Details/Request.h | 5 ++++- project/msvc8/Spin/Spin.vcproj | 4 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 lib/Spin/Details/Request.cpp diff --git a/lib/Spin/Details/Request.cpp b/lib/Spin/Details/Request.cpp new file mode 100644 index 0000000..8fdafbe --- /dev/null +++ b/lib/Spin/Details/Request.cpp @@ -0,0 +1,26 @@ +#include "Request.h" + +namespace Spin +{ + namespace Details + { + std::string Request::getHeaderValue(const std::string & header_name) const + { + std::string retval; + bool found_one(false); + + for (HeaderFields::const_iterator curr(header_fields_.begin()); curr != header_fields_.end(); ++curr) + { + if (curr->name_ == header_name) + { + retval += (found_one ? "," : "") + curr->value_; + } + else + { /* no-op */ } + } + + return retval; + } + } +} + diff --git a/lib/Spin/Details/Request.h b/lib/Spin/Details/Request.h index 2e84d35..945b22c 100644 --- a/lib/Spin/Details/Request.h +++ b/lib/Spin/Details/Request.h @@ -1,6 +1,7 @@ #ifndef _spin_details_request_h #define _spin_details_request_h +#include "prologue.h" #include #include #include @@ -13,7 +14,7 @@ namespace Spin namespace Details { //! An HTTP request. - struct Request + struct SPIN_API Request { /** Construct a new request with a connection. * \param connection the connection to use to respond to the request @@ -27,6 +28,8 @@ namespace Spin protocol_and_version_(protocol_and_version) { /* no-op */ } + std::string getHeaderValue(const std::string & header_name) const; + boost::weak_ptr< Connection > connection_; ///< the connection to use to respond to the request std::string method_; ///< the method of the request, as supplied by the client std::string url_; ///< the location of the resource requested diff --git a/project/msvc8/Spin/Spin.vcproj b/project/msvc8/Spin/Spin.vcproj index 08ac4c4..1ec1777 100644 --- a/project/msvc8/Spin/Spin.vcproj +++ b/project/msvc8/Spin/Spin.vcproj @@ -239,6 +239,10 @@ > + + -- 2.11.4.GIT