Luci.http error on latest snapshot

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');
  • Result
/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?

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

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:

2 Likes

Great!

That will be much appreciated. :ok_hand:

I'm busy adding Private PSK support to my system and for that I need the snapshot code which has that functionality now included.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.