File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 22
22
memprofile = flag .String ("memprofile" , "" , "write memory profile to this file" )
23
23
)
24
24
25
- func loggingMiddleware (next http.Handler ) http.Handler {
25
+ func loggingMiddleware (addr string , next http.Handler ) http.Handler {
26
26
return http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
27
+ if r .URL .Path == "/loop" {
28
+ _ , err := http .Get ("http://" + addr )
29
+ log .Println (err )
30
+ }
31
+
27
32
rb , _ := httputil .DumpRequest (r , false )
28
33
log .Println (string (rb ))
29
34
next .ServeHTTP (w , r )
@@ -45,7 +50,7 @@ func main() {
45
50
46
51
Debug (0 , "Started example file server for current directory on address " , args [1 ])
47
52
48
- log .Fatal (http .ListenAndServe (args [1 ], loggingMiddleware (http .FileServer (http .Dir (dir )))))
53
+ log .Fatal (http .ListenAndServe (args [1 ], loggingMiddleware (args [ 1 ], http .FileServer (http .Dir (dir )))))
49
54
} else {
50
55
flag .Parse ()
51
56
checkSettings ()
You can’t perform that action at this time.
0 commit comments