|
|
@ -1,13 +1,13 @@
|
|
1
|
1
|
package main
|
|
2
|
2
|
|
|
3
|
3
|
import (
|
|
|
4
|
"code.google.com/p/cascadia"
|
|
|
5
|
"code.google.com/p/go.net/html"
|
|
4
|
6
|
"errors"
|
|
5
|
|
"os"
|
|
|
7
|
"fmt"
|
|
6
|
8
|
"net/http"
|
|
7
|
9
|
"net/url"
|
|
8
|
|
"fmt"
|
|
9
|
|
"code.google.com/p/go.net/html"
|
|
10
|
|
"code.google.com/p/cascadia"
|
|
|
10
|
"os"
|
|
11
|
11
|
)
|
|
12
|
12
|
|
|
13
|
13
|
var faviconCache = make(map[string]string)
|
|
|
@ -22,7 +22,7 @@ func main() {
|
|
22
|
22
|
}
|
|
23
|
23
|
}
|
|
24
|
24
|
|
|
25
|
|
func HandleGetFavicon (w http.ResponseWriter, r *http.Request) {
|
|
|
25
|
func HandleGetFavicon(w http.ResponseWriter, r *http.Request) {
|
|
26
|
26
|
url := r.URL.Query()["url"][0]
|
|
27
|
27
|
favicon, err := GetFaviconCached(url)
|
|
28
|
28
|
if err != nil {
|
|
|
@ -99,7 +99,7 @@ func GetCanonicalFavicon(u string) (string, error) {
|
|
99
|
99
|
return "", err
|
|
100
|
100
|
}
|
|
101
|
101
|
faviconUrl := fmt.Sprintf("%s://%s/favicon.ico", parsed.Scheme, parsed.Host)
|
|
102
|
|
|
|
|
102
|
|
|
103
|
103
|
resp, err := http.Get(faviconUrl)
|
|
104
|
104
|
fmt.Println("get favicon.ico", resp, err)
|
|
105
|
105
|
if err != nil {
|