From 978c6a36e745c68c76b8a91c2b0899b5a7de4e6f Mon Sep 17 00:00:00 2001 From: Josh de Kock Date: Tue, 29 Mar 2016 23:18:58 +0100 Subject: [PATCH 1/3] http: stopped throwing error on invalid event Event is an optional key, and if it's invalid or non-existent then it can just be assumed as 'none' --- server/http/request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/http/request.go b/server/http/request.go index d824435..45f94be 100644 --- a/server/http/request.go +++ b/server/http/request.go @@ -24,7 +24,7 @@ func announceRequest(r *http.Request, cfg *httpConfig) (*chihaya.AnnounceRequest eventStr, err := q.String("event") if err != nil { - return nil, tracker.ClientError("failed to parse parameter: event") + eventStr = "none" } request.Event, err = event.New(eventStr) if err != nil { From 01abcad893970e706ac0d298437571f2477ccdc8 Mon Sep 17 00:00:00 2001 From: Josh de Kock Date: Wed, 30 Mar 2016 12:50:54 +0100 Subject: [PATCH 2/3] http/request: check if query.ErrKeyNotFound for event --- server/http/request.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/http/request.go b/server/http/request.go index 45f94be..a8ae9d5 100644 --- a/server/http/request.go +++ b/server/http/request.go @@ -23,8 +23,10 @@ func announceRequest(r *http.Request, cfg *httpConfig) (*chihaya.AnnounceRequest request := &chihaya.AnnounceRequest{Params: q} eventStr, err := q.String("event") - if err != nil { - eventStr = "none" + if err == query.ErrKeyNotFound { + eventStr = "" + } else if err != nil { + return nil, tracker.ClientError("failed to parse parameter: event") } request.Event, err = event.New(eventStr) if err != nil { From 816e3aa3ded052a0dcf103fc904703c3632b5b87 Mon Sep 17 00:00:00 2001 From: Josh de Kock Date: Thu, 31 Mar 2016 02:30:34 +0100 Subject: [PATCH 3/3] CONTRIBUTORS: add myself to the contributors list --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 91a6613..4e4f530 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,5 +1,6 @@ # This is the official list of Chihaya contributors, in alphabetical order. Jimmy Zelinskie +Josh de Kock Justin Li Leo Balduf