-
Notifications
You must be signed in to change notification settings - Fork 323
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
Improving tests and edge cases for URI and HTTP #8497
Conversation
8cd5c51
to
9a11fc7
Compare
20966e9
to
3d6856b
Compare
…ix for a bug converting URI_With_Query->URI
…eries instead of rolling our own logic, pt.1
This reverts commit 4a13f3d.
…ndlers; fixed the auth tests
3d6856b
to
f951403
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not convinced adding 3rd party dependency to the std-base
is a good idea.
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, | ||
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" | ||
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, | ||
"org.apache.httpcomponents" % "httpclient" % httpComponentsVersion, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we adding dependency on an external library to std-base
just be able to emit HTTP request? What's wrong with JDK only solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are still using JDK's httpclient for the requests (see EnsoSecretHelper.java
).
The functionality that was missing was the URIBuilder
that allows us to build a set of query parameters and correctly encode them. The task is not trivial as it requires escaping of various control characters depending on context (sometimes =
sometimes not, &
etc.) as well as escaping non-standard Unicode symbols.
We had our own simple implementation but it was missing functionalities.
Instead of trying to understand the RFC 3986 and trying to carefully implement and test that we are doing everything according to the specification, I thought it will be far simpler to use an existing solution.
If that ever turns out to be problematic, we could roll our own - but it seems like an overkill if an existing solution exists.
Note that in subsequent PRs (#8544) I plan to extend using this functionality. The URIBuilder
allows us to easily parse the existing query and modify it in any way we need, as well as it allows us to parse and modify the URI path and all the other components. The JDK provides only very limited funcionality for that (e.g. we don't get the parsing of the query arugments that we need to be able to manipulate them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is URLEncoder which has been good enough for all my purposes so far.
I continue to be convinced that
adding dependency on (another) external library to
std-base
isn't good idea.
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.util.List; | ||
import org.apache.http.client.utils.URIBuilder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is similar builder in the JDK as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is it similar?
This is a HttpClient.Builder, I cannot see any capabilities for building an URI with it.
how did I miss it?? :O
- After [suggestion](#8497 (comment)) from @JaroslavTulach I have tried reimplementing the URL encoding using just `URLEncode` builtin util. I will see if this does not complicate other followup improvements, but most likely all should work so we should be able to get rid of the unnecessary bloat.
Pull Request Description
Proposed fix forcase of
integer matching does not work correctly for larger numbers #8493case of
integer matching does not work correctly for larger numbers #8493 to the engine team.Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.