Просмотр исходного кода

Don't panic if the passed url is empty

The proper way would be to return a 4xx error, but for now this
suffices.
Lucas Stadler лет назад: 8
Родитель
Сommit
82bceba787
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      go/favicon/favicon.go

+ 2 - 2
go/favicon/favicon.go

66
func HandleProxy(w http.ResponseWriter, r *http.Request) {
66
func HandleProxy(w http.ResponseWriter, r *http.Request) {
67
	w.Header().Set("Cache-Control", "max-age=2419200")
67
	w.Header().Set("Cache-Control", "max-age=2419200")
68
68
69
	url := r.URL.Query()["url"][0]
69
	url := r.URL.Query().Get("url")
70
	favicon, err := GetFaviconCached(url)
70
	favicon, err := GetFaviconCached(url)
71
	if err != nil {
71
	if err != nil {
72
		fmt.Printf("Error: '%s': %s\n", url, err)
72
		fmt.Printf("Error: '%s': %s\n", url, err)
138
}
138
}
139
139
140
func HandleGetFavicon(w http.ResponseWriter, r *http.Request) {
140
func HandleGetFavicon(w http.ResponseWriter, r *http.Request) {
141
	url := r.URL.Query()["url"][0]
141
	url := r.URL.Query().Get("url")
142
	favicon, err := GetFaviconCached(url)
142
	favicon, err := GetFaviconCached(url)
143
	if err != nil {
143
	if err != nil {
144
		fmt.Printf("Error: '%s': %s\n", url, err)
144
		fmt.Printf("Error: '%s': %s\n", url, err)