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 "net/tools/flip_server/http_interface.h" | 5 #include "net/tools/flip_server/http_interface.h" |
6 | 6 |
7 #include "net/tools/balsa/balsa_frame.h" | 7 #include "net/tools/balsa/balsa_frame.h" |
8 #include "net/tools/dump_cache/url_utilities.h" | 8 #include "net/tools/dump_cache/url_utilities.h" |
9 #include "net/tools/flip_server/flip_config.h" | 9 #include "net/tools/flip_server/flip_config.h" |
10 #include "net/tools/flip_server/sm_connection.h" | 10 #include "net/tools/flip_server/sm_connection.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void HttpSM::MessageDone() { | 66 void HttpSM::MessageDone() { |
67 if (acceptor_->flip_handler_type_ == FLIP_HANDLER_PROXY) { | 67 if (acceptor_->flip_handler_type_ == FLIP_HANDLER_PROXY) { |
68 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "HttpSM: MessageDone. Sending EOF: " | 68 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "HttpSM: MessageDone. Sending EOF: " |
69 << "stream " << stream_id_; | 69 << "stream " << stream_id_; |
70 sm_spdy_interface_->SendEOF(stream_id_); | 70 sm_spdy_interface_->SendEOF(stream_id_); |
71 } else { | 71 } else { |
72 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "HttpSM: MessageDone."; | 72 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "HttpSM: MessageDone."; |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 void HttpSM::HandleHeaderError(BalsaFrame* framer) { HandleError(); } | 76 void HttpSM::HandleHeaderError(BalsaFrame* framer) { |
| 77 HandleError(); |
| 78 } |
77 | 79 |
78 void HttpSM::HandleChunkingError(BalsaFrame* framer) { HandleError(); } | 80 void HttpSM::HandleChunkingError(BalsaFrame* framer) { |
| 81 HandleError(); |
| 82 } |
79 | 83 |
80 void HttpSM::HandleBodyError(BalsaFrame* framer) { HandleError(); } | 84 void HttpSM::HandleBodyError(BalsaFrame* framer) { |
| 85 HandleError(); |
| 86 } |
81 | 87 |
82 void HttpSM::HandleError() { | 88 void HttpSM::HandleError() { |
83 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Error detected"; | 89 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Error detected"; |
84 } | 90 } |
85 | 91 |
86 void HttpSM::AddToOutputOrder(const MemCacheIter& mci) { | 92 void HttpSM::AddToOutputOrder(const MemCacheIter& mci) { |
87 output_ordering_.AddToOutputOrder(mci); | 93 output_ordering_.AddToOutputOrder(mci); |
88 } | 94 } |
89 | 95 |
90 void HttpSM::InitSMInterface(SMInterface* sm_spdy_interface, int32 server_idx) { | 96 void HttpSM::InitSMInterface(SMInterface* sm_spdy_interface, int32 server_idx) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 data_frame->size = len; | 134 data_frame->size = len; |
129 data_frame->delete_when_done = true; | 135 data_frame->delete_when_done = true; |
130 connection_->EnqueueDataFrame(data_frame); | 136 connection_->EnqueueDataFrame(data_frame); |
131 return len; | 137 return len; |
132 } | 138 } |
133 | 139 |
134 bool HttpSM::MessageFullyRead() const { | 140 bool HttpSM::MessageFullyRead() const { |
135 return http_framer_->MessageFullyRead(); | 141 return http_framer_->MessageFullyRead(); |
136 } | 142 } |
137 | 143 |
138 void HttpSM::SetStreamID(uint32 stream_id) { stream_id_ = stream_id; } | 144 void HttpSM::SetStreamID(uint32 stream_id) { |
| 145 stream_id_ = stream_id; |
| 146 } |
139 | 147 |
140 bool HttpSM::Error() const { return http_framer_->Error(); } | 148 bool HttpSM::Error() const { |
| 149 return http_framer_->Error(); |
| 150 } |
141 | 151 |
142 const char* HttpSM::ErrorAsString() const { | 152 const char* HttpSM::ErrorAsString() const { |
143 return BalsaFrameEnums::ErrorCodeToString(http_framer_->ErrorCode()); | 153 return BalsaFrameEnums::ErrorCodeToString(http_framer_->ErrorCode()); |
144 } | 154 } |
145 | 155 |
146 void HttpSM::Reset() { | 156 void HttpSM::Reset() { |
147 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "HttpSM: Reset: stream " << stream_id_; | 157 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "HttpSM: Reset: stream " << stream_id_; |
148 http_framer_->Reset(); | 158 http_framer_->Reset(); |
149 } | 159 } |
150 | 160 |
(...skipping 17 matching lines...) Expand all Loading... |
168 } | 178 } |
169 } | 179 } |
170 | 180 |
171 void HttpSM::Cleanup() { | 181 void HttpSM::Cleanup() { |
172 if (!(acceptor_->flip_handler_type_ == FLIP_HANDLER_HTTP_SERVER)) { | 182 if (!(acceptor_->flip_handler_type_ == FLIP_HANDLER_HTTP_SERVER)) { |
173 VLOG(2) << "HttpSM Request Fully Read; stream_id: " << stream_id_; | 183 VLOG(2) << "HttpSM Request Fully Read; stream_id: " << stream_id_; |
174 connection_->Cleanup("request complete"); | 184 connection_->Cleanup("request complete"); |
175 } | 185 } |
176 } | 186 } |
177 | 187 |
178 int HttpSM::PostAcceptHook() { return 1; } | 188 int HttpSM::PostAcceptHook() { |
| 189 return 1; |
| 190 } |
179 | 191 |
180 void HttpSM::NewStream(uint32 stream_id, | 192 void HttpSM::NewStream(uint32 stream_id, |
181 uint32 priority, | 193 uint32 priority, |
182 const std::string& filename) { | 194 const std::string& filename) { |
183 MemCacheIter mci; | 195 MemCacheIter mci; |
184 mci.stream_id = stream_id; | 196 mci.stream_id = stream_id; |
185 mci.priority = priority; | 197 mci.priority = priority; |
186 if (!memory_cache_->AssignFileData(filename, &mci)) { | 198 if (!memory_cache_->AssignFileData(filename, &mci)) { |
187 // error creating new stream. | 199 // error creating new stream. |
188 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "Sending ErrorNotFound"; | 200 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "Sending ErrorNotFound"; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 num_to_write, | 343 num_to_write, |
332 0, | 344 0, |
333 true); | 345 true); |
334 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "HttpSM: GetOutput SendDataFrame[" | 346 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "HttpSM: GetOutput SendDataFrame[" |
335 << mci->stream_id << "]: " << num_to_write; | 347 << mci->stream_id << "]: " << num_to_write; |
336 mci->body_bytes_consumed += num_to_write; | 348 mci->body_bytes_consumed += num_to_write; |
337 mci->bytes_sent += num_to_write; | 349 mci->bytes_sent += num_to_write; |
338 } | 350 } |
339 | 351 |
340 } // namespace net | 352 } // namespace net |
OLD | NEW |