Chromium Code Reviews| Index: net/test/embedded_test_server/http_response.h |
| diff --git a/net/test/embedded_test_server/http_response.h b/net/test/embedded_test_server/http_response.h |
| index b597ccebc13639d4b16a3bd0578732212550f4c2..00bb7fa0e0786742b7b5908a48eaf3aceec7e3c1 100644 |
| --- a/net/test/embedded_test_server/http_response.h |
| +++ b/net/test/embedded_test_server/http_response.h |
| @@ -9,6 +9,7 @@ |
| #include <string> |
| #include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| namespace net { |
| namespace test_server { |
| @@ -24,9 +25,20 @@ enum ResponseCode { |
| ACCESS_DENIED = 500, |
| }; |
| -// Respresents a HTTP response. Since it can be big, it may be better to use |
| -// scoped_ptr to pass it instead of copying. |
| -class HttpResponse { |
| +// Interface for HTTP response implementations. |
| +class HttpResponseInterface { |
| + public: |
| + virtual ~HttpResponseInterface(); |
| + |
| + // Returns raw contents to be written to the network socket |
| + // in response. If you intend to make this a valid HTTP response, |
| + // it should start with "HTTP/x.x" line, followed by response headers. |
| + virtual std::string ToResponseString() const = 0; |
| +}; |
| + |
| +// This class is used to handle basic HTTP responses with commonly used |
| +// response headers such as "Content-Type". |
| +class HttpResponse : public HttpResponseInterface { |
|
satorux1
2013/05/22 01:54:56
I suggested this name, but I changed my mind (sorr
Paweł Hajdan Jr.
2013/05/22 21:01:38
Done.
|
| public: |
| HttpResponse(); |
| ~HttpResponse(); |
| @@ -56,13 +68,15 @@ class HttpResponse { |
| } |
| // Generates and returns a http response string. |
| - std::string ToResponseString() const; |
| + virtual std::string ToResponseString() const OVERRIDE; |
| private: |
| ResponseCode code_; |
| std::string content_; |
| std::string content_type_; |
| std::map<std::string, std::string> custom_headers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(HttpResponse); |
| }; |
| } // namespace test_server |