Omar Polo
35744950aa
simplify handle_cgi
...
Now that I got rid of the enum+switch, adding more state is easier.
Before, we used an hack to remember if we had read the CGI reply or
not (c->code = -1).
This introduces a new state, handle_cgi_reply that reads the CGI
script reply, logs it, and only then switches to handle_cgi.
handle_cgi itself is cleaner, now it only reads into c->sbuf and send
what it had red.
We even get, almost for free, the 42 error. If read exists with -1 or
0 from in handle_cgi_reply, we return a proper error to the client.
We can extend this further in the future and also try to validate the
CGI reply (for now we're only looking for a \n).
2021-02-01 22:04:51 +00:00
Omar Polo
b06f80cdf4
switch to handle_open_conn right after handshake
...
So we don't re-enter the handle_handsahke and re-do the loop on
fnmatch etc. This way, once we're successfully past the handshake,
we'll re-enter no handle_open_conn.
2021-02-01 20:27:08 +00:00
Omar Polo
92da82858b
document the DFA
2021-02-01 20:24:14 +00:00
Omar Polo
112802ea31
client state machine: function pointers instead of enum+switch
2021-02-01 20:00:33 +00:00
Omar Polo
1e7591a922
parse_err is a const pointer
2021-02-01 19:58:04 +00:00
Omar Polo
ad58806e30
drop unused target iri_test
2021-02-01 19:30:55 +00:00
Omar Polo
d5f4d615cf
generate compile_flags for clangd
2021-02-01 19:30:38 +00:00
Omar Polo
3e5418099f
[cgi] always set some variables
2021-02-01 13:48:23 +00:00
Omar Polo
ee655e64d7
sync CGI section with actual implementation
2021-02-01 13:19:06 +00:00
Omar Polo
38f8a798b1
mention v1.5
2021-02-01 12:30:34 +00:00
Omar Polo
67528c1f82
don't add the query to argv
...
FRC3875 says that if the query does not contain any unecnoded "="
characters, we SHOULD treat the query string as a "search-string",
split in on "+" and add every word to the CGI argv.
In launch_cgi it's too late because iri->query is the *decoded* query!
I have in mind some refactoring around how we decode things, so this
is postponed.
2021-02-01 12:28:30 +00:00
Omar Polo
2fafa2d23e
bring the CGI implementation in par with GLV-1.12556
2021-02-01 11:11:43 +00:00
Omar Polo
e17642a7bb
require absolute paths in config file
2021-02-01 11:08:57 +00:00
Omar Polo
bcf5d929e6
ensure absolute paths in config-less mode
2021-02-01 11:07:57 +00:00
Omar Polo
6ff23c6739
use absolute paths in the regression suite
2021-02-01 11:04:21 +00:00
Omar Polo
7808978667
fix computed offset
...
Oh my, this is such a stupid mistake. It went undiscovered only
because I always used CGI scripts on the first vhost (and hence the
offset would be 0) and never on the others.
2021-02-01 08:38:48 +00:00
Omar Polo
57d0d0adba
ensure iri.host isn't NULL
2021-01-31 11:50:01 +00:00
Omar Polo
ee29b5a63b
sync
2021-01-31 11:09:15 +00:00
Omar Polo
8503a1431d
set cloexec status on the socketpair fds
...
the executor forks to spawn the cgi scripts, and they inherit the
socket for communication with the listener process. Make that
impossible.
2021-01-31 11:07:12 +00:00
Omar Polo
91d7870bb7
typo
2021-01-30 14:38:32 +00:00
Omar Polo
1b246dbd3c
remove unused target
...
"test" was replaced by "regress" a while ago
2021-01-30 14:37:57 +00:00
Omar Polo
39a7b61145
sync date
2021-01-30 12:16:18 +00:00
Omar Polo
e99923477a
sync
2021-01-30 12:13:49 +00:00
Omar Polo
b59f3cdd27
typo
2021-01-30 12:12:37 +00:00
Omar Polo
6016a593a3
invert the location precedence: first match wins
...
It's how httpd(8) does it, and it allows us to call fnmatch less time
2021-01-30 12:04:20 +00:00
Omar Polo
601bc1cc37
readme updates
2021-01-30 11:49:48 +00:00
Omar Polo
714685c10c
manpage improvements
2021-01-30 11:49:27 +00:00
Omar Polo
e7c7f19c4e
more IRI tests
...
ensure non-encoded and pct-encoded hostnames are parsed correctly
2021-01-29 18:52:36 +00:00
Omar Polo
cef60084e6
fix puny-test build
2021-01-29 18:51:35 +00:00
Omar Polo
dceca3b69d
sync
2021-01-29 17:29:21 +00:00
Omar Polo
a8d4a89770
don't ignore punycode errors when decoding SNI-provided servname
2021-01-29 17:29:14 +00:00
Omar Polo
4a3ab60928
const-ify var + missing argument
2021-01-29 17:26:56 +00:00
Omar Polo
117ac52cdd
accept a wider range of UNICODE codepoints while parsing hostnames
2021-01-29 17:26:23 +00:00
Omar Polo
a2fd801327
puny_decode: set an error string
2021-01-29 17:11:03 +00:00
Omar Polo
22a742e4cb
typo
2021-01-29 17:07:26 +00:00
Omar Polo
32693ee6db
include string.h
...
openbsd and freebsd yacc include string.h in the generated sources,
bison (tested on alpine at least) don't
2021-01-28 17:50:22 +00:00
Omar Polo
415ac7a229
fix build
2021-01-28 16:33:20 +00:00
Omar Polo
75fbb1789e
manual improvements & add section about MIME
2021-01-28 16:29:06 +00:00
Omar Polo
90cb9eea8a
don't log the SNI & matching
...
I'll re-enable this when i'll improve the logging
2021-01-28 16:28:44 +00:00
Omar Polo
8ef09de3d0
don't include err.h, gmid.h (via config.h) does that
2021-01-28 16:28:10 +00:00
Omar Polo
cbeee4cad1
warn about punycode in server definition
2021-01-28 16:27:40 +00:00
Omar Polo
9a672b3712
legibility: use p[n] instead of (*(p + n))
2021-01-28 16:26:49 +00:00
Omar Polo
35cf19e3f3
punycode: refactoring
...
use the correct term "label" instead of "component" when speaking
about the parts of a hostname. Also, fix the sizes for max hostname
and label.
2021-01-28 16:25:59 +00:00
Omar Polo
473e4531d5
delete unused constant
2021-01-28 16:24:48 +00:00
Omar Polo
d2b941f34b
correct copyright date
2021-01-28 16:24:03 +00:00
Omar Polo
ef0f2ae88c
remove unused function
2021-01-28 14:21:57 +00:00
Omar Polo
8904fa0e64
-v for verbose logging
2021-01-27 23:14:16 +00:00
Omar Polo
08a2fee055
the daemon option was removed
2021-01-27 17:02:45 +00:00
Omar Polo
747f13af33
add certificate generation in features list
2021-01-27 16:59:54 +00:00
Omar Polo
13ed2fb63f
improve configuration parsing error
2021-01-27 16:45:45 +00:00