GithubHelp home page GithubHelp logo

bungle / lua-resty-ada Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 317 KB

LuaJIT FFI bindings to Ada — WHATWG-compliant and fast URL parser

License: BSD 2-Clause "Simplified" License

Lua 98.79% Makefile 0.52% Dockerfile 0.19% CMake 0.50%

lua-resty-ada's Introduction

lua-resty-ada

lua-resty-ada implements a LuaJIT FFI bindings to Ada — WHATWG-compliant and fast URL parser.

Status

This library is considered production ready.

Synopsis

local ada = require("resty.ada")

local url = assert(ada.parse("https://www.7‑Eleven.com:1234/Home/../Privacy/Montréal"))

print(tostring(url))
-- prints: https://www.xn--7eleven-506c.com:1234/Privacy/Montr%C3%A9al

print(tostring(url:clear_port())) -- there are many more methods
-- prints: https://www.xn--7eleven-506c.com/Privacy/Montr%C3%A9al

url:free()
-- explicitly frees the memory without waiting for the garbage collector

-- There is also a static API

print(ada.get_href("https://www.7‑Eleven.com:1234/Home/../Privacy/Montréal"))
-- prints: https://www.xn--7eleven-506c.com:1234/Privacy/Montr%C3%A9al

print(ada.clear_port("https://www.7‑Eleven.com:1234/Home/../Privacy/Montréal"))
-- prints: https://www.xn--7eleven-506c.com/Privacy/Montr%C3%A9al

API

LDoc generated API docs can be viewed at bungle.github.io/lua-resty-ada.

Installation

Using OpenResty Package Manager

❯ opm get bungle/lua-resty-ada

OPM repository for lua-resty-ada is located at opm.openresty.org/package/bungle/lua-resty-ada.

Using LuaRocks

❯ luarocks install lua-resty-ada

LuaRocks repository for lua-resty-ada is located at luarocks.org/modules/bungle/lua-resty-ada.

Building Ada

Please consult Ada on how to build or install the ada library. The Ada library needs to installed in in the system library path or one of the paths in Lua's package.cpath.

This project can also build it by executing (requires cmake):

❯ make build

Or run the test suite with act:

❯ act

License

lua-resty-ada uses two clause BSD license.

Copyright (c) 2024 Aapo Talvensaari, 2024 Guilherme Salazar
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
  list of conditions and the following disclaimer in the documentation and/or
  other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES

lua-resty-ada's People

Contributors

bungle avatar gszr avatar

Stargazers

 avatar Eduardo Dias avatar Adam Fields avatar Andrew Chou avatar Yagiz Nizipli avatar Andrew Johnston avatar Luan Vo avatar zhanglei avatar

Watchers

 avatar

Forkers

zhanglei

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.