| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <iterator> | 6 #include <iterator> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 void HashSetToVector(base::hash_set<T>* source, std::vector<T>* target) { | 507 void HashSetToVector(base::hash_set<T>* source, std::vector<T>* target) { |
| 508 size_t old_target_size = target->size(); | 508 size_t old_target_size = target->size(); |
| 509 target->resize(old_target_size + source->size()); | 509 target->resize(old_target_size + source->size()); |
| 510 size_t i = 0; | 510 size_t i = 0; |
| 511 for (typename base::hash_set<T>::iterator iter = source->begin(); | 511 for (typename base::hash_set<T>::iterator iter = source->begin(); |
| 512 iter != source->end(); ++iter, ++i) | 512 iter != source->end(); ++iter, ++i) |
| 513 (*target)[old_target_size + i] = *iter; | 513 (*target)[old_target_size + i] = *iter; |
| 514 } | 514 } |
| 515 | 515 |
| 516 // Characters to be used for mime multipart boundary. | 516 // Characters to be used for mime multipart boundary. |
| 517 // |
| 518 // TODO(rsleevi): crbug.com/575779: Follow the spec or fix the spec. |
| 517 // The RFC 2046 spec says the alphanumeric characters plus the | 519 // The RFC 2046 spec says the alphanumeric characters plus the |
| 518 // following characters are legal for boundaries: '()+_,-./:=? | 520 // following characters are legal for boundaries: '()+_,-./:=? |
| 519 // However the following characters, though legal, cause some sites | 521 // However the following characters, though legal, cause some sites |
| 520 // to fail: (),./:=+ | 522 // to fail: (),./:=+ |
| 521 const char kMimeBoundaryCharacters[] = | 523 const char kMimeBoundaryCharacters[] = |
| 522 "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | 524 "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| 523 | 525 |
| 524 // Size of mime multipart boundary. | 526 // Size of mime multipart boundary. |
| 525 const size_t kMimeBoundarySize = 69; | 527 const size_t kMimeBoundarySize = 69; |
| 526 | 528 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 post_data->append("\r\n" + value + "\r\n"); | 627 post_data->append("\r\n" + value + "\r\n"); |
| 626 } | 628 } |
| 627 | 629 |
| 628 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, | 630 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, |
| 629 std::string* post_data) { | 631 std::string* post_data) { |
| 630 DCHECK(post_data); | 632 DCHECK(post_data); |
| 631 post_data->append("--" + mime_boundary + "--\r\n"); | 633 post_data->append("--" + mime_boundary + "--\r\n"); |
| 632 } | 634 } |
| 633 | 635 |
| 634 } // namespace net | 636 } // namespace net |
| OLD | NEW |