-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
http: Use GURL as HTTP URL parser utility #10599
Conversation
Use GURL as HTTP URL parser utility. Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Only clang-cl is supported on Windows, see https://crbug.com/988071
Will do |
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
urls = ["https://storage.googleapis.com/quiche-envoy-integration/googleurl_dbf5ad147f60afc125e99db7549402af49a5eae8.tar.gz"], | ||
sha256 = "5bdbecce22d522f03ac86c6a694d5ff76780a16d6d682910e87ac156b0a25b21", | ||
strip_prefix = "googleurl-dbf5ad1", | ||
urls = ["https://github.com/dio/googleurl/archive/dbf5ad1.tar.gz"], |
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.
A temporary fix, since it has a top-level BUILD
file and a build
directory (which is problematic when extracting on mac and windows). I renamed the BUILD
file to BUILD.bazel
, I think removing it is OK.
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 assume can just patch?
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.
Seems like we can't, since it is failing when http_archive
extracting the tarball, it is stopped when trying to extract BUILD
when it saw build
dir is already there. I'm not sure how we can have a patch on the downloaded tarball before extracting.
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.
Probably @danzh2010 could shed some light here.
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.
A temporary fix, since it has a top-level
BUILD
file and abuild
directory (which is problematic when extracting on mac and windows). I renamed theBUILD
file toBUILD.bazel
, I think removing it is OK.
The top level BUILD file is a dummy but needed for the build_config.bzl to setup default copts. But they probably can be moved to a subdirectory instead.
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.
As to build
directory, it is from chromium, so nothing I can do there. What's the exact issue of having it under root directory?
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.
@danzh2010 with the original archive, http_archive
tries to extract BUILD
file while the build
directory is already extracted (the build directory is extracted before the BUILD file from the tarball) and http_archive
throws error. It happens only for systems with case-insensitive filesystem like Windows and macOS.
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.
If I move the top level BUILD file and build_config.bzl to some sub-directory, would it help your case?
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.
Yes! Thanks @danzh2010!
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.
@danzh2010 sorry. Can we still pick this up? (moving the top-level BUILD file sub-directory)
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.
Totally rad. This gets us most of the way to resolving #6588 (once we fold the path normalization into the Url
class).
"url_util.h", | ||
], | ||
copts = build_config.default_copts, | ||
- linkopts = ["-licuuc"], |
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.
Why remove this if we now have icuuc?
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.
Since we depend on "@org_unicode_icuuc//:icuuc"
directly.
constexpr char HTTPS[] = "https"; | ||
#endif | ||
|
||
bool Url::initialize(absl::string_view absolute_url) { |
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.
At some point, can we get rid of https://github.com/envoyproxy/envoy/tree/master/source/common/chromium_url by doing the normalization in this class via GURL?
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 think so yeah.
tags = ["requires-rtti"], | ||
visibility = ["//visibility:private"], | ||
deps = [":headers"], | ||
) |
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.
This is an autoconf dependency, can we just use foreign_cc
to avoid having to hand-maintain a bespoke BUILD file for the project?
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'm testing it, but it seems the build time is significantly increasing.
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.
Interesting, I wonder if it's doing something like building tests or additional libraries. Might be possible to control with some autoconf flags...
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 I have turned off everything (that makes sense, like examples, tests, even tools). And it is tricky to force using msvc (when using configure it tends to use mingw and it is failed at configure stage, and I don't think we want to mix mingw and msvc).
urls = ["https://storage.googleapis.com/quiche-envoy-integration/googleurl_dbf5ad147f60afc125e99db7549402af49a5eae8.tar.gz"], | ||
sha256 = "5bdbecce22d522f03ac86c6a694d5ff76780a16d6d682910e87ac156b0a25b21", | ||
strip_prefix = "googleurl-dbf5ad1", | ||
urls = ["https://github.com/dio/googleurl/archive/dbf5ad1.tar.gz"], |
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 assume can just patch?
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
/azp run envoy-presubmit |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
"string_piece.h", | ||
"string_piece_forward.h", | ||
"string_util.h", | ||
- "string_util_posix.h", |
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.
What's the rationale for this patch to grow larger?
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.
This is for accommodating windows with msvc compiler that we have.
tags = ["requires-rtti"], | ||
visibility = ["//visibility:private"], | ||
deps = [":headers"], | ||
) |
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.
Interesting, I wonder if it's doing something like building tests or additional libraries. Might be possible to control with some autoconf flags...
/azp run envoy-presubmit |
Azure Pipelines successfully started running 1 pipeline(s). |
-#if defined(__clang__) && __has_attribute(uninitialized) | ||
+#if defined(__clang__) | ||
+#if defined(__has_attribute) | ||
+#if __has_attribute(uninitialized) |
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.
Since we put /Za
when compiling on Windows, MSVC's C4067 warning is treated as an error.
cc_library( | ||
name = "strings", | ||
srcs = [ | ||
- "string16.cc", |
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.
string16
doesn't make sense to use on 2-byte wchar_t systems (e.g. Windows).
downstream_headers.setScheme(absolute_url.scheme()); | ||
downstream_headers.setHost(absolute_url.host_and_port()); | ||
downstream_headers.setPath(absolute_url.path_and_query_params()); |
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.
Caught by clang-tidy.
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Hum, the coverage is changed:
Will check. |
/azp run envoy-presubmit |
Azure Pipelines successfully started running 1 pipeline(s). |
😔 The macOS job was canceled. |
@lizan this is me having a bad luck or it is a fact that the macOS build is too long and often cancelled or failed to call RBE? e.g.
|
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
@dio looks like this one went stale, do you recall what the major blockers here were? I'm interested in URI parsing for the URI encoding in https://docs.google.com/document/d/1zZav-IYxMO0mP2A7y5XHBa9v0eXyirw1CxrLLSUqWR8/edit. |
This replaces http_parser's URL parser with GURL.
Risk Level: Medium
Testing: Unit
Docs Changes: N/A
Release Notes: N/A