Commit graph

5 commits

Author SHA1 Message Date
Jo-Philipp Wich
b4594b3d11 luci-base: http.uc: fix eof detection in temporary upload files
Binary string comparisons in ucode are currently unsafe, so use the
`length()` function to determine the just read data chunk size in
order to test for end of file.

Fixes: #6530
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-21 16:37:11 +02:00
Tianling Shen
588c6a1e4b luci-base: http.uc: fix reference error of undeclared variable err
The variable `err` was used without initialized.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-04-14 10:50:02 +03:00
Jo-Philipp Wich
e7afd0d327 luci-base: fix luci.http.close()
Ensure that `http.write()` or template rendering operations after a call
to `http.close()` do not produce additional output. This is required for
certain legacy Lua apps which invoke write and close operations in the
middle of a server side cbi rendering process.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-03 00:38:00 +01:00
Jo-Philipp Wich
d967bbaa92 luci-base: http.uc: fix invoking Lua file upload callbacks
In case a callback is installed from Lua code, the received callback
argument is not a callable function but a resource object with a call
method. Attempts to call it will leading to a `Type error: left-hand
side is not a function` error.

To solve this issue, invoke the internally set filehandler instead
which wraps the resource if needed.

Fixes: #6067
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-02 09:08:16 +01:00
Jo-Philipp Wich
673f38246a treewide: separate Lua runtime resources
Move classes required for Lua runtime support into a new `luci-lua-runtime`
package. Also replace the `luci.http` and `luci.util` classes in
`luci-lib-base` with stubbed versions interacting with the ucode based
runtime environment.

Finally merge `luci-base-ucode` into the remainders of `luci-base`.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25 01:03:37 +02:00
Renamed from modules/luci-base-ucode/ucode/http.uc (Browse further)