Changeset 4 in code for trunk/morty.go
- Timestamp:
- Oct 17, 2016, 11:26:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/morty.go
r3 r4 15 15 "regexp" 16 16 "strings" 17 "time" 17 18 18 19 "github.com/valyala/fasthttp" … … 95 96 96 97 type Proxy struct { 97 Key []byte 98 Key []byte 99 RequestTimeout time.Duration 98 100 } 99 101 … … 112 114 </div> 113 115 <style> 114 #mortyheader { position: fixed; top: 15%%; left: 0; max-width: 10em; color: #444; overflow: hidden; z-index: 1 000; }116 #mortyheader { position: fixed; top: 15%%; left: 0; max-width: 10em; color: #444; overflow: hidden; z-index: 110000; } 115 117 #mortyheader a { color: #3498db; } 116 118 #mortyheader div { padding: 8px; font-size: 0.9em; border-width: 4px 4px 4px 0; border-style: solid; border-color: #3498db; background: #FFF; } … … 169 171 } 170 172 171 if p.breakOnError(ctx, CLIENT.Do (req, resp)) {173 if p.breakOnError(ctx, CLIENT.DoTimeout(req, resp, p.RequestTimeout)) { 172 174 return 173 175 } … … 516 518 return false 517 519 } 520 log.Println("error:", err) 518 521 ctx.SetStatusCode(404) 519 522 ctx.SetContentType("text/html") … … 543 546 listen := flag.String("listen", "127.0.0.1:3000", "Listen address") 544 547 key := flag.String("key", "", "HMAC url validation key (hexadecimal encoded) - leave blank to disable") 548 requestTimeout := flag.Uint("timeout", 2, "Request timeout") 545 549 flag.Parse() 546 550 547 p := &Proxy{ }551 p := &Proxy{RequestTimeout: time.Duration(*requestTimeout) * time.Second} 548 552 549 553 if *key != "" {
Note:
See TracChangeset
for help on using the changeset viewer.