http-client-procs.tcl

  • last updated 7 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Reduce usage of ns_mktemp in OpenACS

ns_mktemp uses the deprecated old POSIX call mktemp(), which should

not be used anymore for security reasons (race between the name

creation and opening the file). This change removes several usages of

"ns_mktemp" from OpenACS and replaces it with calls to the

safe Tcl call "file tempfile ..." (introduced by Tcl 8.6).

  1. … 7 more files in changeset.
Remove extra decoding ns_parsequery provides it already

Use naviserver api to parse URL variables

  1. … 1 more file in changeset.
Revert to previous strategy of determining available subcommands.

Running the provided subcommand is dangerous, since the command might

have side effects, might require connections, etc.

The feature test for "ns_http run" was incorrect, since it was not

introduced with 4.99.15 (as the comment suggested), but already with

4.99.4 (2017)... but at this time, the command did not return a dict,

which is assumed in the http-client procs. One can use "ns_http stats"

as an indicator for this feature, which was introduced at the time

when "ns_http run" was starting to return dicts as results.

Provide a more precise name for the feature test of ns_http returning

dicts (naming the feature simply "ns_http" is not a good idea, since

the command could of course be used already before the feature change).

  1. … 2 more files in changeset.
Do not improperly rely on apm_version_names_compare to check for NaviServer version number, use a more reliable capability check instead

  1. … 1 more file in changeset.
Keep supporting the previous proc signature, throwing a warning

util::http should provide enough fallback via curl already without targeting specific Naviserver versions, use other fallbacks only when no implementation is available

  1. … 1 more file in changeset.
Fix webserver version check using 'apm_version_names_compare' for rc versions.

Between 4.99.6 and 4.99.20rc1, for example, 'apm_version_names_compare' will consider the latter to be the lowest.

As this is not the expected behavior for webserver version check, this patch just removes the rc part of the version before comparing in the few cases where this is done, and should be removed if the behavior changes in the future.

  1. … 1 more file in changeset.
Fix version check

Tear down a lot of boilerplate used to support native HTTP api on Naviserver versions < 4.99.15, which will now fallback to curl

  1. … 1 more file in changeset.
Doc formatting changes

Avoid markup in documentation

Reduce people expectations

Prefer 'namespace which' over 'info commands', as it is faster (on local tests, around 2x) and returns a single value. Many thanks to Nathan Coulter.

  1. … 58 more files in changeset.
improve spelling

  1. … 4 more files in changeset.
improve spelling

  1. … 6 more files in changeset.
improve spelling

  1. … 5 more files in changeset.
added support for SNI servers

introduced "ad_file" as a means to avoid unexpected tilde substitution in file names

  1. … 50 more files in changeset.
improve spelling: move closer to the linux documentation recommendations

  1. … 34 more files in changeset.
Satisfy acs-tcl.postman_echo test case for curl http client implementation:

as with curl we always spool the body of requests into a file, we need to convert to the proper encoding even when this is already that of the system

Wrap legacy and current ns_http api behavior in a proc with a common interface in a way that people with newer Naviserver can exploit e.g. ns_http run capabilities (in particular, not being forced to queue and potentially block concurrent HTTP requests)

Specify the timeout value on the wait command as well and avoid unneeded conversion

improve spelling

  1. … 15 more files in changeset.
improve spelling

  1. … 8 more files in changeset.
Fix dict expression (many thanks to Markus Moser)

Let max_depth behave as specified (0 disables redirection). Many thanks to Markus Moser

improve spelling

  1. … 6 more files in changeset.
Introduce elapsed time in http api response

Will use the one coming from ns_http when available, or fallback to a calculated one.

Translation of file descriptor must be binary as well when flushing in-memory payload to the spool file, or we would corrupt this content