File: http.n

package info (click to toggle)
scotty 2.1.9-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 9,984 kB
  • ctags: 4,313
  • sloc: ansic: 35,946; sh: 12,591; tcl: 8,122; yacc: 2,442; makefile: 898; lex: 370
file content (104 lines) | stat: -rw-r--r-- 3,913 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
'\"
'\" Copyright (c) 1994-1996 Technical University of Braunschweig.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
.so man.macros
.TH http n "" Tnm "Tnm Tcl Extension"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
http \- Send and process HTTP requests.
.BE

.SH DESCRIPTION

The Hypertext Transfer Protocol (HTTP) (RFC 1945) is a client/server
protocol used to retrieve documents in the World Wide Web. Documents
are addressed using Uniform Resource Locators (URL) (RFC 1738). The
\fBhttp\fR command allows to implement HTTP clients and a simple HTTP
server.

.SH HTTP COMMAND
The following list of http commands is useful for HTTP clients:
.TP
.B http proxy \fR[\fIurl\fR]
The \fBhttp proxy\fR command allows to define a proxy HTTP server
which will be used in subsequent client commands. Using this command
without an \fIurl\fR argument will return the URL to the currently
used proxy or an empty string. Providing a \fIurl\fR argument sets the
proxy server.  Setting the proxy to an empty string turns the proxy
feature off.
.TP
.B http head \fIurl\fR
The \fBhttp head\fR command retrieves the HTTP header for the document
located at \fIurl\fR. The header is returned as a list of keys and
values which can be converted into a Tcl array using the array set
command.
.TP
.B http get \fIurl\fR \fIfileName\fR
The \fBhttp get\fR command retrieves the document located at
\fIurl\fR. The body of the document is written to the file named
\fIfileName\fR. The command returns the HTTP header as described for
the \fBhttp head\fR command above.
.TP
.B http post \fIurl\fR \fIdocFileName\fR \fIfileName\fR
The \fBhttp post\fR command posts the document in \fIdocFileName\fR to
the location \fIurl\fR. The body of the returned document is written
to the file named \fIfileName\fR. The command returns the HTTP header
as described for the \fBhttp head\fR command above.
.TP
.B http put \fIurl\fR \fIdocFileName\fR
The \fBhttp put\fR command puts the document in \fIdocFileName\fR to
the location \fIurl\fR. The command returns the HTTP header as
described for the \fBhttp head\fR command above.
.TP
.B http delete \fIurl\fR
The \fBhttp delete\fR command deletes the document at the location
defined by \fIurl\fR. The command returns HTTP status information.
.PP
The following set of http commands is useful for a simple HTTP server:
.TP
.B http server \fR[\fIport\fR]
The \fBhttp server\fR command starts a simple HTTP server listening on
port \fIport\fR. If called without a \fIport\fR argument, the
currently used port number or an empty string is returned. An empty
string indicates that no server is currently active.
.TP
.B http mime \fItype\fR \fIextension\fR
The \fBhttp mime\fR command is used to add mime type definitions to
the internal table which maps file name extension to mime types. If
called without an argument, the list of all mime type mappings is
returned. A new mapping is created by supplying a mime \fItype\fR and
the file name \fIextension\fR.
.TP
.B http bind \fIpattern\fR \fImethod\fR \fR[\fIscript\fR]

The \fBhttp bind\fR command binds a Tcl script to the invocation of a
HTTP \fImethod\fR where the URL matches \fIpattern\fR. Whenever a HTTP
request of type \fImethod\fR is received that matches the pattern,
\fIscript\fR is evaluated. The return value of the script must be a
name of a file which will be send back to the client. Errors during
the evaluation of the \fIscript\fR will result in an error response.

The following % sequences are substituted before a script bound
to a URL is evaluated:
.RS
.TP 6
.B %A
The network address of the client.
.TP
.B %P
The URL path requested by the client.
.TP
.B %S
The search path contained in the URL path.
.RE

.SH SEE ALSO
scotty(1), Tnm(n), Tcl(n)

.SH AUTHORS
Juergen Schoenwaelder <schoenw@cs.utwente.nl>
.br