summaryrefslogtreecommitdiff
path: root/appl/svc
diff options
context:
space:
mode:
Diffstat (limited to 'appl/svc')
-rw-r--r--appl/svc/webget/file.b2
-rw-r--r--appl/svc/webget/ftp.b10
-rw-r--r--appl/svc/webget/http.b10
-rw-r--r--appl/svc/webget/webget.b5
-rw-r--r--appl/svc/webget/wgutils.b5
-rw-r--r--appl/svc/webget/wgutils.m3
6 files changed, 26 insertions, 9 deletions
diff --git a/appl/svc/webget/file.b b/appl/svc/webget/file.b
index 49c51423..f9c7cde9 100644
--- a/appl/svc/webget/file.b
+++ b/appl/svc/webget/file.b
@@ -20,6 +20,8 @@ include "url.m";
U: Url;
ParsedUrl: import U;
+include "dial.m";
+
include "webget.m";
include "wgutils.m";
diff --git a/appl/svc/webget/ftp.b b/appl/svc/webget/ftp.b
index 9162fcb7..d5030bc9 100644
--- a/appl/svc/webget/ftp.b
+++ b/appl/svc/webget/ftp.b
@@ -22,6 +22,9 @@ include "url.m";
include "webget.m";
+include "dial.m";
+ DI: Dial;
+
include "wgutils.m";
W: WebgetUtils;
Fid, Req: import WebgetUtils;
@@ -42,6 +45,7 @@ init(w: WebgetUtils)
S = W->S;
B = W->B;
U = W->U;
+ DI = W->DI;
}
connect(c: ref Fid, r: ref Req, donec: chan of ref Fid)
@@ -53,13 +57,13 @@ connect(c: ref Fid, r: ref Req, donec: chan of ref Fid)
port := u.port;
if(port == "")
port = FTPPORT;
- addr := "tcp!" + u.host + "!" + port;
+ addr := DI->netmkaddr(u.host, "tcp", port);
dummyloop: # just for breaking out of on error
for(;;) {
W->log(c, sys->sprint("ftp: dialing %s", addr));
- (ok, net) := sys->dial(addr, nil);
- if(ok < 0) {
+ net := DI->dial(addr, nil);
+ if(net == nil) {
err = sys->sprint("dial error: %r");
break dummyloop;
}
diff --git a/appl/svc/webget/http.b b/appl/svc/webget/http.b
index 0a4645ed..348084cf 100644
--- a/appl/svc/webget/http.b
+++ b/appl/svc/webget/http.b
@@ -23,6 +23,9 @@ include "url.m";
U: Url;
ParsedUrl: import U;
+include "dial.m";
+ DI: Dial;
+
include "webget.m";
include "wgutils.m";
@@ -122,6 +125,7 @@ init(w: WebgetUtils)
S = W->S;
B = W->B;
U = W->U;
+ DI = W->DI;
ssl3 = nil; # load on demand
readconfig();
}
@@ -232,11 +236,11 @@ connect(c: ref Fid, r: ref Req, donec: chan of ref Fid)
else
port = HTTPD;
}
- addr := "tcp!" + dialu.host + "!" + port;
+ addr := DI->netmkaddr(dialu.host, "tcp", port);
W->log(c, sys->sprint("http: dialing %s", addr));
- (ok, net) := sys->dial(addr, nil);
- if(ok < 0) {
+ net := DI->dial(addr, nil);
+ if(net == nil) {
mrep = W->usererr(r, sys->sprint("%r"));
break redirloop;
}
diff --git a/appl/svc/webget/webget.b b/appl/svc/webget/webget.b
index c3c3aed8..8ae415a3 100644
--- a/appl/svc/webget/webget.b
+++ b/appl/svc/webget/webget.b
@@ -48,6 +48,9 @@ include "string.m";
include "bufio.m";
B: Bufio;
+include "dial.m";
+ DI: Dial;
+
include "message.m";
M: Message;
Msg: import M;
@@ -158,7 +161,7 @@ start(ctl: chan of int)
ctl <-= 0;
return;
}
- W->init(M, S, B, U, log);
+ W->init(M, S, B, U, DI, log);
loadtransmod();
diff --git a/appl/svc/webget/wgutils.b b/appl/svc/webget/wgutils.b
index 2094f7a3..720edebe 100644
--- a/appl/svc/webget/wgutils.b
+++ b/appl/svc/webget/wgutils.b
@@ -9,6 +9,8 @@ include "string.m";
include "bufio.m";
+include "dial.m";
+
include "imagefile.m";
readgif, readjpg, readxbitmap: RImagefile;
@@ -98,7 +100,7 @@ mnames := array[] of {
"text/xml"
};
-init(m: Message, s: String, b: Bufio, u: Url, lfd: ref Sys->FD)
+init(m: Message, s: String, b: Bufio, u: Url, di: Dial, lfd: ref Sys->FD)
{
sys = load Sys Sys->PATH;
@@ -106,6 +108,7 @@ init(m: Message, s: String, b: Bufio, u: Url, lfd: ref Sys->FD)
S = s;
B = b;
U = u;
+ DI = di;
logfd = lfd;
T = load StringIntTab StringIntTab->PATH;
readgif = load RImagefile RImagefile->READGIFPATH;
diff --git a/appl/svc/webget/wgutils.m b/appl/svc/webget/wgutils.m
index 8efb14c1..36a5bdb6 100644
--- a/appl/svc/webget/wgutils.m
+++ b/appl/svc/webget/wgutils.m
@@ -33,6 +33,7 @@ WebgetUtils: module
B: Bufio;
S: String;
U: Url;
+ DI: Dial;
# media types (must track mnames array in wgutils.b)
UnknownType,
@@ -43,7 +44,7 @@ WebgetUtils: module
AudioBasic,
VideoMpeg, VideoQuicktime, Soap, TextXml: con iota;
- init : fn(m: Message, s: String, b: Bufio, u: Url, logfd: ref Sys->FD);
+ init : fn(m: Message, s: String, b: Bufio, u: Url, di: Dial, logfd: ref Sys->FD);
usererr: fn(r: ref Req, msg: string) : ref Message->Msg;
okprefix: fn(r: ref Req, mrep: ref Message->Msg);
getdata: fn(io: ref Bufio->Iobuf, m: ref Message->Msg,