OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <dirent.h> | 5 #include <dirent.h> |
6 #include <linux/tcp.h> // For TCP_NODELAY | 6 #include <netinet/tcp.h> // For TCP_NODELAY on some distros, this needs to be < linux/tcp.h> |
Mike Belshe
2010/04/02 19:41:28
nit: 80 columns.
| |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #include <openssl/err.h> | 10 #include <openssl/err.h> |
11 #include <openssl/ssl.h> | 11 #include <openssl/ssl.h> |
12 | 12 |
13 #include <deque> | 13 #include <deque> |
14 #include <iostream> | 14 #include <iostream> |
15 #include <limits> | 15 #include <limits> |
16 #include <vector> | 16 #include <vector> |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 return; | 187 return; |
188 | 188 |
189 fcntl_return = fcntl(fd, F_SETFL, fcntl_return | O_NONBLOCK); | 189 fcntl_return = fcntl(fd, F_SETFL, fcntl_return | O_NONBLOCK); |
190 CHECK_NE(fcntl_return, -1) | 190 CHECK_NE(fcntl_return, -1) |
191 << "error doing fcntl(fd, F_SETFL, fcntl_return) fd: " << fd | 191 << "error doing fcntl(fd, F_SETFL, fcntl_return) fd: " << fd |
192 << " errno=" << errno; | 192 << " errno=" << errno; |
193 } | 193 } |
194 | 194 |
195 // Encode the URL. | 195 // Encode the URL. |
196 string EncodeURL(string uri, string host, string method) { | 196 string EncodeURL(string uri, string host, string method) { |
197 string filename; | |
197 if (!FLAGS_need_to_encode_url) { | 198 if (!FLAGS_need_to_encode_url) { |
198 // TODO(mbelshe): if uri is fully qualified, need to strip protocol/host. | 199 // TODO(mbelshe): if uri is fully qualified, need to strip protocol/host. |
199 return string(method + "_" + uri); | 200 if (uri[0] == '/') { |
201 // uri is not fully qualified. | |
202 filename = method + "_/" + host + uri; | |
203 } else { | |
204 filename = method + "_" + uri; | |
205 } | |
206 return filename; | |
200 } | 207 } |
201 | 208 |
202 string filename; | |
203 if (uri[0] == '/') { | 209 if (uri[0] == '/') { |
204 // uri is not fully qualified. | 210 // uri is not fully qualified. |
205 filename = net::UrlToFilenameEncoder::Encode( | 211 filename = net::UrlToFilenameEncoder::Encode( |
206 "http://" + host + uri, method + "_/"); | 212 "http://" + host + uri, method + "_/"); |
207 } else { | 213 } else { |
208 filename = net::UrlToFilenameEncoder::Encode(uri, method + "_/"); | 214 filename = net::UrlToFilenameEncoder::Encode(uri, method + "_/"); |
209 } | 215 } |
210 return filename; | 216 return filename; |
211 } | 217 } |
212 | 218 |
(...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2284 for (unsigned int i = 0; i < sm_worker_threads_.size(); ++i) { | 2290 for (unsigned int i = 0; i < sm_worker_threads_.size(); ++i) { |
2285 sm_worker_threads_[i]->Join(); | 2291 sm_worker_threads_[i]->Join(); |
2286 } | 2292 } |
2287 return 0; | 2293 return 0; |
2288 } | 2294 } |
2289 usleep(1000*10); // 10 ms | 2295 usleep(1000*10); // 10 ms |
2290 } | 2296 } |
2291 return 0; | 2297 return 0; |
2292 } | 2298 } |
2293 | 2299 |
OLD | NEW |