| 155 | } |
| 156 | |
| 157 | bool http_response::read_request(MessageLite* out) |
| 158 | { |
| 159 | if (out == NULL) |
| 160 | return false; |
| 161 | |
| 162 | #ifdef DEBUG |
| 163 | struct timeval begin, end; |
| 164 | gettimeofday(&begin, NULL); |
| 165 | #endif |
| 166 | |
| 167 | if (response_->read_header() == false) |
| 168 | return false; |
| 169 | |
| 170 | #ifdef DEBUG |
| 171 | gettimeofday(&end, NULL); |
| 172 | header_spent_ = stamp_sub(&end, &begin); |
| 173 | #endif |
| 174 | |
| 175 | acl::string buf; |
| 176 | |
| 177 | #ifdef DEBUG |
| 178 | gettimeofday(&begin, NULL); |
| 179 | #endif |
| 180 | |
| 181 | if (response_->get_body(buf) == false) |
| 182 | return false; |
| 183 | |
| 184 | #ifdef DEBUG |
| 185 | gettimeofday(&end, NULL); |
| 186 | body_spent_ = stamp_sub(&end, &begin); |
| 187 | #endif |
| 188 | |
| 189 | std::string data(buf.c_str(), (int) buf.length()); |
| 190 | |
| 191 | #ifdef DEBUG |
| 192 | gettimeofday(&begin, NULL); |
| 193 | #endif |
| 194 | |
| 195 | bool ret = out->ParseFromString(data); |
| 196 | |
| 197 | #ifdef DEBUG |
| 198 | gettimeofday(&end, NULL); |
| 199 | parse_spent_ = stamp_sub(&end, &begin); |
| 200 | #endif |
| 201 | |
| 202 | return ret; |
| 203 | } |
| 204 | |
| 205 | bool http_response::send_response(const MessageLite& in) |
| 206 | { |
no test coverage detected