http-client-procs.tcl

  • last updated 7 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Don't mess with user-defined content-type, unless required

Spool POST payload bigger than a threshold (default ~25MB) to a file, instead of keeping in memory the entire request.

This exploits (transparently) -body_file option in the ns_http API and native curl features.

Put some caching into utilities around to reduce db calls and execs.

Creation of this header is already done properly into ns_http

Insert content-length only when transfer-encoding is not chunked

- Aligned and fixed behavior for encoding of request with respect to redirect in the two implementations

- Use only binary encoding in curl implementation for the file used to spool the body, to avoid

corruption of content (eventual encoding has already happened in its proper place)

- Allow only for curl to exploit native file POSTing capability (only way to POST files > 2GB)

TODO: wrap this behavior in the generic API

- Add content-length header when POSTing content, as some servers will require it (curl did this already)

Put again >= in place as before

Reverting previous change: I don't know since when in 4.99.12 dev versions we have dropped ns_ssl. Just stick to plain 4.99.12

Use 4.99.11 as comparison version to say: "from 4.99.12 upwards"

Removed use of deprecated ns_ssl API for Naviserver versions newer than 4.99.12

Removed use of util_memoize in favor of ns_memoize

- shorten export_vars argument list

Fix bug http://openacs.org/bugtracker/openacs/bug?bug_number=3292:

Native and curl implementation of util::http behave inconsistently when dealing with json content and special characters

Also fix another inconsistency: curl added an extra space after pager content.

New feature for http client API:

util::http::basic_auth - BASIC authentication

util::http::cookie_auth - Generical cookie based authentication. This proc allows issuing authenticated calls to an OpenACS instance and other sistems using this kind of method

Now all util::http calls won't return an error when max redir depth is reached, but just the result at the page we visited as last (including cookies).

  1. … 1 more file in changeset.
Merging back to HEAD all changes that happened in branch oacs-5-8 between tags: vg-merge-oacs-5-8-from-20141027 and vg-merge-oacs-5-8-from-20150427

  1. … 520 more files in changeset.
- fix redirection in native mode:

A redirect from http might point to https, which in turn

might not be configured. So we have to go through

util::http::request again.

Modified http api to return response headers to the caller

- use ad_tmpnam instead of ns_tmpnam since the latter is deprecated

Resorting to passing through filesystem when sending body in post requests: too much concerns related to escaping in a suitable way for every possible shell (windows, linux...)

Merging back to HEAD branch oacs-5-8 (using tag vg-merge-oacs-5-8-from-20141027).

  1. … 2547 more files in changeset.
- add commata in documentation

Added version checking for curl and used it to verify if --post303 option is available.

- util::http::*: since spool file is server provided, use option

"-spool" to indicate that spooling is intended. The actual name of

the spool file is retuned in the "file" component of the dict.

- fix spool file logic for ns_http/ns_ssl

- allow spooling as well for curl

- drop "-depth" for the toplevel interface, since it is used for

iteration on the (private) implementation level

- set max_depth per default to 10 to handle redirects automatically

- add function util::http::available to check, whether util::http::* can be called in the current configuration

- activate spooling to files for versions of naviserver supporting it

- add code to convert timeout value to a value suitable for the

underlying implementation (NaviServer or curl)

- document timeout values

- base deprecated code on util::http::*

- moved util_link_responding_p and util_get_http_status to

http-client-procs and based it on util::http::*.

- marked util_link_responding_p and util_get_http_status as

deprecated, moved a new version into the util::* namespace

and turned positional arguments into non-positional

  1. … 1 more file in changeset.
- follow documentation conventions

- use proper version comparison to avoid surprises, when alnum comparison leads to different results

- add missing backslashes in util::http::native::request for redirects

- make "GET" default method

- change encoding to unix style (as in other procs)

    • -1511
    • +1515
    ./http-client-procs.tcl
Committed new API for HTTP client functionality, moved old HTTP client procs to the new file and set them as deprecated.

  1. … 1 more file in changeset.
file http-client-procs.tcl was initially added on branch oacs-5-8.

    • -0
    • +0
    ./http-client-procs.tcl