| OLD | NEW |
| 1 package main | 1 package main |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "encoding/json" | 4 "encoding/json" |
| 5 "flag" | 5 "flag" |
| 6 "fmt" | 6 "fmt" |
| 7 "io/ioutil" | 7 "io/ioutil" |
| 8 "net/http" | 8 "net/http" |
| 9 "os" | 9 "os" |
| 10 "path/filepath" | 10 "path/filepath" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 router.HandleFunc("/", templateHandler("index.html")).Methods("GET") | 365 router.HandleFunc("/", templateHandler("index.html")).Methods("GET") |
| 366 router.HandleFunc("/_/details", polyDetailsHandler).Methods("GET") | 366 router.HandleFunc("/_/details", polyDetailsHandler).Methods("GET") |
| 367 router.HandleFunc("/_/diff", polyDiffJSONDigestHandler).Methods("GET") | 367 router.HandleFunc("/_/diff", polyDiffJSONDigestHandler).Methods("GET") |
| 368 router.HandleFunc("/_/hashes", polyAllHashesHandler).Methods("GET") | 368 router.HandleFunc("/_/hashes", polyAllHashesHandler).Methods("GET") |
| 369 router.HandleFunc("/_/ignores", polyIgnoresJSONHandler).Methods("GET") | 369 router.HandleFunc("/_/ignores", polyIgnoresJSONHandler).Methods("GET") |
| 370 router.HandleFunc("/_/ignores/add/", polyIgnoresAddHandler).Methods("POS
T") | 370 router.HandleFunc("/_/ignores/add/", polyIgnoresAddHandler).Methods("POS
T") |
| 371 router.HandleFunc("/_/ignores/del/{id}", polyIgnoresDeleteHandler).Metho
ds("POST") | 371 router.HandleFunc("/_/ignores/del/{id}", polyIgnoresDeleteHandler).Metho
ds("POST") |
| 372 router.HandleFunc("/_/ignores/save/{id}", polyIgnoresUpdateHandler).Meth
ods("POST") | 372 router.HandleFunc("/_/ignores/save/{id}", polyIgnoresUpdateHandler).Meth
ods("POST") |
| 373 router.HandleFunc("/_/list", polyListTestsHandler).Methods("GET") | 373 router.HandleFunc("/_/list", polyListTestsHandler).Methods("GET") |
| 374 router.HandleFunc("/_/paramset", polyParamsHandler).Methods("GET") | 374 router.HandleFunc("/_/paramset", polyParamsHandler).Methods("GET") |
| 375 router.HandleFunc("/_/nxn", nxnJSONHandler).Methods("GET") |
| 375 router.HandleFunc("/_/search", polySearchJSONHandler).Methods("GET") | 376 router.HandleFunc("/_/search", polySearchJSONHandler).Methods("GET") |
| 376 router.HandleFunc("/_/status/{test}", polyTestStatusHandler).Methods("GE
T") | 377 router.HandleFunc("/_/status/{test}", polyTestStatusHandler).Methods("GE
T") |
| 377 router.HandleFunc("/_/test", polyTestHandler).Methods("POST") | 378 router.HandleFunc("/_/test", polyTestHandler).Methods("POST") |
| 378 router.HandleFunc("/_/triage", polyTriageHandler).Methods("POST") | 379 router.HandleFunc("/_/triage", polyTriageHandler).Methods("POST") |
| 379 router.HandleFunc("/_/triagelog", polyTriageLogHandler).Methods("GET") | 380 router.HandleFunc("/_/triagelog", polyTriageLogHandler).Methods("GET") |
| 380 router.HandleFunc("/byblame", byBlameHandler).Methods("GET") | 381 router.HandleFunc("/byblame", byBlameHandler).Methods("GET") |
| 382 router.HandleFunc("/cluster", templateHandler("cluster.html")).Methods("
GET") |
| 381 router.HandleFunc("/search2", search2Handler).Methods("GET") // search2
is currently unused, will replace /search soon. | 383 router.HandleFunc("/search2", search2Handler).Methods("GET") // search2
is currently unused, will replace /search soon. |
| 382 router.HandleFunc("/cmp/{test}", templateHandler("compare.html")).Method
s("GET") | 384 router.HandleFunc("/cmp/{test}", templateHandler("compare.html")).Method
s("GET") |
| 383 router.HandleFunc("/detail", templateHandler("single.html")).Methods("GE
T") | 385 router.HandleFunc("/detail", templateHandler("single.html")).Methods("GE
T") |
| 384 router.HandleFunc("/diff", templateHandler("diff.html")).Methods("GET") | 386 router.HandleFunc("/diff", templateHandler("diff.html")).Methods("GET") |
| 385 router.HandleFunc("/help", templateHandler("help.html")).Methods("GET") | 387 router.HandleFunc("/help", templateHandler("help.html")).Methods("GET") |
| 386 router.HandleFunc("/ignores", templateHandler("ignores.html")).Methods("
GET") | 388 router.HandleFunc("/ignores", templateHandler("ignores.html")).Methods("
GET") |
| 387 router.HandleFunc("/loginstatus/", login.StatusHandler) | 389 router.HandleFunc("/loginstatus/", login.StatusHandler) |
| 388 router.HandleFunc("/logout/", login.LogoutHandler) | 390 router.HandleFunc("/logout/", login.LogoutHandler) |
| 389 router.HandleFunc("/search", templateHandler("search.html")).Methods("GE
T") | 391 router.HandleFunc("/search", templateHandler("search.html")).Methods("GE
T") |
| 390 router.HandleFunc("/triagelog", templateHandler("triagelog.html")).Metho
ds("GET") | 392 router.HandleFunc("/triagelog", templateHandler("triagelog.html")).Metho
ds("GET") |
| 391 | 393 |
| 392 // Add the necessary middleware and have the router handle all requests. | 394 // Add the necessary middleware and have the router handle all requests. |
| 393 // By structuring the middleware this way we only log requests that are | 395 // By structuring the middleware this way we only log requests that are |
| 394 // authenticated. | 396 // authenticated. |
| 395 rootHandler := util.LoggingGzipRequestResponse(router) | 397 rootHandler := util.LoggingGzipRequestResponse(router) |
| 396 if *forceLogin { | 398 if *forceLogin { |
| 397 rootHandler = login.ForceAuth(rootHandler, OAUTH2_CALLBACK_PATH) | 399 rootHandler = login.ForceAuth(rootHandler, OAUTH2_CALLBACK_PATH) |
| 398 } | 400 } |
| 399 | 401 |
| 400 // The polyStatusHandler is being polled, so we exclude it from logging. | 402 // The polyStatusHandler is being polled, so we exclude it from logging. |
| 401 http.HandleFunc("/_/trstatus", polyStatusHandler) | 403 http.HandleFunc("/_/trstatus", polyStatusHandler) |
| 402 http.Handle("/", rootHandler) | 404 http.Handle("/", rootHandler) |
| 403 | 405 |
| 404 // Start the server | 406 // Start the server |
| 405 glog.Infoln("Serving on http://127.0.0.1" + *port) | 407 glog.Infoln("Serving on http://127.0.0.1" + *port) |
| 406 glog.Fatal(http.ListenAndServe(*port, nil)) | 408 glog.Fatal(http.ListenAndServe(*port, nil)) |
| 407 } | 409 } |
| OLD | NEW |