summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra/url.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-07-17 07:21:22 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-07-17 07:21:22 +0200
commita78f5f8a3d72fc18c9bb734e066f45e9a3be5ab0 (patch)
treeb1259e1089a2287f5e35d7c52f2ff3365bb6ba3c /sys/src/cmd/mothra/url.c
parent05c11fefe0c633ab061b9f69180593ed9cf073a2 (diff)
mothra: handle relative urls in <base> tag
Diffstat (limited to 'sys/src/cmd/mothra/url.c')
-rw-r--r--sys/src/cmd/mothra/url.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/src/cmd/mothra/url.c b/sys/src/cmd/mothra/url.c
index 014cb2c1d..5bb4736b9 100644
--- a/sys/src/cmd/mothra/url.c
+++ b/sys/src/cmd/mothra/url.c
@@ -151,3 +151,20 @@ urlget(Url *url, int body)
return fd;
}
+
+int
+urlresolve(Url *url)
+{
+ char buf[1024];
+ int n, fd;
+
+ if((fd = webclone(url, buf, sizeof(buf))) < 0)
+ return -1;
+ n = strlen(buf);
+ snprint(buf+n, sizeof(buf)-n, "/parsed/url");
+ readstr(buf, url->fullname, sizeof(url->fullname));
+ snprint(buf+n, sizeof(buf)-n, "/parsed/fragment");
+ readstr(buf, url->tag, sizeof(url->tag));
+ close(fd);
+ return 0;
+}