From a78f5f8a3d72fc18c9bb734e066f45e9a3be5ab0 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 17 Jul 2012 07:21:22 +0200 Subject: mothra: handle relative urls in tag --- sys/src/cmd/mothra/url.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'sys/src/cmd/mothra/url.c') 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; +} -- cgit v1.2.3