2011-03-30 13:49:47 +00:00
|
|
|
.TH WEBFS 4
|
|
|
|
.SH NAME
|
|
|
|
webfs \- world wide web file system
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B webfs
|
|
|
|
[
|
2012-05-16 15:00:19 +00:00
|
|
|
.B -A
|
|
|
|
.I useragent
|
|
|
|
] [
|
|
|
|
.B -T
|
|
|
|
.I timeout
|
|
|
|
] [
|
2011-03-30 13:49:47 +00:00
|
|
|
.B -m
|
|
|
|
.I mtpt
|
|
|
|
]
|
|
|
|
[
|
|
|
|
.B -s
|
|
|
|
.I service
|
|
|
|
]
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.I Webfs
|
|
|
|
presents a file system interface to the parsing and retrieving
|
|
|
|
of URLs.
|
|
|
|
.I Webfs
|
|
|
|
mounts itself at
|
|
|
|
.I mtpt
|
|
|
|
(default
|
|
|
|
.BR /mnt/web ),
|
|
|
|
and, if
|
|
|
|
.I service
|
2012-01-11 15:17:54 +00:00
|
|
|
is specified, will post a service file descriptor in
|
2011-03-30 13:49:47 +00:00
|
|
|
.BR /srv/\fIservice .
|
|
|
|
.PP
|
2012-01-11 15:17:54 +00:00
|
|
|
If the enviroment variable
|
|
|
|
.B httpproxy
|
|
|
|
is set, all HTTP request initiated by
|
|
|
|
.I webfs
|
|
|
|
will be made thru that proxy url.
|
|
|
|
.PP
|
2011-03-30 13:49:47 +00:00
|
|
|
.I Webfs
|
|
|
|
presents a three-level file system suggestive
|
|
|
|
of the network protocol hierarchies
|
|
|
|
.IR ip (3)
|
|
|
|
and
|
|
|
|
.IR ether (3).
|
|
|
|
.PP
|
2012-01-11 15:17:54 +00:00
|
|
|
The top level contains the files files:
|
2011-03-30 13:49:47 +00:00
|
|
|
.BR ctl ,
|
|
|
|
and
|
|
|
|
.BR clone .
|
|
|
|
.PP
|
2012-01-11 15:17:54 +00:00
|
|
|
The top level
|
2011-03-30 13:49:47 +00:00
|
|
|
.B ctl
|
|
|
|
file is used to maintain parameters global to the instance of
|
|
|
|
.IR webfs .
|
|
|
|
Reading the
|
|
|
|
.B ctl
|
|
|
|
file yields the current values of the parameters.
|
|
|
|
Writing strings of the form
|
|
|
|
.RB `` attr " " value ''
|
|
|
|
sets a particular attribute.
|
2013-01-11 23:16:07 +00:00
|
|
|
.PP
|
|
|
|
The following global parameters can be set:
|
|
|
|
.TP
|
|
|
|
.B useragent
|
|
|
|
Sets the HTTP user agent string.
|
|
|
|
.TP
|
|
|
|
.B timeout
|
|
|
|
Sets the request timeout in seconds.
|
|
|
|
.TP
|
|
|
|
.BI flushauth " url"
|
|
|
|
Flushes any associated authentication information for
|
|
|
|
resources under
|
|
|
|
.I url
|
|
|
|
or all resources if no url was given.
|
|
|
|
.TP
|
|
|
|
.BI preauth " url realm"
|
|
|
|
Preauthenticates all resources under
|
|
|
|
.I url
|
|
|
|
with the given
|
|
|
|
.I realm
|
|
|
|
using HTTP Basic authentication. This will cause
|
|
|
|
.I webfs
|
|
|
|
to preemtively send the resulting authorization information
|
|
|
|
not waiting for the server to respond with an
|
|
|
|
HTTP 401 Unauthorized status.
|
|
|
|
.PP
|
2011-03-30 13:49:47 +00:00
|
|
|
The top-level directory also contains
|
|
|
|
numbered directories corresponding to connections, which
|
|
|
|
may be used to fetch a single URL.
|
|
|
|
To allocate a connection, open the
|
|
|
|
.B clone
|
|
|
|
file and read a number
|
|
|
|
.I n
|
|
|
|
from it.
|
|
|
|
After opening, the
|
|
|
|
.B clone
|
|
|
|
file is equivalent to the file
|
|
|
|
.IB n /ctl \fR.
|
2012-01-11 15:17:54 +00:00
|
|
|
A connection is assumed closed once all files in its
|
|
|
|
directory have been closed, and is then will be reallocated.
|
2011-03-30 13:49:47 +00:00
|
|
|
.PP
|
2012-01-11 15:17:54 +00:00
|
|
|
Each connection has a URL attribute
|
2011-03-30 13:49:47 +00:00
|
|
|
.B url
|
|
|
|
associated with it.
|
|
|
|
This URL may be an absolute URL such as
|
|
|
|
.I http://www.lucent.com/index.html
|
|
|
|
or a relative URL such as
|
|
|
|
.IR ../index.html .
|
|
|
|
The
|
|
|
|
.B baseurl
|
2012-01-11 15:17:54 +00:00
|
|
|
attribute sets the URL against which relative URLs
|
2011-03-30 13:49:47 +00:00
|
|
|
are interpreted.
|
2012-01-11 15:17:54 +00:00
|
|
|
Once the URL has been set by wrting to the
|
|
|
|
.B ctl
|
|
|
|
file of the connetcion, its pieces can be retrieved via
|
|
|
|
individual files in the
|
2011-03-30 13:49:47 +00:00
|
|
|
.B parsed
|
2012-01-11 15:17:54 +00:00
|
|
|
directory:
|
|
|
|
.de UU
|
|
|
|
.TP
|
|
|
|
.B parsed/\fI\\$1
|
|
|
|
\\$2
|
|
|
|
..
|
|
|
|
.UU url http://pete:secret@www.example.com:8000/cgi/search?q=kittens#results
|
|
|
|
.UU scheme http
|
|
|
|
.UU user pete
|
|
|
|
.UU pass secret
|
|
|
|
.UU host www.example.com
|
|
|
|
.UU port 8000
|
|
|
|
.UU path /cgi/search
|
|
|
|
.UU query q=kittens
|
|
|
|
.UU fragment results
|
|
|
|
.PP
|
|
|
|
If there is associated data to be posted with the request,
|
|
|
|
it can be written to
|
2011-03-30 13:49:47 +00:00
|
|
|
.BR postbody .
|
2012-01-11 15:17:54 +00:00
|
|
|
Opening
|
|
|
|
.B postbody
|
|
|
|
or
|
2011-03-30 13:49:47 +00:00
|
|
|
.B body
|
2012-01-11 15:17:54 +00:00
|
|
|
initiates the request. If the request fails,
|
|
|
|
then opening the
|
2011-03-30 13:49:47 +00:00
|
|
|
.B body
|
2012-01-11 15:17:54 +00:00
|
|
|
or writing to
|
|
|
|
.B postbody
|
|
|
|
file will fail and return a error string.
|
|
|
|
.PP
|
|
|
|
When the
|
|
|
|
.B body
|
|
|
|
file has been opend, response headers appear
|
|
|
|
as files in the connection directory. For example
|
|
|
|
reading the
|
2011-03-30 13:49:47 +00:00
|
|
|
.B contenttype
|
2012-01-11 15:17:54 +00:00
|
|
|
file yields the MIME content type of the body data.
|
|
|
|
If the request was redirected, the URL represended
|
|
|
|
by the
|
|
|
|
.B parsed
|
|
|
|
directory will change to the final destination.
|
2011-03-30 13:49:47 +00:00
|
|
|
.PP
|
2012-01-11 15:17:54 +00:00
|
|
|
The resulting data may be read from
|
|
|
|
.B body
|
|
|
|
as it arrives.
|
2011-03-30 13:49:47 +00:00
|
|
|
.PP
|
2012-01-11 15:17:54 +00:00
|
|
|
The following is a list of attributes that can be
|
2012-05-16 15:00:19 +00:00
|
|
|
set to do a connection prior initiating the request:
|
2011-03-30 13:49:47 +00:00
|
|
|
.TP
|
2012-01-11 15:17:54 +00:00
|
|
|
.B url,baseurl
|
|
|
|
See above.
|
2011-03-30 13:49:47 +00:00
|
|
|
.TP
|
2012-01-11 15:17:54 +00:00
|
|
|
.B useragent
|
|
|
|
Sets a custom useragent string to be used with the request.
|
2011-03-30 13:49:47 +00:00
|
|
|
.TP
|
2012-01-11 15:17:54 +00:00
|
|
|
.B contenttype
|
|
|
|
Sets the MIME content type of the postbody.
|
|
|
|
.TP
|
|
|
|
.B request
|
|
|
|
Usualy, the HTTP method used is
|
|
|
|
.B POST
|
|
|
|
when
|
|
|
|
.B postbody
|
|
|
|
file is opend first or
|
|
|
|
.B GET
|
|
|
|
otherwise. This can be overriden with the
|
|
|
|
.B request
|
|
|
|
attribute so send arbitrary HTTP requests.
|
|
|
|
.TP
|
|
|
|
.B headers
|
|
|
|
Adds arbitrary HTTP headers to be send with
|
|
|
|
the request.
|
2011-03-30 13:49:47 +00:00
|
|
|
.SH EXAMPLE
|
2012-01-11 15:17:54 +00:00
|
|
|
.B /rc/bin/hget
|
2011-03-30 13:49:47 +00:00
|
|
|
is a simple client.
|
|
|
|
.SH SOURCE
|
|
|
|
.B /sys/src/cmd/webfs
|
2012-01-11 15:17:54 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.IR webcookies (4),
|
|
|
|
.IR hget (1)
|
|
|
|
.SH DIAGNOSTICS
|
|
|
|
For cookies to work,
|
|
|
|
.IR webcookies (4),
|
|
|
|
should be running and mounted on
|
|
|
|
.B /mnt/webcookies
|
|
|
|
otherwise cookies will be ignored.
|