| 105 | std::function<void(size_t)> next_callback; |
| 106 | |
| 107 | std::istream * call(Poco::URI uri_, Poco::Net::HTTPResponse & response) |
| 108 | { |
| 109 | // With empty path poco will send "POST HTTP/1.1" its bug. |
| 110 | if (uri_.getPath().empty()) |
| 111 | uri_.setPath("/"); |
| 112 | |
| 113 | Poco::Net::HTTPRequest request(method, uri_.getPathAndQuery(), Poco::Net::HTTPRequest::HTTP_1_1); |
| 114 | request.setHost(uri_.getHost()); // use original, not resolved host name in header |
| 115 | |
| 116 | if (out_stream_callback) |
| 117 | request.setChunkedTransferEncoding(true); |
| 118 | |
| 119 | for (auto & http_header_entry: http_header_entries) |
| 120 | { |
| 121 | request.set(std::get<0>(http_header_entry), std::get<1>(http_header_entry)); |
| 122 | } |
| 123 | |
| 124 | if (!credentials.getUsername().empty()) |
| 125 | credentials.authenticate(request); |
| 126 | |
| 127 | LOG_TRACE((&Poco::Logger::get("ReadWriteBufferFromHTTP")), "Sending request to {}", uri_.toString()); |
| 128 | |
| 129 | auto sess = session->getSession(); |
| 130 | |
| 131 | try |
| 132 | { |
| 133 | auto & stream_out = sess->sendRequest(request); |
| 134 | |
| 135 | if (out_stream_callback) |
| 136 | out_stream_callback(stream_out); |
| 137 | |
| 138 | istr = receiveResponse(*sess, request, response, true); |
| 139 | response.getCookies(cookies); |
| 140 | |
| 141 | content_encoding = response.get("Content-Encoding", ""); |
| 142 | return istr; |
| 143 | |
| 144 | } |
| 145 | catch (const Poco::Exception & e) |
| 146 | { |
| 147 | /// We use session data storage as storage for exception text |
| 148 | /// Depend on it we can deduce to reconnect session or reresolve session host |
| 149 | sess->attachSessionData(e.message()); |
| 150 | throw; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | public: |
| 155 | using NextCallback = std::function<void(size_t)>; |
nothing calls this directly
no test coverage detected