Comments
This commit is contained in:
parent
b9dd0db98b
commit
6ee48dd629
5
main.go
5
main.go
@ -30,8 +30,6 @@ func MakeVarnishList() []string {
|
||||
// PurgeHandler handles PURGE request to broadcast it to all varnish instances.
|
||||
func PurgeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var resp http.Response
|
||||
|
||||
// Retrieve URL sent and send an HTTP PURGE request to all varnish servers.
|
||||
url := r.URL.String()
|
||||
SendToVarnish(url)
|
||||
io.WriteString(w, resp.Status)
|
||||
@ -40,6 +38,9 @@ func PurgeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
func SendToVarnish(url string) int {
|
||||
var status int
|
||||
var respListStatus []string
|
||||
|
||||
// Take url to ban as argument.
|
||||
// Loop over the list of Varnish servers and send PURGE request to each.
|
||||
for i := 0; i < len(varnishList); i++ {
|
||||
client := &http.Client{}
|
||||
domain := strings.Trim(varnishList[i], "\r\n")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user