DACSHTTP(1) | DACS Commands Manual | DACSHTTP(1) |
NAME¶
dacshttp - perform an HTTP/HTTPS requestSYNOPSIS¶
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]
[-u userinfo] [-U proxy-userinfo]
uri
DESCRIPTION¶
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.
Note
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]).
OPTIONS¶
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
Note
This will not override headers required or implied by other command line flags, and can result in multiple instances of the same header. For example, the following flags are not equivalent:
-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
Note
This option is not implemented. The SSL/TLS flags apply to all connections; this is probably a bug.
-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/TLS. It will attempt to use sslclient(1)[14] 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)[14]. The first example below will run sslclient(1)[14] from /tmp/sslclient to connect to port 443 at example.com; the second example has the same effect but will run sslclient(1)[14] 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
Important
When called by dacshttp, error messages produced by sslclient may be lost. If you encounter problems with SSL/TLS operation, work with sslclient(1)[14] to ensure that an SSL/TLS connection can be established, or to determine and resolve the problem. If you discover that sslclient requires command line flags for proper operation, you will need to make sure that dacshttp passes those flags to it.
-user-agent string
-u userinfo
--user userinfo
-U proxy-userinfo
--proxyuser proxy-userinfo
-v
--version
The uri argument is the URL to invoke. It may include a query string suffix (even if HTTP POST is selected). Though not recommended because it is not secure, the uri may include a userinfo component (RFC 2617[15]).
It is an error to attempt to send more than one Authorization header.
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.
EXAMPLES¶
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:
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/TLS to the given URL:
% dacshttp -ssl "/usr/local/dacs/bin/sslclient example.com:443" \ https://example.com/cgi-bin/dacs/dacs_prenv
These two commands are equivalent. They submit a request associated with username julia and password herpasswd, which causes an Authorization header conforming to the HTTP Basic Authentication scheme (RFC 2617[15]) to be sent:
% dacshttp http://julia:herpasswd@example.com % dacshttp -u julia:herpasswd http://example.com
DIAGNOSTICS¶
The program exits 0 if everything was fine, 1 if an error occurred.BUGS¶
It can sometimes be a useful tool, but this program's primary purpose is for developing and testing DACS core functionality. There are many readily-available and better HTTP clients.Use of an SSL/TLS provider other than sslclient(1)[14] is officially deprecated. dacshttp should not require an external program to provide SSL/TLS functionality. Recent development makes it doubtful that any other program will function properly with dacshttp.
dacshttp is only a partial implementation of RFC 2616[2]. It only talks HTTP (no other URI schemes are supported). Received cookies are discarded. Authentication via RFC 2617[15] is only partially implemented: a single username and password to authenticate the user submitting the request and/or a single username and password to gain access to a proxy server can be specified to be sent with the request. No client-side caching of any kind is performed.
SEE ALSO¶
sslclient(1)[14], lynx(1)[16], curl(1)[17], Wget(1)[18], RFC 1738[19], RFC 2396[20], RFC 2616[2], RFC 3986[21]AUTHOR¶
Distributed Systems Software (www.dss.ca[22])COPYING¶
Copyright2003-2014 Distributed Systems Software. See the LICENSE[23] file that accompanies the distribution for licensing information.NOTES¶
- 1.
- dacsoptions
- 2.
- RFC 2616
- 3.
- HTTP_PROG
- 4.
- SSL_PROG
- 5.
- SSL_PROG_ARGS
- 6.
- SSL_PROG_CA_CRT
- 7.
- SSL_PROG_CLIENT_CRT
- 8.
- VFS
- 9.
- Netscape spec
- 10.
- RFC 2109
- 11.
- RFC 2965
- 12.
- RFC 6265
- 13.
- dacs(1)
- 14.
- sslclient(1)
- 15.
- RFC 2617
- 16.
- lynx(1)
- 17.
- curl(1)
- 18.
- Wget(1)
- 19.
- RFC 1738
- 20.
- RFC 2396
- 21.
- RFC 3986
- 22.
- www.dss.ca
- 23.
- LICENSE
06/02/2017 | DACS 1.4.38a |