-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deps): add ada - whatwg-compliant and fast url parser
### Summary Adds libada and lua-resty-ada as a dependency. This is needed for: #12758 But it may be great for many other uses too. The `lua-resty-ada` LuaJIT FFI bindings can be found here: https://github.com/bungle/lua-resty-ada Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
- Loading branch information
Showing
20 changed files
with
163 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cc_library( | ||
name = "ada-lib", | ||
srcs = ["ada.cpp"], | ||
hdrs = [ | ||
"ada.h", | ||
"ada_c.h", | ||
], | ||
copts = [ | ||
"-std=c++17", | ||
], | ||
linkstatic = True, | ||
) | ||
|
||
cc_shared_library( | ||
name = "ada", | ||
visibility = ["//visibility:public"], | ||
deps = [":ada-lib"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""A module defining the third party dependency Ada""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
load("@kong_bindings//:variables.bzl", "KONG_VAR") | ||
|
||
def ada_repositories(): | ||
"""Defines the ada repository""" | ||
|
||
version = KONG_VAR["ADA"] | ||
|
||
maybe( | ||
http_archive, | ||
name = "ada", | ||
sha256 = KONG_VAR["ADA_SHA256"], | ||
url = "https://github.com/ada-url/ada/releases/download/v" + version + "/singleheader.zip", | ||
type = "zip", | ||
build_file = "//build/openresty/ada:BUILD.bazel", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
message: | | ||
**Core**: Added Ada dependency - WHATWG-compliant and fast URL parser. | ||
type: feature | ||
scope: Core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
local ada = require("resty.ada") | ||
|
||
|
||
local assert = assert | ||
local describe = describe | ||
local it = it | ||
|
||
|
||
local equal = assert.equal | ||
local is_nil = assert.is_nil | ||
local is_table = assert.is_table | ||
|
||
|
||
local function is_err(msg, ok, err) | ||
is_nil(ok) | ||
equal(msg, err) | ||
return ok, err | ||
end | ||
|
||
|
||
describe("Ada", function() | ||
describe("URL", function() | ||
describe(".parse", function() | ||
it("rejects invalid url", function() | ||
is_err("invalid url", ada.parse("<invalid>")) | ||
end) | ||
it("accepts valid url", function() | ||
is_table(ada.parse("http://www.google.com/")) | ||
end) | ||
end) | ||
end) | ||
end) |