OLD | NEW |
---|---|
1 // Copyright (c) 2010 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 "net/server/http_server.h" | |
6 | |
5 #include <map> | 7 #include <map> |
6 | 8 |
7 #ifdef _WIN32 | 9 #include "build/build_config.h" |
willchan no longer on Chromium
2011/04/17 17:30:00
I believe http://dev.chromium.org/developers/codin
tfarina
2011/04/18 00:17:15
Yup, fixed.
| |
10 | |
11 #if defined(OS_WIN) | |
8 #include <winsock2.h> | 12 #include <winsock2.h> |
9 #else | 13 #else |
10 #include <arpa/inet.h> | 14 #include <arpa/inet.h> |
11 #endif | 15 #endif |
12 | 16 |
13 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
14 #include "base/logging.h" | 18 #include "base/logging.h" |
15 #include "base/md5.h" | 19 #include "base/md5.h" |
16 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
17 #include "base/string_util.h" | 21 #include "base/string_util.h" |
18 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
19 #include "net/server/http_server.h" | |
20 #include "net/server/http_server_request_info.h" | 23 #include "net/server/http_server_request_info.h" |
21 | 24 |
25 namespace net { | |
26 | |
22 int HttpServer::Connection::lastId_ = 0; | 27 int HttpServer::Connection::lastId_ = 0; |
28 | |
23 HttpServer::HttpServer(const std::string& host, | 29 HttpServer::HttpServer(const std::string& host, |
24 int port, | 30 int port, |
25 HttpServer::Delegate* del) | 31 HttpServer::Delegate* del) |
26 : delegate_(del) { | 32 : delegate_(del) { |
27 server_ = ListenSocket::Listen(host, port, this); | 33 server_ = ListenSocket::Listen(host, port, this); |
28 } | 34 } |
29 | 35 |
30 HttpServer::~HttpServer() { | 36 HttpServer::~HttpServer() { |
31 IdToConnectionMap copy = id_to_connection_; | 37 IdToConnectionMap copy = id_to_connection_; |
32 for (IdToConnectionMap::iterator it = copy.begin(); it != copy.end(); ++it) | 38 for (IdToConnectionMap::iterator it = copy.begin(); it != copy.end(); ++it) |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 return NULL; | 432 return NULL; |
427 return it->second; | 433 return it->second; |
428 } | 434 } |
429 | 435 |
430 HttpServer::Connection* HttpServer::FindConnection(ListenSocket* socket) { | 436 HttpServer::Connection* HttpServer::FindConnection(ListenSocket* socket) { |
431 SocketToConnectionMap::iterator it = socket_to_connection_.find(socket); | 437 SocketToConnectionMap::iterator it = socket_to_connection_.find(socket); |
432 if (it == socket_to_connection_.end()) | 438 if (it == socket_to_connection_.end()) |
433 return NULL; | 439 return NULL; |
434 return it->second; | 440 return it->second; |
435 } | 441 } |
442 | |
443 } // namespace net | |
OLD | NEW |