| 203 | } |
| 204 | |
| 205 | bool http_response::send_response(const MessageLite& in) |
| 206 | { |
| 207 | std::string buf; |
| 208 | |
| 209 | #ifdef DEBUG |
| 210 | struct timeval begin, end; |
| 211 | gettimeofday(&begin, NULL); |
| 212 | #endif |
| 213 | |
| 214 | in.SerializeToString(&buf); |
| 215 | |
| 216 | #ifdef DEBUG |
| 217 | gettimeofday(&end, NULL); |
| 218 | build_spent_ = stamp_sub(&end, &begin); |
| 219 | |
| 220 | gettimeofday(&begin, NULL); |
| 221 | #endif |
| 222 | |
| 223 | acl::http_header& header = response_->response_header(); |
| 224 | header.set_status(200); |
| 225 | header.set_content_length(buf.length()); |
| 226 | header.set_keep_alive(true); |
| 227 | |
| 228 | bool ret = response_->response(buf.c_str(), buf.length()); |
| 229 | |
| 230 | #ifdef DEBUG |
| 231 | gettimeofday(&end, NULL); |
| 232 | response_spent_ = stamp_sub(&end, &begin); |
| 233 | #endif |
| 234 | |
| 235 | return ret; |
| 236 | } |
| 237 | |
| 238 | } // namespace io |
| 239 | } // namespace protobuf |
no test coverage detected