dacshttp [-get | -post | -delete |
-head | -options | -soptions | -put]
[-ll log_level]
[-prompt] [-v] [--version]
[[-ct string] |
[--content-type string]]
[{-header name value}...]
[-headers filename]
[-body filename] [-ih]
[-user-agent string]
[{-p name value}...]
[-proto version-num]
[-proxy proxyhost:proxyport]
[-proxymatch hostname[:port] proxyhost:proxyport]
[-f name filename]
[{-cookies filename}...] [-ah]
[-ssl command-line]
[-ssl-flags flags] uri
This program is part of the DACS suite. It is a stand-alone program that neither accepts the usual DACS command line options (dacsoptions[1]) nor accesses any DACS configuration files.
This general-purpose utility sends an HTTP/HTTPS request for uri to a web server and prints the reply to its standard output.
dacshttp will automatically follow redirects according to RFC 2616[2] and up to a compile-time maximum, unless the -prompt flag is given. A non-standard extension is that a redirect to a non-absolute URI is interpreted in a manner compatible with most browsers.
In versions 1.4.27b and earlier, this command was called http.
DACS can issue its own HTTP requests, such as from dacs_authenticate to an external authentication module. This HTTP functionality is provided by the same support code that the dacshttp command uses, and therefore much of the following information applies to these internally generated requests also (e.g., HTTP_PROG[3], SSL_PROG[4], SSL_PROG_ARGS[5], SSL_PROG_CA_CRT[6], SSL_PROG_CLIENT_CRT[7], VFS[8]).
The HTTP GET method is used by default, but some flags implicitly select a different method (e.g., -f and -p). One of the following flags can be used to explicitly specify the HTTP method, provided it is compatible with the other options:
-get
-post
-head
-put
-delete
-options
-soptions
These command line flags are also recognized:
-ah
-body filename
-cookies filename
-ct string
--content-type string
-f name filename
-header name value
-header User-Agent foo -user-agent foo
The former case will send the User-Agent header twice.
-headers filename
-ih
-ll log_level
-p name value
-prompt
-proto version-num
-proxy proxyhost:proxyport
-proxymatch hostname[:port] proxyhost:proxyport
-ssl command-line
The command-line is a complete shell command line that will be used to run the program as a filter. For example, this argument might look like either of:
-ssl "/usr/local/dacs/bin/sslclient example.com:443" -ssl "/usr/local/bin/stunnel -c -r example.com:443"
If the -ssl argument is absent but the uri argument uses the https scheme, dacshttp will still try to use SSL. It will attempt to use sslclient(1)[13] and assume it is in its default location. If the -ssl argument is present but specifies only one string, that string is assumed to be the path to sslclient(1)[13]. The first example below will run sslclient(1)[13] from /tmp/sslclient to connect to port 443 at example.com; the second example has the same effect but will run sslclient(1)[13] from its default location:
% dacshttp -ssl "/tmp/sslclient" https://example.com % dacshttp https://example.com
-ssl-flags flags
For example, in this example dacshttp will invoke sslclient with the two arguments -sm and bobo.example.com:
% dacshttp -ssl-flags "-sm bobo.example.com" https://example.com
If a wildcard server certificate is used, it may be necessary to explicitly match all hosts within a specific domain:
% dacshttp -ssl-flags "-sm .*\.example\.com" https://example.com
-user-agent string
-v
--version
The uri argument is the URL to invoke. It may include a query string suffix (even if HTTP POST is selected).
Whether selected implicitly or explicitly, the command line must specify exactly one of the HTTP methods.
Request headers specified using the -header or -headers flags are sent in the order in which the flags appear on the command line. If they are read from a file, there ordering is maintained.
The following will retrieve RFC 2616[2] and save it in rfc2616.txt:
% dacshttp "http://www.rfc-editor.org/rfc/rfc2616.txt" > rfc2616.txt
This will do a GET on the given URL, passing the query string foo=baz, and writing the result to stdout:
% dacshttp "https://example.com/cgi-bin/dacs/dacs_prenv?foo=baz"
This will do a POST on the given URL, passing two arguments:
% dacshttp -p foo baz -p bar zork https://example.com/cgi-bin/dacs/dacs_prenv
This will make an HTTP GET method request over SSL to the given URL:
% dacshttp -ssl "/usr/local/dacs/bin/sslclient example.com:443" \
https://example.com/cgi-bin/dacs/dacs_prenv
The program exits 0 if everything was fine, 1 if an error occurred.
Use of an SSL provider other than sslclient(1)[13] is officially deprecated. Recent development makes it doubtful that any other program will function properly with dacshttp.
It is only a partial implementation of RFC 2616[2] (HTTP 1.0). It only talks HTTP (no other URI schemes are supported). Received cookies are discarded, there is no support for RFC 2617[14] authentication, including proxy authentication, and no client-side caching is performed. dacshttp should not require an external program to provide SSL functionality. The program is a bit confused about when it should be able to send a message body.
sslclient(1)[13], lynx(1)[15], curl(1)[16], Wget(1)[17], RFC 1738[18], RFC 2396[19], RFC 2616[2], RFC 3986[20]
Distributed Systems Software (www.dss.ca[21])
Copyright2003-2013 Distributed Systems Software. See the LICENSE[22] file that accompanies the distribution for licensing information.