Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: net/server/http_server_response_info.h

Issue 497223003: Revert of Replace StreamListenSocket with StreamSocket in HttpServer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/server/http_server.cc ('k') | net/server/http_server_response_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_ 5 #ifndef NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
6 #define NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_ 6 #define NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "net/http/http_status_code.h" 12 #include "net/http/http_status_code.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 class HttpServerResponseInfo { 16 class HttpServerResponseInfo {
17 public: 17 public:
18 // Creates a 200 OK HttpServerResponseInfo. 18 // Creates a 200 OK HttpServerResponseInfo.
19 HttpServerResponseInfo(); 19 HttpServerResponseInfo();
20 explicit HttpServerResponseInfo(HttpStatusCode status_code); 20 explicit HttpServerResponseInfo(HttpStatusCode status_code);
21 ~HttpServerResponseInfo(); 21 ~HttpServerResponseInfo();
22 22
23 static HttpServerResponseInfo CreateFor404(); 23 static HttpServerResponseInfo CreateFor404();
24 static HttpServerResponseInfo CreateFor500(const std::string& body); 24 static HttpServerResponseInfo CreateFor500(const std::string& body);
25 25
26 void AddHeader(const std::string& name, const std::string& value); 26 void AddHeader(const std::string& name, const std::string& value);
27 27
28 // This also adds an appropriate Content-Length header. 28 // This also adds an appropriate Content-Length header.
29 void SetBody(const std::string& body, const std::string& content_type); 29 void SetBody(const std::string& body, const std::string& content_type);
30 // Sets content-length and content-type. Body should be sent separately.
31 void SetContentHeaders(size_t content_length,
32 const std::string& content_type);
33 30
34 std::string Serialize() const; 31 std::string Serialize() const;
35 32
36 HttpStatusCode status_code() const; 33 HttpStatusCode status_code() const;
37 const std::string& body() const; 34 const std::string& body() const;
38 35
39 private: 36 private:
40 typedef std::vector<std::pair<std::string, std::string> > Headers; 37 typedef std::vector<std::pair<std::string, std::string> > Headers;
41 38
42 HttpStatusCode status_code_; 39 HttpStatusCode status_code_;
43 Headers headers_; 40 Headers headers_;
44 std::string body_; 41 std::string body_;
45 }; 42 };
46 43
47 } // namespace net 44 } // namespace net
48 45
49 #endif // NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_ 46 #endif // NET_SERVER_HTTP_SERVER_RESPONSE_INFO_H_
OLDNEW
« no previous file with comments | « net/server/http_server.cc ('k') | net/server/http_server_response_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698