{"id":42485119,"url":"https://github.com/mah0x211/lua-net-http","last_synced_at":"2026-01-28T11:26:17.338Z","repository":{"id":38701029,"uuid":"99530744","full_name":"mah0x211/lua-net-http","owner":"mah0x211","description":"http module for lua","archived":false,"fork":false,"pushed_at":"2025-12-29T01:06:41.000Z","size":512,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-31T04:32:00.353Z","etag":null,"topics":["client","http","lua","network","server"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mah0x211.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-08-07T02:56:39.000Z","updated_at":"2025-12-28T15:33:24.000Z","dependencies_parsed_at":"2025-12-20T05:02:37.258Z","dependency_job_id":null,"html_url":"https://github.com/mah0x211/lua-net-http","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/mah0x211/lua-net-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mah0x211%2Flua-net-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mah0x211%2Flua-net-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mah0x211%2Flua-net-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mah0x211%2Flua-net-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mah0x211","download_url":"https://codeload.github.com/mah0x211/lua-net-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mah0x211%2Flua-net-http/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28845086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","http","lua","network","server"],"created_at":"2026-01-28T11:26:12.159Z","updated_at":"2026-01-28T11:26:17.333Z","avatar_url":"https://github.com/mah0x211.png","language":"Lua","readme":"lua-net-http\n====\n\n[![test](https://github.com/mah0x211/lua-net-http/actions/workflows/test.yml/badge.svg)](https://github.com/mah0x211/lua-net-http/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/mah0x211/lua-net-http/branch/master/graph/badge.svg)](https://codecov.io/gh/mah0x211/lua-net-http)\n\nhttp module for lua.\n\n**NOTE: this module is under heavy development.**\n\n\n***\n\n\n## Installation\n\n```\nluarocks install net-http\n```\n\n\n## Usage\n\n\n### Server\n\n```lua\nlocal format = string.format\nlocal server = require('net.http.server')\nlocal responder = require('net.http.responder')\n\n-- create server with SO_REUSEADDR option\nlocal s = server.new('127.0.0.1:8080', {\n    reuseaddr = true,\n})\ns:listen()\n\nlocal conn = s:accept()\nlocal req = conn:read_request()\n-- dump request\nprint('REQUEST ===')\nprint(format('%s %s HTTP/%.1f', req.method, req.uri, req.version))\nfor _, k, v in req.header:pairs() do\n    print(format('%s: %s', k, v))\nend\nprint('')\nlocal content = req.content:read()\nprint(content)\nprint('')\n\n-- reply response\nlocal res = responder.new(conn)\nres.header:set('content-type', 'text/plain')\nres:ok('reply ' .. (content or '') .. '\\n')\nres:flush()\nconn:close()\n\n-- $ lua ./server.lua\n-- REQUEST ===\n-- GET / HTTP/1.1\n-- User-Agent: lua-net-http\n-- Content-Length: 11\n-- Content-Type: application/octet-stream\n-- Host: 127.0.0.1:8080\n--\n-- foo/bar/baz\n```\n\n### Client\n\n```lua\nlocal format = string.format\nlocal fetch = require('net.http.fetch')\n\n-- request to server\nlocal res = fetch('http://127.0.0.1:8080', {\n    content = 'foo/bar/baz',\n})\n-- dump response\nprint('RESPONSE ===')\nprint(format('HTTP/%.1f %d %s', res.version, res.status, res.reason))\nfor _, k, v in res.header:pairs() do\n    print(format('%s: %s', k, v))\nend\nprint('')\nprint(res.content:read())\nprint('')\n\n-- $ lua ./client.lua\n-- RESPONSE ===\n-- HTTP/1.1 200 OK\n-- Content-Length: 17\n-- Content-Type: application/octet-stream\n-- Date: Thu, 02 Jun 2022 23:48:17 GMT\n--\n-- reply foo/bar/baz\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmah0x211%2Flua-net-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmah0x211%2Flua-net-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmah0x211%2Flua-net-http/lists"}