Skip to content

Redirect statuses 302, 303, 307 and 308, and redirectReply [#741] - #743

Open
ambroise-leclerc wants to merge 1 commit into
developfrom
741-redirect-statuses
Open

ambroise-leclerc wants to merge 1 commit into
developfrom
741-redirect-statuses

Conversation

@ambroise-leclerc

Copy link
Copy Markdown
Collaborator

Closes #741.

Changes

  • http::Response::StatusCode gains found (302), seeOther (303), temporaryRedirect (307) and permanentRedirect (308), written with their reason phrase (HTTP/1.1 303 See Other).
  • http::redirectReply(status, location), next to textReply: a route reply with Location, an empty body (Content-Length: 0) and, for the temporary statuses (302, 303, 307), Cache-Control: no-store. It throws std::invalid_argument for a status that is not a redirection, and for a location that is empty or holds a control character (which would split the header).
  • docs/HTTP_ASSETS.md documents the helper; changelog entry under Unreleased.

Tests

  • A route redirects with the status line, Location and caching of its status (#741): a route answering 303 reaches the client with its status line, Location, Cache-Control: no-store and an empty body; a 308 to HEAD is not marked no-store.
  • Each redirection status has its reason phrase and its caching (#741): the status line of 301, 302, 303, 307 and 308, the headers of redirectReply for each, and the refusals.
  • CEF-off build and full CTest suite: 770/770 passed (the CUDA case skipped).

Response::StatusCode gains found, seeOther, temporaryRedirect and
permanentRedirect, written with their reason phrase. http::redirectReply(status,
location) builds a route reply with Location, an empty body and, for the
temporary ones, Cache-Control: no-store; it refuses a status that is not a
redirection and a location that is empty or holds a control character.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirect statuses 302, 303, 307 and 308 in Response::StatusCode

1 participant