1 18824b58 2008-08-03 rsc #include "a.h"
9 18824b58 2008-08-03 rsc httpconnect(char *host)
11 18824b58 2008-08-03 rsc char buf[1024];
15 18824b58 2008-08-03 rsc snprint(buf, sizeof buf, "tcp!%s!http", host);
16 18824b58 2008-08-03 rsc if((fd = dial(buf, nil, nil, nil)) < 0)
18 18824b58 2008-08-03 rsc pfd = emalloc(sizeof *pfd);
19 18824b58 2008-08-03 rsc pfd->fd = fd;
24 18824b58 2008-08-03 rsc httpclose(Pfd *pfd)
26 18824b58 2008-08-03 rsc if(pfd == nil)
28 18824b58 2008-08-03 rsc close(pfd->fd);
33 18824b58 2008-08-03 rsc httpwrite(Pfd *pfd, void *v, int n)
35 18824b58 2008-08-03 rsc return writen(pfd->fd, v, n);
39 18824b58 2008-08-03 rsc httpread(Pfd *pfd, void *v, int n)
41 18824b58 2008-08-03 rsc return read(pfd->fd, v, n);
44 18824b58 2008-08-03 rsc Protocol http = {