| 403 | } |
| 404 | |
| 405 | void HttpClient::handleNetworkEOF(HttpResponse* response, yasio::io_channel* channel, int internalErrorCode) |
| 406 | { |
| 407 | channel->ud_.ptr = nullptr; |
| 408 | |
| 409 | channel->get_user_timer().cancel(); |
| 410 | response->updateInternalCode(internalErrorCode); |
| 411 | auto responseCode = response->getResponseCode(); |
| 412 | switch (responseCode) |
| 413 | { |
| 414 | case 301: |
| 415 | case 302: |
| 416 | case 307: |
| 417 | if (response->tryRedirect()) |
| 418 | { |
| 419 | processResponse(response, channel->index()); |
| 420 | response->release(); |
| 421 | break; |
| 422 | } |
| 423 | default: |
| 424 | finishResponse(response); |
| 425 | |
| 426 | // try process pending response |
| 427 | auto lck = _pendingResponseQueue.get_lock(); |
| 428 | if (!_pendingResponseQueue.unsafe_empty()) |
| 429 | { |
| 430 | auto pendingResponse = _pendingResponseQueue.unsafe_front(); |
| 431 | _pendingResponseQueue.unsafe_pop_front(); |
| 432 | lck.unlock(); |
| 433 | |
| 434 | processResponse(pendingResponse, channel->index()); |
| 435 | pendingResponse->release(); |
| 436 | } |
| 437 | else |
| 438 | { // recycle channel |
| 439 | _availChannelQueue.push_front(channel->index()); |
| 440 | } |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | void HttpClient::finishResponse(HttpResponse* response) |
| 445 | { |
nothing calls this directly
no test coverage detected