| 261 | std::ostringstream header; |
| 262 | header << std::hex << data.size() << "\r\n"; |
| 263 | send_all(socket_, header.str()); |
| 264 | send_all(socket_, std::string(data)); |
| 265 | send_all(socket_, "\r\n"); |
| 266 | } |
| 267 | |
| 268 | void finish() { |
| 269 | send_all(socket_, "0\r\n\r\n"); |
| 270 | } |
| 271 | |
| 272 | private: |
| 273 | SocketHandle socket_; |
| 274 | }; |
| 275 | |
| 276 | UniqueSocket bind_listen_socket(const std::string & host, int port) { |
| 277 | UniqueSocket socket_handle(socket(AF_INET, SOCK_STREAM, 0)); |
| 278 | if (socket_handle.get() == kInvalidSocket) { |
| 279 | throw std::runtime_error("could not create listen socket"); |
nothing calls this directly
no test coverage detected