{"id":18567123,"url":"https://github.com/diovisgood/luaweb","last_synced_at":"2025-05-15T20:09:15.771Z","repository":{"id":75449174,"uuid":"133352522","full_name":"diovisgood/luaweb","owner":"diovisgood","description":"HTTP and HTTPS simple browser for Lua","archived":false,"fork":false,"pushed_at":"2018-11-25T08:57:40.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T13:28:57.968Z","etag":null,"topics":["http","https","lua","requests-html","web"],"latest_commit_sha":null,"homepage":null,"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/diovisgood.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}},"created_at":"2018-05-14T11:46:53.000Z","updated_at":"2022-07-18T00:55:56.000Z","dependencies_parsed_at":"2023-02-27T23:15:32.852Z","dependency_job_id":null,"html_url":"https://github.com/diovisgood/luaweb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diovisgood%2Fluaweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diovisgood%2Fluaweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diovisgood%2Fluaweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diovisgood%2Fluaweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diovisgood","download_url":"https://codeload.github.com/diovisgood/luaweb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414503,"owners_count":22067272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["http","https","lua","requests-html","web"],"created_at":"2024-11-06T22:25:31.686Z","updated_at":"2025-05-15T20:09:10.744Z","avatar_url":"https://github.com/diovisgood.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# luaweb\nHTTP and HTTPS simple browser for Lua\n\nCopyright (C) 2018 Pavel B. Chernov (pavel.b.chernov@gmail.com)\n\n## LICENSE (MIT):\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Benefits\n- Supports both HTTP and HTTPS connections.\n- Supports redirects. You can adjust max redirects.\n- Supports Proxy for both HTTP (via *GET*) and HTTPS (via *CONNECT*).\n- Supports *basic* authentication method for servers and proxies.\n- Supports persistent connections (i.e. 'Connection: keep-alive').\n- Transparently manages a pool of recently used connections. Reuses old or recreates new connections on the fly.\n- Offers quick functions: *web.head*, *web.get*, *web.post*, *web.put* and *web.delete* for simple and robust work.\n- Allows low-level access via *web.getConnection*, *web.call* and *web.request* to implement any desired task.\n- Supports logging into specified file for debugging.\n\n# Usage\n\n## Simple GET request\n\n  ```\n  local web = require 'web'\n  local result, code, headers, status = assert( web.get('https://ya.ru/') )\n  print(tostring(result):sub(1, 100))\n  ```\n\n## Simple POST request\n\n  ```\n  local body = 'Some text'\n  result, code, headers, status = assert( web.post('https://ya.ru/', body) )\n  print(tostring(result):sub(1, 100))\n  ```\n  \n## Simple PUT request\n\n  ```\n  local body = 'Some text'\n  result, code, headers, status = assert( web.put('https://ya.ru/file1.txt', body) )\n  print(tostring(result):sub(1, 100))\n  ```\n  \n## Simple DELETE request\n\n  ```\n  local body = 'Some text'\n  result, code, headers, status = assert( web.delete('https://ya.ru/file1.txt') )\n  print(tostring(result):sub(1, 100))\n  ```\n\n## HTTP Through Proxy\n\n  ```\n  web.PROXY = 'https://92.53.73.138:8118' -- This line should be changed. Please specify any working proxy!\n  result, code, headers, status = assert( web.get('http://bbc.com/') )\n  print(tostring(result):sub(1, 100))\n  ```\n\n## HTTPS Through Proxy via CONNECT\n\n  ```\n  web.PROXY = 'https://92.53.73.138:8118' -- This line should be changed. Please specify any working proxy!\n  result, code, headers, status = assert( web.get('https://ya.ru/') )\n  print(tostring(result):sub(1, 100))\n  ```\n\n## Low Level Non-standard Request Headers via *web.call*\n\nIn the following example we perform a special POST request with non-standard HTTP headers *Key* and *Sign*.\nNote that you may specify any headers you want. If you specify some standard headers (like *User-Agent:*) - they\nwill override default headers.\nWhereas non-standard headers are just added \"as is\".\n  ```\n  -- Construct message\n  poloniex.nonce = (poloniex.nonce or 0) + 1\n  local msg = 'command=returnCompleteBalances\u0026nonce='..tostring(poloniex.nonce)\n  \n  -- Construct headers\n  local request_headers = {\n    Key = poloniex.public_key,\n    Sign = sha1.hmac(poloniex.secret_key, msg),\n  }\n  -- Perform Web request\n  -- Check returned body and code\n  result, code, headers, status =\n    web.call('POST', url, msg, request_headers)\n  if (not result) or (code ~= 200) then return nil, errorMsg(url, result, code, headers, status) end\n  ```\n\n## SSL/TLS with manual parameters\n\n  *web.SSL* table holds default parametes for luasec. By default it does not verify cerificates (*verify = none*). But you may change these parameters directly to what you need:\n  \n  ```\n  web.SSL.key = \"/root/client.key\"\n  web.SSL.certificate = \"/root/client.crt\"\n  web.SSL.cafile = \"/root/ca.crt\"\n  web.SSL.verify = 'peer'\n  \n  result, code, headers, status = assert( web.get('https://server-with-certificate.com/') )\n  print(tostring(result):sub(1, 100))\n  ```\n\nSee: https://github.com/brunoos/luasec/wiki/LuaSec-0.7 for more details about SSL/TLS parameters.\nIn most cases you may end up with following. Download *cacert.pem* from Mozilla http://curl.haxx.se/ca/cacert.pem which contains root certificates of most well known certificate authorities and use it as follows:\n  ```\n  web.SSL.cafile = \"/path/to/cacert.pem\"\n  web.SSL.verify = 'peer'\n  ```\n\n## Adjusting Parameters\n\n  ```\n  web.TIMEOUT = 60                -- Adjust default connection timeout.\n  web.MAX_REDIRECTS = 5           -- Maximum number of redirects to follow.\n  web.USERAGENT = socket._VERSION -- Setup any string for User-Agent header.\n  web.SSL = { ... }               -- Setup any LuaSec fields and certificates.\n  ```\n\n## Logging for Debug\n\n  ```\n  -- Enable logging to stdout\n  web.logfile = io.stdout\n  result, code, headers, status = assert( web.get('https://ya.ru/') )\n  print(tostring(result):sub(1, 100))\n  ```\nYou see the following output:\n  ```\nweb.request GET https://ya.ru/\nweb.getConnection https://ya.ru:443\nGET /\nHTTP/1.1 200 Ok\n\u003c!DOCTYPE html\u003e\u003chtml class=\"i-ua_js_no i-ua_css_st...\n  ```\n\n\n# Implementation Notes\n\nThis module has not been heavily tested. At the end of module you may find unit tests and many of them aren't written yet!\nAny help or comments are appreciated!\n\nHere is what could be added to make it better:\n- LuaRocks support.\n- Simple cookies support.\n- Digest authentication method.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiovisgood%2Fluaweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiovisgood%2Fluaweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiovisgood%2Fluaweb/lists"}