Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpackget] Handle Cookie headers in HTTP GET requests when required #406

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

brondani
Copy link
Collaborator

@brondani brondani commented Dec 13, 2024

Fixes

Changes

  • Resend HTTP GET request with a Cookie header if the first attempt fails with StatusForbidden status and a Set-Cookie among the response headers.

Checklist

  • 🤖 This change is covered by unit tests as required.
  • 🤹 All required manual testing has been performed.
  • 🛡️ Security impacts have been considered.
  • 📖 All documentation updates are complete.
  • 🧠 This change does not change third-party dependencies

@brondani brondani force-pushed the cpackget-handle-http-header-cookie branch from 9ef8197 to 5ee5cef Compare December 13, 2024 16:10
Copy link

codeclimate bot commented Dec 13, 2024

Code Climate has analyzed commit 5ee5cef and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 72.7% (50% is the threshold).

This pull request will bring the total coverage in the repository to 59.6% (0.0% change).

View more on Code Climate.

@brondani brondani marked this pull request as ready for review December 13, 2024 16:40
@brondani brondani requested review from jkrech and bgn42 December 13, 2024 16:41
Copy link
Collaborator

@bgn42 bgn42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear to me how this can work, if the status is forbidden, how can one then send a cookie? But I don't know much about using cookies, nearly nothing. But most of them taste good :-).

@brondani
Copy link
Collaborator Author

It is not clear to me how this can work, if the status is forbidden, how can one then send a cookie?

The response to the request may have several headers regardless of the status code. Indeed in this case it has the Set-Cookie:
image

A new request with such cookie is accepted by the server that responds with the full expected content and status code OK:
image

@jkrech jkrech merged commit 527e334 into main Dec 16, 2024
19 checks passed
@jkrech jkrech deleted the cpackget-handle-http-header-cookie branch December 16, 2024 05:59
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.

3 participants