| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "net/quic/core/spdy_utils.h" | 5 #include "net/quic/core/spdy_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 SpdyHeaderBlock* headers) { | 244 SpdyHeaderBlock* headers) { |
| 245 (*headers)[":method"] = "GET"; | 245 (*headers)[":method"] = "GET"; |
| 246 size_t pos = url.find("://"); | 246 size_t pos = url.find("://"); |
| 247 if (pos == string::npos) { | 247 if (pos == string::npos) { |
| 248 return false; | 248 return false; |
| 249 } | 249 } |
| 250 (*headers)[":scheme"] = url.substr(0, pos); | 250 (*headers)[":scheme"] = url.substr(0, pos); |
| 251 size_t start = pos + 3; | 251 size_t start = pos + 3; |
| 252 pos = url.find("/", start); | 252 pos = url.find("/", start); |
| 253 if (pos == string::npos) { | 253 if (pos == string::npos) { |
| 254 return false; | 254 (*headers)[":authority"] = url.substr(start); |
| 255 (*headers)[":path"] = "/"; |
| 256 return true; |
| 255 } | 257 } |
| 256 (*headers)[":authority"] = url.substr(start, pos - start); | 258 (*headers)[":authority"] = url.substr(start, pos - start); |
| 257 (*headers)[":path"] = url.substr(pos); | 259 (*headers)[":path"] = url.substr(pos); |
| 258 return true; | 260 return true; |
| 259 } | 261 } |
| 260 | 262 |
| 261 } // namespace net | 263 } // namespace net |
| OLD | NEW |