OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 5 #include <windows.h> |
6 #include <objbase.h> | 6 #include <objbase.h> |
7 #include <urlmon.h> | 7 #include <urlmon.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/string_piece.h" | |
13 #include "base/string_util.h" | 12 #include "base/string_util.h" |
14 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
16 #include "chrome_frame/test/test_server.h" | 15 #include "chrome_frame/test/test_server.h" |
17 #include "net/base/winsock_init.h" | 16 #include "net/base/winsock_init.h" |
18 #include "net/http/http_util.h" | 17 #include "net/http/http_util.h" |
19 | 18 |
20 namespace test_server { | 19 namespace test_server { |
21 const char kDefaultHeaderTemplate[] = | 20 const char kDefaultHeaderTemplate[] = |
22 "HTTP/1.1 %hs\r\n" | 21 "HTTP/1.1 %hs\r\n" |
(...skipping 20 matching lines...) Expand all Loading... |
43 tokenizer.token_end()); | 42 tokenizer.token_end()); |
44 } | 43 } |
45 } | 44 } |
46 | 45 |
47 // Check for content-length in case we're being sent some data. | 46 // Check for content-length in case we're being sent some data. |
48 net::HttpUtil::HeadersIterator it(headers_.begin(), headers_.end(), | 47 net::HttpUtil::HeadersIterator it(headers_.begin(), headers_.end(), |
49 "\r\n"); | 48 "\r\n"); |
50 while (it.GetNext()) { | 49 while (it.GetNext()) { |
51 if (LowerCaseEqualsASCII(it.name(), "content-length")) { | 50 if (LowerCaseEqualsASCII(it.name(), "content-length")) { |
52 int int_content_length; | 51 int int_content_length; |
53 base::StringToInt(base::StringPiece(it.values_begin(), | 52 base::StringToInt(it.values_begin(), |
54 it.values_end()), | 53 it.values_end(), |
55 &int_content_length); | 54 &int_content_length); |
56 content_length_ = int_content_length; | 55 content_length_ = int_content_length; |
57 break; | 56 break; |
58 } | 57 } |
59 } | 58 } |
60 } | 59 } |
61 | 60 |
62 void Request::OnDataReceived(const std::string& data) { | 61 void Request::OnDataReceived(const std::string& data) { |
63 content_ += data; | 62 content_ += data; |
64 | 63 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 data_.append(content_length_header); | 372 data_.append(content_length_header); |
374 data_.append("\r\n"); | 373 data_.append("\r\n"); |
375 } | 374 } |
376 | 375 |
377 MessageLoop::current()->PostDelayedTask( | 376 MessageLoop::current()->PostDelayedTask( |
378 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), | 377 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), |
379 options.timeout_); | 378 options.timeout_); |
380 } | 379 } |
381 | 380 |
382 } // namespace test_server | 381 } // namespace test_server |
OLD | NEW |