]> git.lizzy.rs Git - plan9front.git/blob - sys/man/4/webfs
pkg(1): update repositories
[plan9front.git] / sys / man / 4 / webfs
1 .TH WEBFS 4
2 .SH NAME
3 webfs \- world wide web file system
4 .SH SYNOPSIS
5 .B webfs
6 [
7 .B -A
8 .I useragent
9 ] [
10 .B -T
11 .I timeout
12 ] [
13 .B -m
14 .I mtpt
15 ]
16 [
17 .B -s
18 .I service
19 ]
20 .SH DESCRIPTION
21 .I Webfs
22 presents a file system interface to the parsing and retrieving
23 of URLs.
24 .I Webfs
25 mounts itself at
26 .I mtpt
27 (default
28 .BR /mnt/web ),
29 and, if 
30 .I service
31 is specified, will post a service file descriptor in 
32 .BR /srv/\fIservice .
33 .PP
34 If the enviroment variable
35 .B httpproxy
36 is set, all HTTP request initiated by
37 .I webfs
38 will be made thru that proxy url.
39 .PP
40 .I Webfs
41 presents a three-level file system suggestive
42 of the network protocol hierarchies
43 .IR ip (3)
44 and
45 .IR ether (3).
46 .PP
47 The top level contains the files files:
48 .BR ctl ,
49 and
50 .BR clone .
51 .PP
52 The top level
53 .B ctl
54 file is used to maintain parameters global to the instance of
55 .IR webfs .
56 Reading the 
57 .B ctl
58 file yields the current values of the parameters.
59 Writing strings of the form
60 .RB `` attr " " value ''
61 sets a particular attribute.
62 The top-level directory also contains
63 numbered directories corresponding to connections, which
64 may be used to fetch a single URL.
65 To allocate a connection, open the
66 .B clone
67 file and read a number 
68 .I n
69 from it.
70 After opening, the
71 .B clone
72 file is equivalent to the file
73 .IB n /ctl \fR.
74 A connection is assumed closed once all files in its
75 directory have been closed, and is then will be reallocated.
76 .PP
77 Each connection has a URL attribute
78 .B url
79 associated with it.
80 This URL may be an absolute URL such as
81 .I http://www.lucent.com/index.html
82 or a relative URL such as
83 .IR ../index.html .
84 The
85 .B baseurl
86 attribute sets the URL against which relative URLs
87 are interpreted.
88 Once the URL has been set by wrting to the
89 .B ctl
90 file of the connetcion, its pieces can be retrieved via
91 individual files in the
92 .B parsed
93 directory:
94 .de UU
95 .TP
96 .B parsed/\fI\\$1
97 \\$2
98 ..
99 .UU url http://pete:secret@www.example.com:8000/cgi/search?q=kittens#results
100 .UU scheme http
101 .UU user pete
102 .UU pass secret
103 .UU host www.example.com
104 .UU port 8000
105 .UU path /cgi/search
106 .UU query q=kittens
107 .UU fragment results
108 .PP
109 If there is associated data to be posted with the request,
110 it can be written to
111 .BR postbody .
112 Opening
113 .B postbody
114 or
115 .B body
116 initiates the request. If the request fails,
117 then opening the
118 .B body
119 or writing to
120 .B postbody
121 file will fail and return a error string.
122 .PP
123 When the
124 .B body
125 file has been opend, response headers appear
126 as files in the connection directory. For example
127 reading the
128 .B contenttype
129 file yields the MIME content type of the body data.
130 If the request was redirected, the URL represended
131 by the
132 .B parsed
133 directory will change to the final destination.
134 .PP
135 The resulting data may be read from
136 .B body
137 as it arrives.
138 .PP
139 The following is a list of attributes that can be
140 set to do a connection prior initiating the request:
141 .TP
142 .B url,baseurl
143 See above.
144 .TP
145 .B useragent
146 Sets a custom useragent string to be used with the request.
147 .TP
148 .B contenttype
149 Sets the MIME content type of the postbody.
150 .TP
151 .B request
152 Usualy, the HTTP method used is
153 .B POST
154 when
155 .B postbody
156 file is opend first or
157 .B GET
158 otherwise. This can be overriden with the
159 .B request
160 attribute so send arbitrary HTTP requests.
161 .TP
162 .B headers
163 Adds arbitrary HTTP headers to be send with
164 the request.
165 .SH EXAMPLE
166 .B /rc/bin/hget
167 is a simple client.
168 .SH SOURCE
169 .B /sys/src/cmd/webfs
170 .SH "SEE ALSO"
171 .IR webcookies (4),
172 .IR hget (1)
173 .SH DIAGNOSTICS
174 For cookies to work,
175 .IR webcookies (4),
176 should be running and mounted on
177 .B /mnt/webcookies
178 otherwise cookies will be ignored.