- needs a manpage
Details
- Reviewers
freebsd_igalic.co kevans imp bcr
lua > f.parse_url("http:\\") nil Failed to parse URL > r = f.parse_url("http://localhost/") > for k,v in pairs(r) do; print('\t',k,v); end user scheme http host localhost doc / password > r = f.parse_url("http://user:pass@localhost:1999/rain?beret=raspberry") > for k,v in pairs(r) do; print('\t',k,v); end user user doc /rain?beret=raspberry scheme http host localhost port 1999 password pass > f.get_url("file:///var/run/motd", "/tmp/m") true > f.get_url("http://w3.org/", "/tmp/w") true > f.get_url("https://freebsd.org/", "/tmp/f") true > f.get_url("https://invalid.site/", "/tmp/i") nil Failed to read from URL: No error: 0 > f.get_url("https://wrong.host.badssl.com/", "/tmp/i") SSL certificate subject doesn't match host wrong.host.badssl.com nil Failed to read from URL: Authentication error >
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 51726 Build 48617: arc lint + arc unit
Event Timeline
libexec/flua/modules/lfetch.c | ||
---|---|---|
68 | My gut reaction to this is that we probably shouldn't expose the port at all if it's not explicitly set, just leave it nil in this table to allow for more idiomatic usage where you can simply test the port as truthy before using it.f | |
79 | Brace on its own line | |
83 | This should move up above the blank line | |
91 | IIRC style(9) still doesn't allow declarations mid-block, it would need to be at the top of this function. | |
102 | Leaks file | |
105 | Ditto for these declarations; chunk_size I'd probably just make a #define since we're not going to be altering it | |
113 | Leaks fetch |
clean up free, indentation.
Stop at fetchGet(), because fetchPutHTTP() is sadly not implemented
clean up following review
f.parse_url("http:\\")
nil Failed to parse URL
r = f.parse_url("http://localhost/")
for k,v in pairs(r) do; print('\t',k,v); end
user scheme http host localhost doc / password
r = f.parse_url("http://user:pass@localhost:1999/rain?beret=raspberry")
for k,v in pairs(r) do; print('\t',k,v); end
user user doc /rain?beret=raspberry scheme http host localhost port 1999 password pass
f.get_url("file:///var/run/motd", "/tmp/m")
true
f.get_url("http://w3.org/", "/tmp/w")
true
f.get_url("https://freebsd.org/", "/tmp/f")
true
f.get_url("https://invalid/", "/tmp/i")
nil Failed to read from URL: No error: 0
f.get_url("https://womp.us/", "/tmp/i")
SSL certificate subject doesn't match host womp.us
nil Failed to read from URL: Authentication error
Clean up test formatting.
To Do:
add a manpage.
> f.parse_url("http:\\") nil Failed to parse URL > r = f.parse_url("http://localhost/") > for k,v in pairs(r) do; print('\t',k,v); end user scheme http host localhost doc / password > r = f.parse_url("http://user:pass@localhost:1999/rain?beret=raspberry") > for k,v in pairs(r) do; print('\t',k,v); end user user doc /rain?beret=raspberry scheme http host localhost port 1999 password pass > f.get_url("file:///var/run/motd", "/tmp/m") true > f.get_url("http://w3.org/", "/tmp/w") true > f.get_url("https://freebsd.org/", "/tmp/f") true > f.get_url("https://invalid.site/", "/tmp/i") nil Failed to read from URL: No error: 0 > f.get_url("https://wrong.host.badssl.com/", "/tmp/i") SSL certificate subject doesn't match host wrong.host.badssl.com nil Failed to read from URL: Authentication error >
libexec/flua/modules/lfetch.c | ||
---|---|---|
113 | If I fclose(fetch); here, this segfaults: Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio
fish: Job 1, '/usr/libexec/flua $argv' terminated by signal SIGSEGV (Address boundary error) (lldb) thr backtrace all * thread #1, name = 'flua', stop reason = signal SIGSEGV * frame #0: 0x00001252697ad0f9 frame #1: 0xffadb0abacff9a89 |
libexec/flua/modules/lfetch.c | ||
---|---|---|
113 | The context for this one has changed, the comment was originally down in the error path in the loop. This branch looks fine |
Man page looks good to me. The actual code has to be reviewed/accepted by someone else.