| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 router.HandleFunc("/_/ignores/add/", polyIgnoresAddHandler).Methods("POS
T") | 462 router.HandleFunc("/_/ignores/add/", polyIgnoresAddHandler).Methods("POS
T") |
| 463 router.HandleFunc("/_/ignores/del/{id}", polyIgnoresDeleteHandler).Metho
ds("POST") | 463 router.HandleFunc("/_/ignores/del/{id}", polyIgnoresDeleteHandler).Metho
ds("POST") |
| 464 router.HandleFunc("/_/ignores/save/{id}", polyIgnoresUpdateHandler).Meth
ods("POST") | 464 router.HandleFunc("/_/ignores/save/{id}", polyIgnoresUpdateHandler).Meth
ods("POST") |
| 465 router.HandleFunc("/_/list", polyListTestsHandler).Methods("GET") | 465 router.HandleFunc("/_/list", polyListTestsHandler).Methods("GET") |
| 466 router.HandleFunc("/_/paramset", polyParamsHandler).Methods("GET") | 466 router.HandleFunc("/_/paramset", polyParamsHandler).Methods("GET") |
| 467 router.HandleFunc("/_/search", polySearchJSONHandler).Methods("GET") | 467 router.HandleFunc("/_/search", polySearchJSONHandler).Methods("GET") |
| 468 router.HandleFunc("/_/status/{test}", polyTestStatusHandler).Methods("GE
T") | 468 router.HandleFunc("/_/status/{test}", polyTestStatusHandler).Methods("GE
T") |
| 469 router.HandleFunc("/_/test", polyTestHandler).Methods("POST") | 469 router.HandleFunc("/_/test", polyTestHandler).Methods("POST") |
| 470 router.HandleFunc("/_/triage", polyTriageHandler).Methods("POST") | 470 router.HandleFunc("/_/triage", polyTriageHandler).Methods("POST") |
| 471 router.HandleFunc("/_/triagelog", polyTriageLogHandler).Methods("GET") | 471 router.HandleFunc("/_/triagelog", polyTriageLogHandler).Methods("GET") |
| 472 router.HandleFunc("/byblame", byBlameHandler).Methods("GET") |
| 473 router.HandleFunc("/blamelist", blameListHandler).Methods("GET") |
| 472 router.HandleFunc("/cmp/{test}", templateHandler("compare.html")).Method
s("GET") | 474 router.HandleFunc("/cmp/{test}", templateHandler("compare.html")).Method
s("GET") |
| 473 router.HandleFunc("/detail", templateHandler("single.html")).Methods("GE
T") | 475 router.HandleFunc("/detail", templateHandler("single.html")).Methods("GE
T") |
| 474 router.HandleFunc("/diff", templateHandler("diff.html")).Methods("GET") | 476 router.HandleFunc("/diff", templateHandler("diff.html")).Methods("GET") |
| 475 router.HandleFunc("/help", templateHandler("help.html")).Methods("GET") | 477 router.HandleFunc("/help", templateHandler("help.html")).Methods("GET") |
| 476 router.HandleFunc("/ignores", templateHandler("ignores.html")).Methods("
GET") | 478 router.HandleFunc("/ignores", templateHandler("ignores.html")).Methods("
GET") |
| 477 router.HandleFunc("/loginstatus/", login.StatusHandler) | 479 router.HandleFunc("/loginstatus/", login.StatusHandler) |
| 478 router.HandleFunc("/logout/", login.LogoutHandler) | 480 router.HandleFunc("/logout/", login.LogoutHandler) |
| 479 router.HandleFunc("/search", templateHandler("search.html")).Methods("GE
T") | 481 router.HandleFunc("/search", templateHandler("search.html")).Methods("GE
T") |
| 480 router.HandleFunc("/triagelog", templateHandler("triagelog.html")).Metho
ds("GET") | 482 router.HandleFunc("/triagelog", templateHandler("triagelog.html")).Metho
ds("GET") |
| 481 | 483 |
| 482 // Add the necessary middleware and have the router handle all requests. | 484 // Add the necessary middleware and have the router handle all requests. |
| 483 // By structuring the middleware this way we only log requests that are | 485 // By structuring the middleware this way we only log requests that are |
| 484 // authenticated. | 486 // authenticated. |
| 485 rootHandler := util.LoggingGzipRequestResponse(router) | 487 rootHandler := util.LoggingGzipRequestResponse(router) |
| 486 if *forceLogin { | 488 if *forceLogin { |
| 487 rootHandler = login.ForceAuth(rootHandler, OAUTH2_CALLBACK_PATH) | 489 rootHandler = login.ForceAuth(rootHandler, OAUTH2_CALLBACK_PATH) |
| 488 } | 490 } |
| 489 | 491 |
| 490 // The polyStatusHandler is being polled, so we exclude it from logging. | 492 // The polyStatusHandler is being polled, so we exclude it from logging. |
| 491 http.HandleFunc("/_/trstatus", polyStatusHandler) | 493 http.HandleFunc("/_/trstatus", polyStatusHandler) |
| 492 http.Handle("/", rootHandler) | 494 http.Handle("/", rootHandler) |
| 493 | 495 |
| 494 // Start the server | 496 // Start the server |
| 495 glog.Infoln("Serving on http://127.0.0.1" + *port) | 497 glog.Infoln("Serving on http://127.0.0.1" + *port) |
| 496 glog.Fatal(http.ListenAndServe(*port, nil)) | 498 glog.Fatal(http.ListenAndServe(*port, nil)) |
| 497 } | 499 } |
| OLD | NEW |