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 "net/server/http_server.h" | 5 #include "net/server/http_server.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "base/sys_byteorder.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "net/server/http_connection.h" | 13 #include "net/server/http_connection.h" |
13 #include "net/server/http_server_request_info.h" | 14 #include "net/server/http_server_request_info.h" |
14 #include "net/server/web_socket.h" | 15 #include "net/server/web_socket.h" |
15 | 16 |
16 #if defined(OS_WIN) | |
17 #include <winsock2.h> | |
18 #else | |
19 #include <arpa/inet.h> | |
20 #endif | |
21 | |
22 namespace net { | 17 namespace net { |
23 | 18 |
24 HttpServer::HttpServer(const std::string& host, | 19 HttpServer::HttpServer(const std::string& host, |
25 int port, | 20 int port, |
26 HttpServer::Delegate* del) | 21 HttpServer::Delegate* del) |
27 : delegate_(del) { | 22 : delegate_(del) { |
28 server_ = ListenSocket::Listen(host, port, this); | 23 server_ = ListenSocket::Listen(host, port, this); |
29 } | 24 } |
30 | 25 |
31 HttpServer::~HttpServer() { | 26 HttpServer::~HttpServer() { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 void HttpServer::SendOverWebSocket(int connection_id, | 302 void HttpServer::SendOverWebSocket(int connection_id, |
308 const std::string& data) { | 303 const std::string& data) { |
309 HttpConnection* connection = FindConnection(connection_id); | 304 HttpConnection* connection = FindConnection(connection_id); |
310 if (connection == NULL) | 305 if (connection == NULL) |
311 return; | 306 return; |
312 DCHECK(connection->web_socket_.get()); | 307 DCHECK(connection->web_socket_.get()); |
313 connection->web_socket_->Send(data); | 308 connection->web_socket_->Send(data); |
314 } | 309 } |
315 | 310 |
316 } // namespace net | 311 } // namespace net |
OLD | NEW |