summaryrefslogtreecommitdiff
path: root/lib/http
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-08-02 13:20:59 -0700
committerOri Bernstein <ori@markovcorp.com>2017-08-02 13:21:30 -0700
commita77a83ee673ab4bef38e336345f3196c814bdcf7 (patch)
tree2a324174c9e99f6a80f9dc8323e7627ee317131f /lib/http
parentb585eb744cebded7abbf014c3430f05b64122371 (diff)
downloadmc-a77a83ee673ab4bef38e336345f3196c814bdcf7.tar.gz
Switch to use ':' for loops.
Diffstat (limited to 'lib/http')
-rw-r--r--lib/http/client.myr4
-rw-r--r--lib/http/h.myr6
-rw-r--r--lib/http/parse.myr2
-rw-r--r--lib/http/server.myr2
-rw-r--r--lib/http/srvdot.myr2
-rw-r--r--lib/http/url.myr8
6 files changed, 12 insertions, 12 deletions
diff --git a/lib/http/client.myr b/lib/http/client.myr
index c5cb221..d3af84a 100644
--- a/lib/http/client.myr
+++ b/lib/http/client.myr
@@ -140,7 +140,7 @@ const request = {s, method, r, data
| `std.Some d: ioput(s, "Content-Length: {}\r\n", d.len)
| `std.None: /* nothing to do */
;;
- for (k, v) in r.hdrs
+ for (k, v) : r.hdrs
ioput(s, "{}: {}\r\n", k, v)
;;
ioput(s, "\r\n")
@@ -272,7 +272,7 @@ const fmtmethod = {sb, ap, opt
}
const freeresp = {r
- for (k, v) in r.hdrs
+ for (k, v) : r.hdrs
std.slfree(k)
std.slfree(v)
;;
diff --git a/lib/http/h.myr b/lib/http/h.myr
index 50ea8ea..9a00e2e 100644
--- a/lib/http/h.myr
+++ b/lib/http/h.myr
@@ -23,7 +23,7 @@ const main = {args
data = ""
hdrs = [][:]
out = ""
- for opt in cmd.opts
+ for opt : cmd.opts
match opt
| ('m', m): method = m
| ('d', d): data = d
@@ -34,7 +34,7 @@ const main = {args
;;
;;
- for url in cmd.args
+ for url : cmd.args
if !std.hasprefix(url, "http")
url = std.fmt("http://{}", url)
;;
@@ -56,7 +56,7 @@ const main = {args
| `std.Ok resp:
if showhdr
std.put("status: {}\n", resp.status)
- for (k, v) in resp.hdrs
+ for (k, v) : resp.hdrs
std.put("{}: {}\n", k, v)
;;
;;
diff --git a/lib/http/parse.myr b/lib/http/parse.myr
index ca72027..d9f8b34 100644
--- a/lib/http/parse.myr
+++ b/lib/http/parse.myr
@@ -229,7 +229,7 @@ const getenc = {r
}
const findhdr = {r, name
- for (k, v) in r.hdrs
+ for (k, v) : r.hdrs
if std.strcaseeq(k, name)
-> `std.Some v
;;
diff --git a/lib/http/server.myr b/lib/http/server.myr
index a892b1c..e6c1923 100644
--- a/lib/http/server.myr
+++ b/lib/http/server.myr
@@ -59,7 +59,7 @@ const respond = {srv, s, resp
bio.put(s.f, "HTTP/1.1 {} {}\r\n", resp.status, statusstr(resp.status))
bio.put(s.f, "Content-Length: {}\r\n", resp.body.len)
bio.put(s.f, "Encoding: {}\r\n", resp.enc)
- for (k, v) in resp.hdrs
+ for (k, v) : resp.hdrs
bio.put(s.f, "{}: {}\r\n", k, v)
;;
bio.put(s.f, "\r\n")
diff --git a/lib/http/srvdot.myr b/lib/http/srvdot.myr
index 636284e..c47c4ce 100644
--- a/lib/http/srvdot.myr
+++ b/lib/http/srvdot.myr
@@ -9,7 +9,7 @@ const main = {args
.opts = [[.opt='a', .arg="ann", .desc="announce on `ann`"]][:]
])
ann = "tcp!localhost!8080"
- for opt in cmd.opts
+ for opt : cmd.opts
match opt
| ('a', a): ann = a
| _: std.die("unreachable")
diff --git a/lib/http/url.myr b/lib/http/url.myr
index b4ffd2f..3d69c4e 100644
--- a/lib/http/url.myr
+++ b/lib/http/url.myr
@@ -25,7 +25,7 @@ const urlfmt = {sb, ap, opts
showhost = true
url = std.vanext(ap)
- for o in opts
+ for o : opts
match o
| ("p", ""): showhost = false
| _: std.fatal("unknown param\n")
@@ -52,7 +52,7 @@ const urlfmt = {sb, ap, opts
if url.params.len > 0
sep = '?'
- for (k, v) in url.params
+ for (k, v) : url.params
std.sbfmt(sb, "{}{}={}", sep, k, v)
sep = '&'
;;
@@ -155,7 +155,7 @@ const parseparams = {url
;;
params = [][:]
- for sp in std.bysplit(url#, "&")
+ for sp : std.bysplit(url#, "&")
if std.bstrsplit(kvp[:], sp, "=").len != 2
-> `std.Err `Esyntax
;;
@@ -169,7 +169,7 @@ const hostname = {url
var len, host
len = 0
- for c in std.bychar(url#)
+ for c : std.bychar(url#)
match c
| ':': break
| '/': break