Coder Social home page Coder Social logo

Comments (12)

aappddeevv avatar aappddeevv commented on August 11, 2024 1

Good catch. The query parameters follow a '?' per the http spec so my example that I typed in by hand may have been mistyped or the machine generated URL from a commercial server (not mine) that was being used was bad...let me check.

from zio-http.

aappddeevv avatar aappddeevv commented on August 11, 2024 1

Typo in my example on my part...fixed the text above.

Maybe the issue is that the rendering of the URL in the the layer that translates it to the execution engine (e.g. netty) does not handle Path.empty correctly.

from zio-http.

jdegoes avatar jdegoes commented on August 11, 2024

/bounty $50

from zio-http.

algora-pbc avatar algora-pbc commented on August 11, 2024

💎 $50 bounty created by jdegoes
🙋 If you start working on this, comment /attempt #2238 to notify everyone
👉 To claim this bounty, submit a pull request that includes the text /claim #2238 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country
💵 Payment arrives in your account 2-5 days after the bounty is rewarded
💯 You keep 100% of the bounty award
🙏 Thank you for contributing to zio/zio-http!

Attempt Started Solution
🟢 @abcpro1 Jun 19, 2023 #2271

from zio-http.

Vivek7038 avatar Vivek7038 commented on August 11, 2024

can you suggest me the fix i should do , i can instatly fix . what should be the url?
just want some clarity on these

from zio-http.

vigoo avatar vigoo commented on August 11, 2024

Seems like java.net.URI's parser which this relies on cannot parse this properly - it treats everything after the scheme as the authority. So if we want to fix this we need to write our own URL parser.

from zio-http.

de-laz avatar de-laz commented on August 11, 2024

@vigoo @aappddeevv I don't really have enough context on this issue but shouldn't the given example be val url = URL.decode("https://blah.com?m=1&k=4") instead of val url = URL.decode("https://blah.com&m=1&k=4")? The domain and parameters are separated by an "&" instead of "?", not sure if that's important.

from zio-http.

aappddeevv avatar aappddeevv commented on August 11, 2024

I'm concerned that there may be other factors that affected the issue I had and the resolution, this small scala-cli program seems to give the error I would expect given that the query params are invalid, but it shows that the call goes out as expected although it does not work if I use https but that seems to be another matter.

//> using dep dev.zio::zio-http:3.0.0-RC2
//> using scala 3.3.0

import zio.*
import zio.http.*

val program = for {
  res <- Client.request("http://www.google.com?blah=hah&hah=blah")
  data <- res.body.asString
  _ <- Console.printLine(data)
} yield ()

object Main extends ZIOAppDefault:
  def run =
    program
      .provide(
        Client.default,
      )

from zio-http.

vigoo avatar vigoo commented on August 11, 2024

@de-laz good catch :) with the fixed string decoding/encoding this works:

          val url = "https://blah.com?m=1&k=4"
          assertTrue(URL.decode(url).map(_.encode) == Right(url))

The above example sends the expected HTTP request to google.
image

and it responds with a 404 with some HTML body.

The URL is good with https too.
First when testing with https it seemed like I always get a io.netty.channel.AbstractChannel$AnnotatedNoRouteToHostException but sometimes it worked. Digging into this, I noticed that it depends on which host the DnsResolver picks.

If I always pick the first one it always works with both http and https (the scheme has nothing to do with the dns resolving phase of course). If I pick the last one which is an IPv6 address, it fails.

Is this the same error you got?
Maybe we should filter IPv6 addresses in the DNS resolver?

from zio-http.

abcpro1 avatar abcpro1 commented on August 11, 2024

/attempt #2238

from zio-http.

algora-pbc avatar algora-pbc commented on August 11, 2024

💡 @abcpro1 submitted a pull request that claims the bounty. You can visit your org dashboard to reward.

from zio-http.

algora-pbc avatar algora-pbc commented on August 11, 2024

🎉🎈 @abcpro1 has been awarded $50! 🎈🎊

from zio-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.