| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/net/http_response_headers_util.h" | 5 #include "ios/net/http_response_headers_util.h" |
| 6 | 6 |
| 7 #include <Foundation/Foundation.h> | 7 #include <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "net/http/http_util.h" | 12 #include "net/http/http_util.h" |
| 13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
| 14 namespace { | 18 namespace { |
| 15 // String format used to create the http status line from the status code and | 19 // String format used to create the http status line from the status code and |
| 16 // its localized description. | 20 // its localized description. |
| 17 NSString* const kHttpStatusLineFormat = @"HTTP %ld %s"; | 21 NSString* const kHttpStatusLineFormat = @"HTTP %ld %s"; |
| 18 // String format used to pass the header name/value pairs to the | 22 // String format used to pass the header name/value pairs to the |
| 19 // HttpResponseHeaders. | 23 // HttpResponseHeaders. |
| 20 const char kHeaderLineFormat[] = "%s: %s"; | 24 const char kHeaderLineFormat[] = "%s: %s"; |
| 21 } | 25 } |
| 22 | 26 |
| 23 namespace net { | 27 namespace net { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 std::string header_line = | 49 std::string header_line = |
| 46 base::StringPrintf(kHeaderLineFormat, header_name.c_str(), | 50 base::StringPrintf(kHeaderLineFormat, header_name.c_str(), |
| 47 header_value.c_str()); | 51 header_value.c_str()); |
| 48 http_headers->AddHeader(header_line); | 52 http_headers->AddHeader(header_line); |
| 49 } | 53 } |
| 50 }]; | 54 }]; |
| 51 return http_headers; | 55 return http_headers; |
| 52 } | 56 } |
| 53 | 57 |
| 54 } // namespae net | 58 } // namespae net |
| OLD | NEW |