1 typedef struct Client Client; 2 typedef struct Ctl Ctl; 3 typedef struct Ibuf Ibuf; 4 typedef struct Url Url; 5 6 /* simple buffered i/o for network connections; shared by http, ftp */ 7 struct Ibuf 8 { 9 int fd; 10 Ioproc *io; 11 char buf[4096]; 12 char *rp, *wp; 13 }; 14 15 struct Ctl 16 { 17 int acceptcookies; 18 int sendcookies; 19 int redirectlimit; 20 char *useragent; 21 }; 22 23 struct Client 24 { 25 Url *url; 26 Url *baseurl; 27 Ctl ctl; 28 Channel *creq; /* chan(Req*) */ 29 int num; 30 int plumbed; 31 char *contenttype; 32 char *postbody; 33 char *redirect; 34 char *authenticate; 35 char *ext; 36 int npostbody; 37 int havepostbody; 38 int iobusy; 39 int bodyopened; 40 Ioproc *io; 41 int ref; 42 void *aux; 43 }; 44 45 /* 46 * If ischeme is USunknown, then the given URL is a relative 47 * URL which references the "current document" in the context of the base. 48 * If this is the case, only the "fragment" and "url" members will have 49 * meaning, and the given URL structure may not be used as a base URL itself. 50 */ 51 enum 52 { 53 USunknown, 54 UShttp, 55 UShttps, 56 USftp, 57 USfile, 58 UScurrent, 59 }; 60 61 struct Url 62 { 63 int ischeme; 64 char* url; 65 char* scheme; 66 int (*open)(Client*, Url*); 67 int (*read)(Client*, Req*); 68 void (*close)(Client*); 69 char* schemedata; 70 char* authority; 71 char* user; 72 char* passwd; 73 char* host; 74 char* port; 75 char* path; 76 char* query; 77 char* fragment; 78 union { 79 struct { 80 char *page_spec; 81 } http; 82 struct { 83 char *path_spec; 84 char *type; 85 } ftp; 86 }; 87 }; 88 89 enum 90 { 91 STACK = 32*1024, /* was 16*1024; there are big arrays on the stack */ 92 }; 93 94 extern Client** client; 95 extern int cookiedebug; 96 extern Srv fs; 97 extern int fsdebug; 98 extern Ctl globalctl; 99 extern int nclient; 100 extern int urldebug; 101 extern int httpdebug; 102 extern char* status[]; 103 104