308 lines · 6.4 KB · Text
RawDownload
.TH WEBFS 4.SH NAMEwebfs \- world wide web file system.SH SYNOPSIS.B webfs[.B -c.I cookiefile][.B -m.I mtpt][.B -s.I service].SH DESCRIPTION.I Webfspresents a file system interface to the parsing and retrievingof URLs..I Webfsmounts itself at.I mtpt(default.BR /mnt/web ),and, if .I serviceis specified, will post a service file descriptorin .BR /srv/\fIservice ..PP.I Webfspresents a three-level file system suggestiveof the network protocol hierarchies.IR ip (3)and.IR ether (3)..PPThe top level contains three files:.BR ctl ,.BR cookies ,and.BR clone ..PPThe.B ctlfile is used to maintain parameters global to the instance of.IR webfs .Reading the .B ctlfile yields the current values of the parameters.Writing strings of the form.RB `` attr " " value ''sets a particular attribute.Attributes are:.TP.B chatty9pThe.B chatty9pflag used by the 9P library, discussed in.IR 9p (2)..B 0is no debugging,.B 1prints 9P message traces on standard error,and values above.B 1present more debugging, at the whim of the library.The default for this and the following debug flags is .BR 0 ..TP.B fsdebugThis variable is the level of debugging output about the file system module..TP.B cookiedebugThis variable is the level of debugging output about the cookie module..TP.B urldebugThis variable is the level of debugging output about URL parsing..TP.B acceptcookiesThis flag controls whether to accept cookies presented by remote web servers.(Cookies are described below, in the discussion of the.B cookiesfile.)The values.B onand.B offare synonymous with.B 1and.BR 0 .The default is.BR on ..TP.B sendcookiesThis flag controls whether to present stored cookies to remote web servers.The default is.BR on ..TP.B redirectlimitWeb servers can respond to a request with a messageredirecting to another page..I Webfsmakes no effort to determine whether it is in an infiniteredirect loop.Instead, it gives up after this many redirects.The default is.BR 10 ..TP.B useragent.I Webfssends the value of this attribute in its.B User-Agent:header in its HTTP requests.The default is.RB `` "webfs/2.0 (plan 9)" .''.PD.PPThe top-level directory also containsnumbered directories corresponding to connections, whichmay be used to fetch a single URL.To allocate a connection, open the.B clonefile and read a number .I nfrom it.After opening, the.B clonefile is equivalent to the file.IB n /ctl \fR.A connection is assumed closed once all files in its directoryhave been closed, and is then will be reallocated..PPEach connection has its own private set of.BR acceptcookies ,.BR sendcookies ,.BR redirectlimit ,and.B useragentvariables, initialized to the defaults set in theroot's.B ctlfile.  The per-connection.B ctlfile allows editing the variables for this particular connection..PPEach connection also has a URL string variable.B urlassociated with it.This URL may be an absolute URL such as.I http://www.lucent.com/index.htmlor a relative URL such as.IR ../index.html .The.B baseurlstring variable sets the URL against which relative URLsare interpreted.Once the URL has been set,its pieces can be retrieved via individual files in the.B parseddirectory..I Webfsparses the following URL syntaxes; names in italics arethe names of files in the.B parseddirectory..IP\fIscheme\f5:\fIschemedata.br\f5http://\fIhost\f5/\fIpath\fR[\f5?\fIquery\fR][\f5#\fIfragment\fR].br\f5ftp://\fR[\fIuser\fR[\f5:\fIpassword\fR]\f5@\fR]\fP\f5\fIhost\f5/\fIpath\fR[\f5;type=\fIftptype\fR].br\f5file:\fIpath.LPIf there is associated data to beposted with the request, it can be written to.BR postbody .Finally, opening.B bodyinitiates the request.The resulting data may be read from.B bodyas it arrives.After the request has been executed, the MIME content typemay be read from the.B contenttypefile..PPThe top-level.B cookiesfile contains the internal set of HTTP cookies, whichare used by HTTP servers to associate requests with persistentstate such as user profiles.It may be edited as an ordinary text file.Multiple instances of.I webfsand.IR webcookies (4)share cookies by keeping their internal setconsistent with the.I cookiefile(default.BR $home/lib/webcookies ),which has the same format..PPThese files contain one line per cookie;each cookie comprises some number of.IB attr = valuepairs.Cookie attributes are:.TP.BI name= nameThe name of the cookie on the remote server..TP.BI value= valueThe value associated with that name on the remote server.The actual data included when a cookie is sent backto the server is.IB \fR``\fIname = value\fR''(where, confusingly,.I nameand.I valueare the values associated with the.B nameand.B valueattributes..TP.BI domain= domainIf.I domainis an IP address, the cookie can only be used for URLswith.I hostequal to that IP address.Otherwise,.I domainmust be a pattern beginning with a dot, andthe cookie can only be used for URLs with a.I hosthaving.I domainas a suffix.For example, a cookie with.B domain=.bell-labs.commay be used on hosts.I www.bell-labs.comand.IR www.research.bell-labs.com(but not.IR www.not-bell-labs.com )..TP.BI path= pathThe cookie can only be used for URLs with a pathbeginning with.IR path ..TP.BI version= versionThe version of the HTTP cookie specification, specified by the server..TP.BI comment= commentA comment, specified by the server..TP.BI expire= expireThe cookie expires at time.IR expire ,which is a decimal number of seconds since the epoch..TP.B secure=1The cookie may only be used over secure.RB ( https )connections.Secure connections are currently unimplemented..TP.B explicitdomain=1The domain associated with this cookie was set bythe server (rather than inferred from a URL)..TP.B explicitpath=1The path associated with this cookie was set by theserver (rather than inferred from a URL)..TP.B netscapestyle=1The server presented the cookie in ``Netscape style,'' whichdoes not conform to the cookie standard, RFC2109.It is assumed that when presenting the cookie to the server,it must be sent back in Netscape style as well..PD.SH EXAMPLE.B /sys/src/cmd/webfs/webget.cis a simple client..SH SOURCE.B /sys/src/cmd/webfs.SH SEE ALSO.IR hget (1),.IR webcookies (4).SH BUGSIt's not clear what the relationship between.IR hget ,.I webcookiesand.I webfsshould be.