| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/spdy/spdy_http_utils.h" | 5 #include "net/spdy/spdy_http_utils.h" |
| 6 | 6 |
| 7 #include <vector> |
| 8 |
| 7 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 11 #include "net/base/escape.h" | 13 #include "net/base/escape.h" |
| 12 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
| 13 #include "net/base/url_util.h" | 15 #include "net/base/url_util.h" |
| 14 #include "net/http/http_request_headers.h" | 16 #include "net/http/http_request_headers.h" |
| 15 #include "net/http/http_request_info.h" | 17 #include "net/http/http_request_info.h" |
| 16 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 29 if (headers->find(name) == headers->end()) { | 31 if (headers->find(name) == headers->end()) { |
| 30 (*headers)[name] = value; | 32 (*headers)[name] = value; |
| 31 } else { | 33 } else { |
| 32 SpdyString joint_value = (*headers)[name].as_string(); | 34 SpdyString joint_value = (*headers)[name].as_string(); |
| 33 joint_value.append(1, '\0'); | 35 joint_value.append(1, '\0'); |
| 34 joint_value.append(value); | 36 joint_value.append(value); |
| 35 (*headers)[name] = joint_value; | 37 (*headers)[name] = joint_value; |
| 36 } | 38 } |
| 37 } | 39 } |
| 38 | 40 |
| 39 } // namespace | 41 } // namespace |
| 40 | 42 |
| 41 bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers, | 43 bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers, |
| 42 HttpResponseInfo* response) { | 44 HttpResponseInfo* response) { |
| 43 // The ":status" header is required. | 45 // The ":status" header is required. |
| 44 SpdyHeaderBlock::const_iterator it = headers.find(":status"); | 46 SpdyHeaderBlock::const_iterator it = headers.find(":status"); |
| 45 if (it == headers.end()) | 47 if (it == headers.end()) |
| 46 return false; | 48 return false; |
| 47 SpdyString status = it->second.as_string(); | 49 SpdyString status = it->second.as_string(); |
| 48 SpdyString raw_headers("HTTP/1.1 "); | 50 SpdyString raw_headers("HTTP/1.1 "); |
| 49 raw_headers.append(status); | 51 raw_headers.append(status); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 url.append(it->second.as_string()); | 160 url.append(it->second.as_string()); |
| 159 | 161 |
| 160 it = headers.find(":path"); | 162 it = headers.find(":path"); |
| 161 if (it == headers.end()) | 163 if (it == headers.end()) |
| 162 return GURL(); | 164 return GURL(); |
| 163 url.append(it->second.as_string()); | 165 url.append(it->second.as_string()); |
| 164 return GURL(url); | 166 return GURL(url); |
| 165 } | 167 } |
| 166 | 168 |
| 167 } // namespace net | 169 } // namespace net |
| OLD | NEW |