about summary refs log tree commit diff stats
path: root/arc/.traces/match-at-empty-text
blob: 94cce73f0ce22c92628676df58b7a0f8d1fbcc6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60<
c{0: 0 (((1 string-address)) <- ((new)) ) -- nil
c{0: 1 (((2 string-address)) <- ((new)) abc) -- nil
c{0: 2 (((3 boolean)) <- ((match-at)) ((1 string-address)) ((2 string-address)) ((0 literal))) -- nil
c{1: 0 ✓ (((1 string-address)) <- ((new)) )
c{1: 1 ✓ (((2 string-address)) <- ((new)) abc)
c{1: 2 ✓ (((3 boolean)) <- ((match-at)) ((1 string-address)) ((2 string-address)) ((0 literal)))
cn0: convert-names in main
cn0: (((1 string-address)) <- ((new)) ) nil nil
cn0: checking arg 
cn0: checking oarg ((1 string-address))
maybe-add: ((1 string-address))
cn0: (((2 string-address)) <- ((new)) abc) nil nil
cn0: checking arg abc
cn0: checking oarg ((2 string-address))
maybe-add: ((2 string-address))
cn0: (((3 boolean)) <- ((match-at)) ((1 string-address)) ((2 string-address)) ((0 literal))) nil nil
cn0: checking arg ((1 string-address))
maybe-add: ((1 string-address))
cn0: checking arg ((2 string-address))
maybe-add: ((2 string-address))
cn0: checking arg ((0 literal))
cn0: checking oarg ((3 boolean))
maybe-add: ((3 boolean))
cn1: (((1 string-address)) <- ((new)) )
cn1: (((2 string-address)) <- ((new)) abc)
cn1: (((3 boolean)) <- ((match-at)) ((1 string-address)) ((2 string-address)) ((0 literal)))
schedule: main
run: main 0: (((1 string-address)) <- ((new)) )
run: main 0: 1000 => ((1 string-address))
mem: ((1 string-address)): 1 <= 1000
run: main 1: (((2 string-address)) <- ((new)) abc)
run: main 1: 1001 => ((2 string-address))
mem: ((2 string-address)): 2 <= 1001
run: main 2: (((3 boolean)) <- ((match-at)) ((1 string-address)) ((2 string-address)) ((0 literal)))
mem: ((1 string-address)) => 1000
mem: ((2 string-address)) => 1001
run: match-at/main 0: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
run: match-at/main 0: 1005 => ((default-space space-address))
run: match-at/main 1: (((1 string-address)) <- ((next-input)))
arg: nil 0 (1000 1001 0)
run: match-at/main 1: 1000 => ((1 string-address))
mem: ((1 string-address)): 1007 <= 1000
run: match-at/main 2: (((2 string-address)) <- ((next-input)))
arg: nil 1 (1000 1001 0)
run: match-at/main 2: 1001 => ((2 string-address))
mem: ((2 string-address)): 1008 <= 1001
run: match-at/main 3: (((3 integer)) <- ((next-input)))
arg: nil 2 (1000 1001 0)
run: match-at/main 3: 0 => ((3 integer))
mem: ((3 integer)): 1009 <= 0
run: match-at/main 4: (((4 integer)) <- ((length)) ((2 string-address) (deref)))
array-len: ((2 string-address) (deref))
mem: ((1001 integer) (raw)) => 3
run: match-at/main 4: 3 => ((4 integer))
mem: ((4 integer)): 1010 <= 3
run: match-at/main 5: (((5 integer)) <- ((length)) ((1 string-address) (deref)))
array-len: ((1 string-address) (deref))
mem: ((1000 integer) (raw)) => 0
run: match-at/main 5: 0 => ((5 integer))
mem: ((5 integer)): 1011 <= 0
run: match-at/main 6: (((5 integer)) <- ((subtract)) ((5 integer)) ((4 integer)))
mem: ((5 integer)) => 0
mem: ((4 integer)) => 3
run: match-at/main 6: -3 => ((5 integer))
mem: ((5 integer)): 1011 <= -3
run: match-at/main 7: (((6 boolean)) <- ((lesser-or-equal)) ((3 integer)) ((5 integer)))
mem: ((3 integer)) => 0
mem: ((5 integer)) => -3
run: match-at/main 7: nil => ((6 boolean))
mem: ((6 boolean)): 1012 <= nil
run: match-at/main 8: (((jump-if)) ((6 boolean)) ((1 offset)))
mem: ((6 boolean)) => nil
run: match-at/main 9: (((reply)) ((nil literal)))
run: main 2: nil => ((3 boolean))
mem: ((3 boolean)): 3 <= nil
schedule: done with routine nil
class="w"> ok { proxied := r.Header[xRealIP] base = strings.Split(proxied[len(proxied)-1], ":") uip = base[0] } return context.WithValue(ctx, ctxKey, uip) } // Retrieves a request's IP address from the request's context func getIPFromCtx(ctx context.Context) net.IP { uip, ok := ctx.Value(ctxKey).(string) if !ok { log.Printf("Couldn't retrieve IP from request\n") } return net.ParseIP(uip) } // Shim function to modify/pass context value to a handler func ipMiddleware(hop http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := newCtxUserIP(r.Context(), r) hop.ServeHTTP(w, r.WithContext(ctx)) }) } func log200(r *http.Request) { useragent := r.Header["User-Agent"] uip := getIPFromCtx(r.Context()) log.Printf("*** %v :: 200 :: %v %v :: %v\n", uip, r.Method, r.URL, useragent) } func log400(w http.ResponseWriter, r *http.Request, err string) { uip := getIPFromCtx(r.Context()) log.Printf("*** %v :: 400 :: %v %v :: %v\n", uip, r.Method, r.URL, err) http.Error(w, "400 Bad Request: "+err, http.StatusBadRequest) } func log404(w http.ResponseWriter, r *http.Request, err error) { useragent := r.Header["User-Agent"] uip := getIPFromCtx(r.Context()) log.Printf("*** %v :: 404 :: %v %v :: %v :: %v\n", uip, r.Method, r.URL, useragent, err.Error()) http.Error(w, err.Error(), http.StatusNotFound) } func log500(w http.ResponseWriter, r *http.Request, err error) { useragent := r.Header["User-Agent"] uip := getIPFromCtx(r.Context()) log.Printf("*** %v :: 500 :: %v %v :: %v :: %v\n", uip, r.Method, r.URL, useragent, err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) }