Skip to content

Commit d3143d3

Browse files
committed
Fixed issue parsing invalid cookies
The logger prints the request method
1 parent 793090a commit d3143d3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

request.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ func (r *Request) parseCookies() (err os.Error) {
242242
for _, cookie := range (cookies) {
243243
cookie = strings.TrimSpace(cookie)
244244
parts := strings.Split(cookie, "=", 2)
245+
if len(parts) != 2 {
246+
continue
247+
}
245248
r.Cookies[parts[0]] = parts[1]
246249
}
247250
}

web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func routeHandler(req *Request, c conn) {
216216

217217
//log the request
218218
if len(req.URL.RawQuery) == 0 {
219-
log.Stdout(requestPath)
219+
log.Stdout(req.Method + " " + requestPath)
220220
} else {
221221
log.Stdout(requestPath + "?" + req.URL.RawQuery)
222222
}

0 commit comments

Comments
 (0)