Hi,
I've did a fresh built from master and included Luci with the following packages:
liblucihttp-lua - 2022-07-08-6e68a106-1
liblucihttp-ucode - 2022-07-08-6e68a106-1
liblucihttp0 - 2022-07-08-6e68a106-1
luci - git-22.297.83017-0143ef2
luci-app-attendedsysupgrade - git-22.285.67526-18bfcca
luci-app-firewall - git-22.089.67453-0eb3aeb
luci-app-opkg - git-22.273.28779-84ba6a5
luci-base - git-22.307.37672-0dd0114
luci-compat - git-22.297.83017-673f382
luci-lib-base - git-22.297.83017-cea2c35
luci-lib-httpclient - git-20.201.65662-8b8d83e
luci-lib-httpprotoutils - git-20.201.65662-8b8d83e
luci-lib-ip - git-20.250.76529-62505bd
luci-lib-json - git-18.184.37844-cde13dc
luci-lib-jsonc - git-22.079.54693-45f411b
luci-lib-nixio - git-22.222.71555-88b9088
luci-lua-runtime - git-22.299.72136-a98e2ea
luci-mod-admin-full - git-19.253.48496-3f93650
luci-mod-network - git-22.301.32567-1d157d3
luci-mod-status - git-22.297.83017-97da0ba
luci-mod-system - git-22.297.83017-f478fe6
luci-proto-ipv6 - git-21.148.48881-79947af
luci-proto-ppp - git-21.158.38888-88b9d84
luci-theme-bootstrap - git-22.297.83017-2e3282e
luci-theme-material - git-22.300.33292-bd4bf6a
When I try to use the luci.http mudule I get the following error:
One liner test script (t.lua)
#!/usr/bin/lua
require('luci.http');
/usr/bin/lua: /usr/lib/lua/luci/http.lua:143: attempt to index local 'L' (a nil value)
stack traceback:
/usr/lib/lua/luci/http.lua:143: in main chunk
[C]: in function 'require'
./t.lua:3: in main chunk
[C]: ?
Any advice?
jow
November 4, 2022, 2:41pm
2
Yes, this is expected as it does not work in a standalone manner anymore. What are you trying to use it for?
Thanks for the quick response.
It looks like I just use it once in my library (Add on to OpenWrt) to build a query string
local enc_string = luci.http.build_querystring(q_s);
enc_string = self:_urlencode(enc_string);
self:log('QS '..enc_string..'END')
url = url..enc_string;
self:log('URL is '..url..'END')
So I should be able to look for an alternative that can built the query string
jow
November 4, 2022, 3:03pm
4
No, I guess this is fine. I got a similar inquiry recently so I wondered what people require the library for, and it seems it is for the encoding routines, so I'll rework the lib to ensure that those continue to function.
@DirkVanDerWalt - fixed with the following commit:
committed 03:10PM - 04 Nov 22 UTC
Various existing Lua software is requiring the `luci.http` library for
URL encod… ing/decoding tasks so ensure that it can be loaded in a stand
alone manner even if the emulated Lua runtime environment is not
available.
Fixes: cea2c3578e ("luci-lib-base: forward luci.http.context.request.message to ucode")
Ref: https://forum.openwrt.org/t/x/141817
Ref: https://github.com/openwrt/luci/pull/5976#issuecomment-1296220586
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 Likes
Great!
That will be much appreciated.
I'm busy adding Private PSK support to my system and for that I need the snapshot code which has that functionality now included.
system
Closed
November 28, 2022, 2:52pm
6
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.