Home

Awesome

http-digest

CI Status

Presentation

Small implementation of HTTP Digest Authentication (client-side) in Lua that mimics the API of LuaSocket.

Only supports auth/MD5, no reuse of client nonce, pull requests welcome.

Dependencies

Tests require cwtest, a JSON parser and the availability of httpbingo.org.

Usage

See LuaSocket's http.request. Credentials must be contained in the URL. Both the simple and generic interface are supported. Here is an example with the simple interface:

local http_digest = require "http-digest"
local url = "http://user:passwd@httpbingo.org/digest-auth/auth/user/passwd"
local b, c, h = http_digest.request(url)

See the tests for more.

Other compatible http clients (like Copas or LuaSec) can be used as well. To use another http client replace the default one:

local http_digest = require "http-digest"
http_digest.http = require "copas.http"

Contributors

Copyright