summaryrefslogtreecommitdiffhomepage
path: root/libs
AgeCommit message (Collapse)Author
2018-12-11luci-lib-httpclient: prevent nil access with invalid IP address literalsJo-Philipp Wich
Fixes: a54baf7be ("luci-lib-httpclient: revamp URL handling") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-11luci-lib-httpclient: revamp URL handlingJo-Philipp Wich
- Introduce a parse_url() helper which properly deals with literal IPv4 and IPv6 host parts and returns the decomposed uri string as table - Properly format IPv6 literals in autogenerated Host headers - Omit default port numbers in Host headers and calculated redirect URLs. Supersedes PR #2337. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14luci-lib-ipkg: move out of luci-baseJo-Philipp Wich
Move the old luci.model.ipkg utility class into a separate package and let the components using it depend on the new library package. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-11luci-lib-iptparser: fix packagingJo-Philipp Wich
The previous commit omitted a subdirectory. Fixes: 94323a61e ("luci-base: move luci.sys.iptparser into separate package") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10Merge pull request #2197 from yangfl/masterHannu Nyman
treewide: Fix typos in comments
2018-10-10luci-base: move luci.sys.iptparser into separate packageJo-Philipp Wich
Since commit f6bfac211 ("luci-mod-status: rework iptables status page"), nothing in luci-base depends on the iptparser class anymore, so fold it out into a separate package and let the few apps that require it depend on the new library package. Saves about 10K uncompressed in luci-base while the iptables status rework enlarged the markup by roughly 5KB, saving roughly 5KB of size overall. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10treewide: Fix typos in commentsyangfl
Signed-off-by: David Yang <mmyangfl@gmail.com>
2018-09-27restored nixio tls providersSophana KOK
Signed-off-by: Sophana KOK <ml-github@worldspot.net>
2018-07-03Revert "luci-lib-json: depend on luci-base"Jo-Philipp Wich
This reverts commit 8ca29efec862350d8d621235999947c329dfaba7.
2018-07-03luci-lib-json: depend on luci-baseJo-Philipp Wich
Fixes #506 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-18luci-lib-json: support serializing userdataJo-Philipp Wich
Fixes the following error when attempting to serialize userdata objects: .../json.lua:81: attempt to call local 'parser' (a nil value) Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18libs: move http.protocol.{date,mime,conditionals} to luci-lib-httpprotoutilsJo-Philipp Wich
Also adjust the dependencies of components depending on these classes and flatten the namespace from luci.http.protocol.* to luci.http.* Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18luci-base: fold luci.http.protocol into luci.httpJo-Philipp Wich
With only the decoder routines remaining in luci.http.protocol, it makes no sense to keep the low level protocol class around, so fold the remaining code into the central luci.http class. Also adjust the few direct users of luci.http.protocol accordingly. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12luci-lib-ip: add MAC address calculation supportJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12luci-lib-nixio: fix spelling mistakes in documentationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-12-28typo: fileystem --> filesystemHannu Nyman
fix typo: sed -i "s/fileystem/filesystem/" Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-07-11rpcd-mod-rrdns: add new rpcd plugin for rapid reverse DNS lookupsJo-Philipp Wich
The plugin provides a new ubus procedure "network.rrdns.lookup" which allows looking up the names of a large chunk of IP addresses at once, within a fixed global timeout. This is useful to have a guaranteed maximum query time even if the local DNS setup is broken or timing out. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-06-13luci-lib-px5g: add license tagQuirin Hofstaetter
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2017-06-13luci-lib-nixio: add license tagQuirin Hofstaetter
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2017-06-13luci-lib-json: add license tagQuirin Hofstaetter
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2017-06-13luci-lib-ip: add license tagQuirin Hofstaetter
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2016-09-16changed stat to lstat in nixio_lstat functionThorsten M
Signed-off-by: Thorsten M. <thoto@devtal.de>
2016-01-15Merge pull request #563 from cshore/pull-request-app-uhttpdJo-Philipp Wich
Pull request app uhttpd
2015-12-15lib-nixio / luci-base: Fix for reading csrf token prevents file uploadDaniel Dickinson
The call to http.formvalue in order to read the csrf token causes _parse_input to be triggered *before* controllers and cbi maps have been built. This results in the failure of file uploads because the file handler is not yet in place when _parse_input gets called, and it is in _parse_input that POST data is parsed (including files). To fix this we add the ability to write file fields to temporary files (using mkstemp and unlink in nixio.file) and use this to store file data until the filehandler is registered, with a fallback to reading the file data into memory. Once the filehandler callback gets registered we iterate though all previously parsed (saved) files and copy the data to the file handler, and then close the temporary file (which finally removes because we unlinked after creating the file, but didn't close the file so unlink was deferred). Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
2015-09-04luci-lib-jsonc: Add ltn12-compatible sink factoryJan-Philipp Litza
To use the luci-lib-jsonc parser as sink for an ltn12 pump (for example from stdin), the following code will now do: require 'luci.ltn12' require 'luci.jsonc' local parser = luci.jsonc.new() luci.ltn12.pump.all(luci.ltn12.source.file(io.input()), parser:sink()) print(parser:get()) Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
2015-09-01luci-lib-ip: fix documentation issueJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-09-01Fix module lines in several luadoc filesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-08-31luci-lib-jsonc: Fix memory leak in stringify()Jan-Philipp Litza
2015-08-30luci-lib-jsonc: allow encoding empty listsJan-Philipp Litza
To be consistent with the behavior of luci-lib-json, an empty Lua table should be encoded to an empty JSON list, not an empty JSON object. To still allow encoding empty JSON objects, the usage of anything other than a number or a string as a key (for example an empty table or a function) can be used to force encoding as an object: json.stringify({}) -- "[]" json.stringify({[{}] = true}) -- "{}" Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
2015-08-30luci-lib-jsonc: Ignore non-string-or-number keys in tablesJan-Philipp Litza
Previously, the following caused a segmentation fault: json.stringify({[{}] = true}) This was caused by lua_tostring() returning NULL for anything but strings and numbers, letting json_object_object_add crash. This patch makes jsonc ignore all keys which have no string representation altogether. Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
2015-07-30luci-lib-nixio: pass exact sockaddr length to getnameinfo()Jo-Philipp Wich
Musl libc requires the length parameter of getnameinfo() to be exactly `sizeof(struct sockaddr_in)` or `sizeof(struct sockaddr_in6)`, depending on the passed sockaddr family. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-06-04luci-lib-json: ignore null keys to allow encoding empty objectsMatthias Schiffer
There is currently no way to encode an empty object {}, as empty tables are encoded as empty lists []. With this patch, encode() will ignore table fields with the key json.null (which doesn't make sense anyways). This allows adding a field with key json.null to force encoding it as an object. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2015-01-29Move inline documentation into separate files.Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28luci-lib-jsonc: add api documentationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28luci-lib-ip: add api documentationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28luci-lib-nixio: move CHANGELOG and README into nixio namespaceJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28luci-lib-ip: add functions to deal with IPv6 mapped IPv6Jo-Philipp Wich
* Add luci.ip.cidr.is6mapped4() to test whether an IPv6 CIDR is a mapped IPv4 one * Add luci.ip.cidr.mapped4() to derive IPv4 from mapped CIDR * Remove mapped IPv4 workaround from constructor as it breaks genuine addrs like ::ffff:0 Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28luci-lib-ip: multiple fixesJo-Philipp Wich
* Fix broken neighbor filtering by address range due to uninitialized memory * Fix wrong sizeof in _cidr_add_sub when adding/substracing IPv6 addresses * Properly convert numeric values to IPv6 addresses Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-26libs: add luci-lib-jsonc, a Lua binding for JSON-CJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-26luci-lib-ip: accept 2nd netmask argument in new(), IPv4() and IPv6()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-25luci-lib-ip: fix segfault in link() on systems with ip6gre supportJo-Philipp Wich
If an ip6gre interface is queried, the resulting link local address string of 47 byte overflowed the buffer of 32 bytes used to hold the translated address. Increase the address string buffer to 48 byte and check the address length prior to writing it into the buffer to avoid future problems with longs link local addresses. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-24luci-lib-ip: fix netlink receiving in link()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-23luci-lib-ip: add link() method to get basic iface infoJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22luci-lib-ip: always return table for dump, even if emptyJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22luci-lib-ip: support filtering neighbors by mac or dest addrJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22luci-lib-ip: fix routes() for non-callback invocationsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22luci-lib-nixio: always assume Linux target (#307)Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22libs: add luci-lib-ipJo-Philipp Wich
Add new luci.ip library which is an api compatible C reimplementation of ip.lua. It also supports dumping the system routing table and neighbour entry database via netlink. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22add params support in optionsYuzo
2015-01-22send Cookie in a single header line, follow browser behaviorYuzo