This function is supposed to figure out if this transaction is susceptible to a redirection as specified by remap.config
| 1486 | // This function is supposed to figure out if this transaction is |
| 1487 | // susceptible to a redirection as specified by remap.config |
| 1488 | bool |
| 1489 | HttpTransact::handleIfRedirect(State *s) |
| 1490 | { |
| 1491 | int answer; |
| 1492 | URL redirect_url; |
| 1493 | |
| 1494 | answer = request_url_remap_redirect(&s->hdr_info.client_request, &redirect_url, s->state_machine->m_remap); |
| 1495 | if ((answer == PERMANENT_REDIRECT) || (answer == TEMPORARY_REDIRECT)) { |
| 1496 | s->remap_redirect = redirect_url.string_get_ref(nullptr); |
| 1497 | if (answer == TEMPORARY_REDIRECT) { |
| 1498 | if ((s->client_info).http_version == HTTP_1_1) { |
| 1499 | build_error_response(s, HTTP_STATUS_TEMPORARY_REDIRECT, "Redirect", "redirect#moved_temporarily"); |
| 1500 | } else { |
| 1501 | build_error_response(s, HTTP_STATUS_MOVED_TEMPORARILY, "Redirect", "redirect#moved_temporarily"); |
| 1502 | } |
| 1503 | } else { |
| 1504 | build_error_response(s, HTTP_STATUS_MOVED_PERMANENTLY, "Redirect", "redirect#moved_permanently"); |
| 1505 | } |
| 1506 | s->remap_redirect = nullptr; |
| 1507 | redirect_url.destroy(); |
| 1508 | return true; |
| 1509 | } |
| 1510 | |
| 1511 | return false; |
| 1512 | } |
| 1513 | |
| 1514 | void |
| 1515 | HttpTransact::HandleRequest(State *s) |
nothing calls this directly
no test coverage detected