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

Header.Authorization.Unparsed with empty authScheme cause code to hang forever #2742

Closed
gaeljw opened this issue Mar 24, 2024 · 8 comments · Fixed by #2900
Closed

Header.Authorization.Unparsed with empty authScheme cause code to hang forever #2742

gaeljw opened this issue Mar 24, 2024 · 8 comments · Fixed by #2900
Labels
💎 Bounty bug Something isn't working 💰 Rewarded

Comments

@gaeljw
Copy link

gaeljw commented Mar 24, 2024

Describe the bug

When using client code sending a request with an Authorization header with no scheme (Header.Authorization.Unparsed("", "some-key")), the client code hangs forever.

To Reproduce

Reproduction repository: https://github.com/gaeljw/ziohttp3hanging

Run sbt test.

The test hangs forever.

Note that sometimes the test may fail with a pact server issue like Cause: io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connexion refused: localhost/[0:0:0:0:0:0:0:1]:33523, ignore this case, and just retry. It's not the issue I care about for now.

Expected behaviour

The test should succeed with output like:

[info] MyWsClientPactTest:
[info] MyWsClient
[info] - should retrieve a model
[info] Run completed in 3 seconds, 99 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.

It does when changing the headers value in MyWsClient to any of these 3 other variants:

- val headers: Headers = Headers(Header.Accept(MediaType.application.json), Header.Authorization.Unparsed("", "plop-key"))
+ val headers: Headers = Headers(Header.Accept(MediaType.application.json), Header.Custom("Authorization", "plop-key"))
+ val headers: Headers = Headers(Header.Accept(MediaType.application.json), Header.Authorization.Unparsed("something", "plop-key"))
+ val headers: Headers = Headers(Header.Accept(MediaType.application.json))

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Linux

Additional context

The issue appears when upgrading from zio-http 0.0.5 to 3.0.0-RC4.

@gaeljw gaeljw added the bug Something isn't working label Mar 24, 2024
@jdegoes
Copy link
Member

jdegoes commented Jun 5, 2024

/bounty $125

Copy link

algora-pbc bot commented Jun 5, 2024

💎 $125 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2742 with your implementation plan
  2. Submit work: Create a pull request including /claim #2742 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @daredevil3435 Jun 10, 2024, 11:23:31 AM WIP
🟢 @kyri-petrou #2900

@gaeljw
Copy link
Author

gaeljw commented Jun 10, 2024

@daredevil3435

Issue involves changing value of val headers, right?

Not sure what you mean by that? The issue is fixed if I declare val headers differently. But the point is to not have to do so or at the very least fail with an explicit error rather than having the code just hanging.

@daredevil3435
Copy link

@daredevil3435

Issue involves changing value of val headers, right?

Not sure what you mean by that? The issue is fixed if I declare val headers differently. But the point is to not have to do so or at the very least fail with an explicit error rather than having the code just hanging.

I'm kind of new here so it is quite overwhelming for me, and I do have many questions to ask, so I'm sorry about that. But can you explain me what exactly needs to be done?

@gaeljw
Copy link
Author

gaeljw commented Jun 10, 2024

No offense but if I knew what needs to be done, I'd probably do it.

I've provided a reproduction case, the goal is that the code in the reproduction case doesn't hang when you run it.

Can you expand on what is unclear to you?

@daredevil3435
Copy link

No offense but if I knew what needs to be done, I'd probably do it.

I've provided a reproduction case, the goal is that the code in the reproduction case doesn't hang when you run it.

Can you expand on what is unclear to you?

I think it's my mistake that without prior knowledge I shouldn't have commented on this issue. sorry for the inconvenience.

Copy link

algora-pbc bot commented Jun 10, 2024

💡 @kyri-petrou submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Jun 11, 2024

🎉🎈 @kyri-petrou has been awarded $125! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 Bounty bug Something isn't working 💰 Rewarded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants