Comments (12)
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.
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.
/bounty $50
from zio-http.
💎 $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.
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.
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.
@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.
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.
@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.
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.
/attempt #2238
from zio-http.
💡 @abcpro1 submitted a pull request that claims the bounty. You can visit your org dashboard to reward.
from zio-http.
🎉🎈 @abcpro1 has been awarded $50! 🎈🎊
from zio-http.
Related Issues (20)
- Compilation bug when using `disableAutoTrace` and `ZLayer.makeSome` in Scala 3
- Why is warning header added by default? HOT 1
- UserAgent regex broken in ScalaJS HOT 8
- ScalaJS tests are not catching errors
- JsonSchema.fromZSchemaMulti Fails for Sequences of Custom Types in Primitive Formats HOT 1
- Tags for Endpoint API
- Use `@description` zio-schema annotation at types for generating OpenAPI docs HOT 2
- Netty pipeline errors cannot be observed by middleware
- 3.0.0-RC5 References -SNAPSHOT Deps HOT 2
- Decide using Endpoint codec in client based on status code
- Route parameter names and types can result in routing ambiguities despite parameter arity
- Enums May not Be as Expected by OAS 3.x
- Support for Streaming of Data Part of Multipart Form Fields
- Websockets fail on too early messages
- Header.Authorization.Unparsed with empty authScheme cause code to hang forever
- "Multipart Content Without Name Error" When Adding Swagger Routes
- Endpoint API: Support `octet-stream` Media-type For Multipart Form Fields
- Endpoint API: `Endpoint#outCodec` Doesn't Respect The Specified `HeaderCodec`
- Endpoint API: Java ClassCastException when Using ZIO HTTP Streaming HOT 4
- OpenAPI Path Gen should support valid paths that contain a period HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zio-http.