| 218 | } |
| 219 | |
| 220 | void HttpClient::processResponse(HttpResponse* response, int channelIndex) |
| 221 | { |
| 222 | response->retain(); |
| 223 | |
| 224 | if (response->validateUri()) |
| 225 | { |
| 226 | if (channelIndex == -1) |
| 227 | channelIndex = tryTakeAvailChannel(); |
| 228 | |
| 229 | if (channelIndex != -1) |
| 230 | { |
| 231 | auto channelHandle = _service->channel_at(channelIndex); |
| 232 | auto& requestUri = response->getRequestUri(); |
| 233 | channelHandle->ud_.ptr = response; |
| 234 | _service->set_option(YOPT_C_REMOTE_ENDPOINT, channelIndex, requestUri.getHost().data(), |
| 235 | (int)requestUri.getPort()); |
| 236 | if (requestUri.isSecure()) |
| 237 | _service->open(channelIndex, YCK_SSL_CLIENT); |
| 238 | else |
| 239 | _service->open(channelIndex, YCK_TCP_CLIENT); |
| 240 | } |
| 241 | else |
| 242 | _pendingResponseQueue.emplace_back(response); |
| 243 | } |
| 244 | else |
| 245 | finishResponse(response); |
| 246 | } |
| 247 | |
| 248 | void HttpClient::handleNetworkEvent(yasio::io_event* event) |
| 249 | { |
nothing calls this directly
no test coverage detected