summaryrefslogtreecommitdiff
path: root/sys/man/1/hget
blob: cccfcfc73d4a33dcbeab46562ac4c6f1da14d3e6 (plain)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
.TH HGET 1
.SH NAME
hget, formpost \- retrieve, post to a web page corresponding to a url
.SH SYNOPSIS
.B hget
[
.B -o
.I file
] [
.B -p
.I body
|
.B -P
] [
.B -r
.I header
] [
.B -m
.I method
] [
.B -b
.I baseurl
]
.I url
.PP
.B formpost
[
.B -d
] [
.B -M
] [
.B -u
.I url
] [
.B -g
.I action
] [
.B -p
.I action
] [
.B -m
.I action
] [
.I name:value
|
.I name:@value
]
.I ...
.SH DESCRIPTION
.I Hget
retrieves the web page specified by the URL
.I url
and writes it, absent the
.B -o
option, to standard output.
.PP
The
.I url
can be a relative path like
.B ../index.html
if a absolute
.I baseurl
was specified with the
.B -b
option.
.PP
If
.I url
is of type HTTP and the
.B -p
or
.B -P
options are specified, then a HTTP POST is performed.
With
.B -p
the data to be posted is provided by the
.I body
argument as a string or alternatively with
.B -P
read from standard input.
.PP
The
.B -o
option is used to keep a local file in sync with a
web page.  If the web page has been modified later than the
file, it is copied into the file.  If the file is up to date
but incomplete,
.I hget
will fetch the missing bytes.
.PP
Option
.B -r
sends an arbitrary HTTP
.IR header .
.PP
Option
.B -m
overrides the HTTP method used for the request.
.PP
.I Formpost
retrieves the web page specified by the URL
.I url,
parses its HTML for form data, then prints
.I hget
commands to submit forms to the
.I url.
If the
.B -M, -g, -p
or
.B -m
flags are set, the
.I hget
commands are assembled without first retrieving and interpreting the
target HTML.
.PP
If the
.B -d
flag is specified, debugging information is written
to the file
.B formpost.log
in the current directory.
.PP
The
.B -M
flag applies multipart/form-data encoding to the
remaining arguments and prints the result on
the standard output.
.PP
The
.B -u
flag sets the target URL to
.I url.
.PP
The
.B -g
and
.B -p
flags set the the form method to GET and POST, respectively. The
.B -m
flag sets the form method to POST and its enctype to multipart/form-data.
In all cases, the form action is set to
.I action.
.PP
The remaining arguments of the form
.B name:value
are interpreted as form field names and values to be submitted along
with the form. An argument of the form
.B name:@value
is interpreted as a file upload, with the information following the
.B @
symbol treated as the full path to the location of the file.
.SH EXAMPLES
Retrieve the
.I hget
command needed to submit a form, which may then be
edited and sent.
.IP
.EX
% formpost -u http://p.intma.in
hget -p 'text=' http://p.intma.in/paste.cgi
.EE
.PP
Manually specify options to be sent to a given
.I url.
Note: The target HTML is not fetched and interpreted.
.IP
.EX
% formpost -u http://p.intma.in -p paste.cgi 'text:test post'
hget -p 'text=test+post' http://p.intma.in/paste.cgi
.EE
.SH SOURCE
.B /rc/bin/hget
.br
.B /rc/bin/formpost
.SH "SEE ALSO"
.IR webfs (4) ,
.IR ftpfs (4)
.SH DIAGNOSTICS
.I Hget
requires 
.IR webfs (4)
service mounted on
.B /mnt/web
to work.
.SH BUGS
.I Formpost
does not attempt to insert default values for
.B <select>
tags.