Lady [Tue, 18 Mar 2025 04:31:32 +0000 (00:31 -0400)]
Add request parsing and related tests
This commit adds a function for processing a “path info” string, for
example one received through C·G·I (as the `PATH_INFO´ environment
variable), into a structure which represents its semantics,
`cgirls_req´. It also adds a function for reserializing this structure
into a canonical form. The program `cgirls-test-pathinfo´ is used with
the existing test infrastructure to ensure that strings are processed
correctly.
There is a flaw in this design (which I realized after making the
original commit, but before writing this updated message), in that an
empty identifier string is represented as `..´, which in a URL already
has a different, and very normative, meaning of “parent directory”.
This flaw will need to be fixed in a later commit.
Probably some more tests could be added here; in particular only a few
verbs and extensions are being tested right now and ideally they all
would be.
Lady [Tue, 18 Mar 2025 04:01:20 +0000 (00:01 -0400)]
Build testing infrastructure
For the actual testing script, see `sh/test.sh´, but note the following
details :—
• The file `cgirls.h´ has been renamed `aa.h´ because it will be needed
in test binaries as well.
• Source files are now automatically found rather than needing to list
them explicitly in `make/cgirls.mak´.
• Support for a `make/config.mak´ configuration file was added, for
modifying the build. A sample is provided which offers the sort of
optimizations one might want in a production environment.
• Tests consist of comparing result of running a program with the input
in `test/´ against an expected output in `expect/´. Lines which start
with a `#´ are ignored in both. This is to enable REUSE‐conformance
(all of these files are `CC0-1.0´) and hopefully will not cause
problems down the road.