OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_HTTP_HTTP_RESPONSE_HEADERS_H_ | 5 #ifndef NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Removes all instances of a particular header. | 64 // Removes all instances of a particular header. |
65 void RemoveHeader(const std::string& name); | 65 void RemoveHeader(const std::string& name); |
66 | 66 |
67 // Adds a particular header. |header| has to be a single header without any | 67 // Adds a particular header. |header| has to be a single header without any |
68 // EOL termination, just [<header-name>: <header-values>] | 68 // EOL termination, just [<header-name>: <header-values>] |
69 // If a header with the same name is already stored, the two headers are not | 69 // If a header with the same name is already stored, the two headers are not |
70 // merged together by this method; the one provided is simply put at the | 70 // merged together by this method; the one provided is simply put at the |
71 // end of the list. | 71 // end of the list. |
72 void AddHeader(const std::string& header); | 72 void AddHeader(const std::string& header); |
73 | 73 |
| 74 // Replaces the current status line with the provided one (|new_status| should |
| 75 // not have any EOL). |
| 76 void ReplaceStatusLine(const std::string& new_status); |
| 77 |
74 // Creates a normalized header string. The output will be formatted exactly | 78 // Creates a normalized header string. The output will be formatted exactly |
75 // like so: | 79 // like so: |
76 // HTTP/<version> <status_code> <status_text>\n | 80 // HTTP/<version> <status_code> <status_text>\n |
77 // [<header-name>: <header-values>\n]* | 81 // [<header-name>: <header-values>\n]* |
78 // meaning, each line is \n-terminated, and there is no extra whitespace | 82 // meaning, each line is \n-terminated, and there is no extra whitespace |
79 // beyond the single space separators shown (of course, values can contain | 83 // beyond the single space separators shown (of course, values can contain |
80 // whitespace within them). If a given header-name appears more than once | 84 // whitespace within them). If a given header-name appears more than once |
81 // in the set of headers, they are combined into a single line like so: | 85 // in the set of headers, they are combined into a single line like so: |
82 // <header-name>: <header-value1>, <header-value2>, ...<header-valueN>\n | 86 // <header-name>: <header-value1>, <header-value2>, ...<header-valueN>\n |
83 // | 87 // |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 334 |
331 // The parsed http version number (not normalized). | 335 // The parsed http version number (not normalized). |
332 HttpVersion parsed_http_version_; | 336 HttpVersion parsed_http_version_; |
333 | 337 |
334 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 338 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
335 }; | 339 }; |
336 | 340 |
337 } // namespace net | 341 } // namespace net |
338 | 342 |
339 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 343 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |