| 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/streamer_interface.h" | 5 #include "net/tools/flip_server/streamer_interface.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "net/tools/balsa/balsa_frame.h" | 9 #include "net/tools/balsa/balsa_frame.h" |
| 10 #include "net/tools/flip_server/constants.h" | 10 #include "net/tools/flip_server/constants.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 char* dataPtr = new char[len]; | 80 char* dataPtr = new char[len]; |
| 81 memcpy(dataPtr, data, len); | 81 memcpy(dataPtr, data, len); |
| 82 DataFrame* df = new DataFrame; | 82 DataFrame* df = new DataFrame; |
| 83 df->data = (const char*)dataPtr; | 83 df->data = (const char*)dataPtr; |
| 84 df->size = len; | 84 df->size = len; |
| 85 df->delete_when_done = true; | 85 df->delete_when_done = true; |
| 86 connection_->EnqueueDataFrame(df); | 86 connection_->EnqueueDataFrame(df); |
| 87 return len; | 87 return len; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool StreamerSM::Error() const { return false; } | 90 bool StreamerSM::Error() const { |
| 91 return false; |
| 92 } |
| 91 | 93 |
| 92 const char* StreamerSM::ErrorAsString() const { return "(none)"; } | 94 const char* StreamerSM::ErrorAsString() const { |
| 95 return "(none)"; |
| 96 } |
| 93 | 97 |
| 94 bool StreamerSM::MessageFullyRead() const { | 98 bool StreamerSM::MessageFullyRead() const { |
| 95 if (is_request_) { | 99 if (is_request_) { |
| 96 return http_framer_->MessageFullyRead(); | 100 return http_framer_->MessageFullyRead(); |
| 97 } else { | 101 } else { |
| 98 return false; | 102 return false; |
| 99 } | 103 } |
| 100 } | 104 } |
| 101 | 105 |
| 102 void StreamerSM::Reset() { | 106 void StreamerSM::Reset() { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 LOG(INFO) << "NOT adding forward header."; | 184 LOG(INFO) << "NOT adding forward header."; |
| 181 } | 185 } |
| 182 SimpleBuffer sb; | 186 SimpleBuffer sb; |
| 183 char* buffer; | 187 char* buffer; |
| 184 int size; | 188 int size; |
| 185 mod_headers.WriteHeaderAndEndingToBuffer(&sb); | 189 mod_headers.WriteHeaderAndEndingToBuffer(&sb); |
| 186 sb.GetReadablePtr(&buffer, &size); | 190 sb.GetReadablePtr(&buffer, &size); |
| 187 sm_other_interface_->ProcessWriteInput(buffer, size); | 191 sm_other_interface_->ProcessWriteInput(buffer, size); |
| 188 } | 192 } |
| 189 | 193 |
| 190 void StreamerSM::HandleHeaderError(BalsaFrame* framer) { HandleError(); } | 194 void StreamerSM::HandleHeaderError(BalsaFrame* framer) { |
| 195 HandleError(); |
| 196 } |
| 191 | 197 |
| 192 void StreamerSM::HandleChunkingError(BalsaFrame* framer) { HandleError(); } | 198 void StreamerSM::HandleChunkingError(BalsaFrame* framer) { |
| 199 HandleError(); |
| 200 } |
| 193 | 201 |
| 194 void StreamerSM::HandleBodyError(BalsaFrame* framer) { HandleError(); } | 202 void StreamerSM::HandleBodyError(BalsaFrame* framer) { |
| 203 HandleError(); |
| 204 } |
| 195 | 205 |
| 196 void StreamerSM::HandleError() { | 206 void StreamerSM::HandleError() { |
| 197 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Error detected"; | 207 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Error detected"; |
| 198 } | 208 } |
| 199 | 209 |
| 200 } // namespace net | 210 } // namespace net |
| OLD | NEW |