{"id":13636335,"url":"https://github.com/jamesmarlowe/lua-resty-readurl","last_synced_at":"2025-05-14T18:34:13.167Z","repository":{"id":21821433,"uuid":"25144335","full_name":"jamesmarlowe/lua-resty-readurl","owner":"jamesmarlowe","description":"Lua library for capturing urls, decoding, and logging results","archived":false,"fork":false,"pushed_at":"2014-10-22T23:13:09.000Z","size":172,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-14T17:32:53.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesmarlowe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-13T05:35:38.000Z","updated_at":"2022-02-15T20:47:23.000Z","dependencies_parsed_at":"2022-08-05T13:45:08.940Z","dependency_job_id":null,"html_url":"https://github.com/jamesmarlowe/lua-resty-readurl","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/jamesmarlowe%2Flua-resty-readurl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmarlowe%2Flua-resty-readurl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmarlowe%2Flua-resty-readurl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesmarlowe%2Flua-resty-readurl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesmarlowe","download_url":"https://codeload.github.com/jamesmarlowe/lua-resty-readurl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254202618,"owners_count":22031787,"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":[],"created_at":"2024-08-02T00:01:00.113Z","updated_at":"2025-05-14T18:34:13.064Z","avatar_url":"https://github.com/jamesmarlowe.png","language":"Perl","funding_links":[],"categories":["Libraries","Third Modules","Rust Modules","Perl"],"sub_categories":["C Modules","Lua Modules"],"readme":"Name\n====\n\nlua-resty-readurl - Lua library for capturing urls, decoding, and logging results\n\nTable of Contents\n=================\n\n* [Name](#name)\n* [Status](#status)\n* [Description](#description)\n* [Synopsis](#synopsis)\n* [Methods](#methods)\n    * [capture](#capture)\n* [Limitations](#limitations)\n* [Installation](#installation)\n* [TODO](#todo)\n* [Community](#community)\n    * [English Mailing List](#english-mailing-list)\n    * [Chinese Mailing List](#chinese-mailing-list)\n* [Testing](#testing)\n* [Bugs and Patches](#bugs-and-patches)\n* [Author](#author)\n* [Copyright and License](#copyright-and-license)\n* [See Also](#see-also)\n\nStatus\n======\n\nThis library is still under early development but production ready.\n\nDescription\n===========\n\nThis Lua library for capturing urls, decoding and logging:\n\nSynopsis\n========\n\n```lua\n    lua_package_path \"/path/to/lua-resty-readurl/lib/?.lua;;\";\n\n    server {\n        location /test {\n            content_by_lua '\n                local readurl = require \"resty.readurl\"\n                local response, err = readurl.capture(\"/postgres/proxy/\", {sql=sql}, true, {failure_log_level=ngx.CRIT, success_log_level=ngx.INFO, counter_dict=nginx_logging_dict})\n                ngx.say(response)\n            ';\n        }\n        \n        location /postgres/proxy/ {\n            return 200 \"success\";\n        }\n    }\n```\n\n[Back to TOC](#table-of-contents)\n\nMethods\n=======\n\nAll of the commands return either something that evaluates to true on success, or `nil` and an error message on failure.\n\ncapture\n-------\n`syntax: response, err = readurl.capture(url, url_arguments, decode, log_table)`\n`syntax: response, err = readurl.capture(\"/postgres/proxy/\", {sql=sql}, true, {failure_log_level=ngx.CRIT, success_log_level=ngx.INFO, counter_dict=nginx_logging_dict})`\n\nIn case of success, returns the response of the location. In case of errors, returns `nil` with a string describing the error.\n\n[Back to TOC](#table-of-contents)\n\nLimitations\n===========\n\n[Back to TOC](#table-of-contents)\n\nInstallation\n============\nYou can install it with luarocks `luarocks install lua-resty-readurl`\n\nOtherwise you need to configure the lua_package_path directive to add the path of your lua-resty-readurl source tree to ngx_lua's LUA_PATH search path, as in\n\n```nginx\n    # nginx.conf\n    http {\n        lua_package_path \"/path/to/lua-resty-readurl/lib/?.lua;;\";\n        ...\n    }\n```\n\nThis package also requires the lua-cjson package to be installed\n\nEnsure that the system account running your Nginx ''worker'' proceses have\nenough permission to read the `.lua` file.\n\nTODO\n====\n\n[Back to TOC](#table-of-contents)\n\nCommunity\n=========\n\n[Back to TOC](#table-of-contents)\n\nEnglish Mailing List\n--------------------\n\nThe [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers.\n\n[Back to TOC](#table-of-contents)\n\nChinese Mailing List\n--------------------\n\nThe [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers.\n\n[Back to TOC](#table-of-contents)\n\nTesting\n=======\n\nRunning the tests in t/ is simple once you know whats happening. They use perl's prove and agentzh's test-nginx.\n\n```\nsudo apt-get install perl build-essential curl\nsudo cpan Test::Nginx\nmkdir -p ~/work \ncd ~/work \ngit clone https://github.com/agentzh/test-nginx.git \ncd /path/to/lua-resty-readurl/\nmake test #assumes openresty installed to /usr/bin/openresty/\n```\n\n[Back to TOC](#table-of-contents)\n\nBugs and Patches\n================\n\nPlease report bugs or submit patches by\n\n1. creating a ticket on the [GitHub Issue Tracker](http://github.com/jamesmarlowe/lua-resty-readurl/issues),\n\n[Back to TOC](#table-of-contents)\n\nAuthor\n======\n\nJames Marlowe \"jamesmarlowe\" \u003cjameskmarlowe@gmail.com\u003e, Lumate LLC.\n\n[Back to TOC](#table-of-contents)\n\nCopyright and License\n=====================\n\nThis module is licensed under the BSD license.\n\nCopyright (C) 2012-2014, by James Marlowe (jamesmarlowe) \u003cjameskmarlowe@gmail.com\u003e, Lumate LLC.\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n[Back to TOC](#table-of-contents)\n\nSee Also\n========\n* the ngx_lua module: http://wiki.nginx.org/HttpLuaModule\n\n[Back to TOC](#table-of-contents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesmarlowe%2Flua-resty-readurl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesmarlowe%2Flua-resty-readurl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesmarlowe%2Flua-resty-readurl/lists"}