mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
handle special case when browser also asks for favicon.ico
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@53 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
parent
bcffffbc5e
commit
eb9456d7d5
|
@ -73,9 +73,9 @@ func PostHandler(w http.ResponseWriter, r *http.Request) {
|
|||
writeJson(w, r, e)
|
||||
} else {
|
||||
needle, ne := storage.NewNeedle(r)
|
||||
if ne!=nil{
|
||||
if ne != nil {
|
||||
writeJson(w, r, ne)
|
||||
}else{
|
||||
} else {
|
||||
ret := store.Write(volumeId, needle)
|
||||
m := make(map[string]uint32)
|
||||
m["size"] = ret
|
||||
|
@ -132,7 +132,9 @@ func parseURLPath(path string) (vid, fid, ext string) {
|
|||
sepIndex := strings.LastIndex(path, "/")
|
||||
commaIndex := strings.LastIndex(path[sepIndex:], ",")
|
||||
if commaIndex <= 0 {
|
||||
if "favicon.ico" != path[sepIndex+1:] {
|
||||
log.Println("unknown file id", path[sepIndex+1:])
|
||||
}
|
||||
return
|
||||
}
|
||||
dotIndex := strings.LastIndex(path[sepIndex:], ".")
|
||||
|
@ -158,7 +160,7 @@ func main() {
|
|||
go func() {
|
||||
for {
|
||||
store.Join(*metaServer)
|
||||
time.Sleep(time.Duration(float32(*pulse * 1e3) *(1 + rand.Float32()))*time.Millisecond)
|
||||
time.Sleep(time.Duration(float32(*pulse*1e3)*(1+rand.Float32())) * time.Millisecond)
|
||||
}
|
||||
}()
|
||||
log.Println("store joined at", *metaServer)
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"pkg/util"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Needle struct {
|
||||
|
@ -47,7 +47,9 @@ func NewNeedle(r *http.Request) (n *Needle, e error) {
|
|||
func (n *Needle) ParsePath(fid string) {
|
||||
length := len(fid)
|
||||
if length <= 8 {
|
||||
if length > 0 {
|
||||
log.Println("Invalid fid", fid, "length", length)
|
||||
}
|
||||
return
|
||||
}
|
||||
n.Key, n.Cookie = ParseKeyHash(fid)
|
||||
|
|
Loading…
Reference in a new issue