Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: net/server/http_connection.cc

Issue 10161005: Add DefaultListenSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build on Windows Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/server/http_connection.h ('k') | net/server/http_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_connection.h" 5 #include "net/server/http_connection.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "net/base/listen_socket.h" 9 #include "net/base/stream_listen_socket.h"
10 #include "net/server/http_server.h" 10 #include "net/server/http_server.h"
11 #include "net/server/web_socket.h" 11 #include "net/server/web_socket.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 int HttpConnection::last_id_ = 0; 15 int HttpConnection::last_id_ = 0;
16 16
17 void HttpConnection::Send(const std::string& data) { 17 void HttpConnection::Send(const std::string& data) {
18 if (!socket_) 18 if (!socket_)
19 return; 19 return;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 socket_->Send(base::StringPrintf( 55 socket_->Send(base::StringPrintf(
56 "HTTP/1.1 500 Internal Error\r\n" 56 "HTTP/1.1 500 Internal Error\r\n"
57 "Content-Type:text/html\r\n" 57 "Content-Type:text/html\r\n"
58 "Content-Length:%d\r\n" 58 "Content-Length:%d\r\n"
59 "\r\n" 59 "\r\n"
60 "%s", 60 "%s",
61 static_cast<int>(message.length()), 61 static_cast<int>(message.length()),
62 message.c_str())); 62 message.c_str()));
63 } 63 }
64 64
65 HttpConnection::HttpConnection(HttpServer* server, ListenSocket* sock) 65 HttpConnection::HttpConnection(HttpServer* server, StreamListenSocket* sock)
66 : server_(server), 66 : server_(server),
67 socket_(sock) { 67 socket_(sock) {
68 id_ = last_id_++; 68 id_ = last_id_++;
69 } 69 }
70 70
71 HttpConnection::~HttpConnection() { 71 HttpConnection::~HttpConnection() {
72 DetachSocket(); 72 DetachSocket();
73 server_->delegate_->OnClose(id_); 73 server_->delegate_->OnClose(id_);
74 } 74 }
75 75
76 void HttpConnection::DetachSocket() { 76 void HttpConnection::DetachSocket() {
77 socket_ = NULL; 77 socket_ = NULL;
78 } 78 }
79 79
80 void HttpConnection::Shift(int num_bytes) { 80 void HttpConnection::Shift(int num_bytes) {
81 recv_data_ = recv_data_.substr(num_bytes); 81 recv_data_ = recv_data_.substr(num_bytes);
82 } 82 }
83 83
84 } // namespace net 84 } // namespace net
OLDNEW
« no previous file with comments | « net/server/http_connection.h ('k') | net/server/http_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698