diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
commit | e5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch) | |
tree | d8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/webfs/dat.h |
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/webfs/dat.h')
-rwxr-xr-x | sys/src/cmd/webfs/dat.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/sys/src/cmd/webfs/dat.h b/sys/src/cmd/webfs/dat.h new file mode 100755 index 000000000..cde79c3ff --- /dev/null +++ b/sys/src/cmd/webfs/dat.h @@ -0,0 +1,103 @@ +typedef struct Client Client; +typedef struct Ctl Ctl; +typedef struct Ibuf Ibuf; +typedef struct Url Url; + +/* simple buffered i/o for network connections; shared by http, ftp */ +struct Ibuf +{ + int fd; + Ioproc *io; + char buf[4096]; + char *rp, *wp; +}; + +struct Ctl +{ + int acceptcookies; + int sendcookies; + int redirectlimit; + char *useragent; +}; + +struct Client +{ + Url *url; + Url *baseurl; + Ctl ctl; + Channel *creq; /* chan(Req*) */ + int num; + int plumbed; + char *contenttype; + char *postbody; + char *redirect; + char *authenticate; + char *ext; + int npostbody; + int havepostbody; + int iobusy; + int bodyopened; + Ioproc *io; + int ref; + void *aux; +}; + +/* + * If ischeme is USunknown, then the given URL is a relative + * URL which references the "current document" in the context of the base. + * If this is the case, only the "fragment" and "url" members will have + * meaning, and the given URL structure may not be used as a base URL itself. + */ +enum +{ + USunknown, + UShttp, + UShttps, + USftp, + USfile, + UScurrent, +}; + +struct Url +{ + int ischeme; + char* url; + char* scheme; + int (*open)(Client*, Url*); + int (*read)(Client*, Req*); + void (*close)(Client*); + char* schemedata; + char* authority; + char* user; + char* passwd; + char* host; + char* port; + char* path; + char* query; + char* fragment; + union { + struct { + char *page_spec; + } http; + struct { + char *path_spec; + char *type; + } ftp; + }; +}; + +enum +{ + STACK = 32*1024, /* was 16*1024; there are big arrays on the stack */ +}; + +extern Client** client; +extern int cookiedebug; +extern Srv fs; +extern int fsdebug; +extern Ctl globalctl; +extern int nclient; +extern int urldebug; +extern int httpdebug; +extern char* status[]; + |