Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
Knot Resolver
Knot Resolver
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 140
    • Issues 140
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 10
    • Merge Requests 10
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Knot projects
  • Knot ResolverKnot Resolver
  • Issues
  • #521

Closed
Open
Opened Nov 15, 2019 by Petr Špaček@pspacekContributor

replace lua-socket depedency with lua-http

At the moment we are using two packages for HTTP requests from Lua:

  • lua-socket (Lua library ssl.https)
  • lua-http (Lua library http)

This complicates packaging and is generally unnecessary.

It seems that package lua-socket (Lua library ssl.https) offers only blocking API, and that is causing problems like e.g. #512 (closed), so let's replace lua-socket with lua-http.

It should "accidentally" fix #512 (closed) and also make packaging easier.

Affected modules:

  • prefill (#512 (closed))
  • trust_anchors bootstrap
  • possibly others

Example of a non-blocking HTTP request:

function blacklist_reload()
	local url = 'https://raw.githubusercontent.com/CSNOG/MFCR-blacklist/master/blacklist.txt'
	local headers, stream = http_request.new_from_uri(uri):go()
	assert(headers, 'HTTP client library error')
	assert(tonumber(headers:get(':status')) == 200,
		string.format('HTTP status %s instead of expected 200\n', headers:get(':status')))
	local tmpfile = stream:get_body_as_file(5)
	assert(tmpfile, 'error while getting blacklist HTTP body in limit 5 seconds')
end
worker.bg_worker.cq:wrap(blacklist_reload)

Error handling needs more work etc.

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
5.0.0
Milestone
5.0.0
Assign milestone
Time tracking
None
Due date
None
Reference: knot/knot-resolver#521