Skip to content

Commit f10429d

Browse files
committed
Set Go 1.13.10 as the default Go version until macOS segfault is fixed
See upstream bytecodealliance/wasmtime-go#10 and golang/go#39079
1 parent d9095d8 commit f10429d

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.13.10

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/khan/fastlike
22

3-
go 1.14
3+
go 1.13
44

55
require (
66
github.com/bytecodealliance/wasmtime-go v0.16.1

instance.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ type Instance struct {
3030

3131
// ServeHTTP serves the supplied request and response pair. This is not safe to call twice.
3232
func (i *Instance) ServeHTTP(w http.ResponseWriter, r *http.Request) {
33-
if strings.Contains(strings.Join(r.Header.Values("cdn-loop"), "\x00"), "fastlike") {
33+
var loops, ok = r.Header[http.CanonicalHeaderKey("cdn-loop")]
34+
if !ok {
35+
loops = []string{""}
36+
}
37+
38+
if strings.Contains(strings.Join(loops, "\x00"), "fastlike") {
3439
// immediately respond with a loop detection
3540
w.WriteHeader(http.StatusLoopDetected)
3641
w.Write([]byte("Loop detected! This request has already come through your fastly program."))

xqd_request.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,13 @@ func (i *Instance) xqd_req_header_values_get(handle int32, name_addr int32, name
161161
}
162162

163163
var header = http.CanonicalHeaderKey(string(buf))
164-
var values = r.Header.Values(header)
165-
166164
fmt.Printf("\tlooking for header %s\n", header)
167165

166+
var values, ok = r.Header[header]
167+
if !ok {
168+
values = []string{}
169+
}
170+
168171
// Sort the values otherwise cursors don't work
169172
sort.Strings(values[:])
170173

xqd_response.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ func (i *Instance) xqd_resp_header_values_get(handle int32, name_addr int32, nam
9191
}
9292

9393
var header = http.CanonicalHeaderKey(string(buf))
94-
var values = w.Header.Values(header)
94+
var values, ok = w.Header[header]
95+
if !ok {
96+
values = []string{}
97+
}
9598

9699
fmt.Printf("\tlooking for header %s\n", header)
97100

0 commit comments

Comments
 (0)