add loggin switch
This commit is contained in:
@@ -72,3 +72,4 @@ http://localhost:8080/raw/https://www.google.com
|
|||||||
| `USER_AGENT` | User agent to emulate | `Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)` |
|
| `USER_AGENT` | User agent to emulate | `Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)` |
|
||||||
| `X_FORWARDED_FOR` | IP Forwarder address | `66.249.66.1` |
|
| `X_FORWARDED_FOR` | IP Forwarder address | `66.249.66.1` |
|
||||||
| `USERPASS` | Enables Basic Auth, format `admin:123456` | |
|
| `USERPASS` | Enables Basic Auth, format `admin:123456` | |
|
||||||
|
| `LOG_URLS` | Log fetched URL's | `true` |
|
||||||
|
|||||||
@@ -41,13 +41,16 @@ func fetchSite(urlpath string, queries map[string]string) (string, *http.Request
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
urlQuery = strings.TrimSuffix(urlQuery, "&")
|
urlQuery = strings.TrimSuffix(urlQuery, "&")
|
||||||
|
urlQuery = strings.TrimSuffix(urlQuery, "?")
|
||||||
|
|
||||||
u, err := url.Parse(urlpath)
|
u, err := url.Parse(urlpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, nil, err
|
return "", nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println(u.String() + urlQuery)
|
if os.Getenv("LOG_URLS ") == "" || os.Getenv("NOLOGS") == "true" {
|
||||||
|
log.Println(u.String() + urlQuery)
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch the site
|
// Fetch the site
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
|
|||||||
Reference in New Issue
Block a user