Merge lp:~vds/usso/initialize_headers_before_assignment into lp:usso

Proposed by Vincenzo Di Somma
Status: Merged
Merged at revision: 26
Proposed branch: lp:~vds/usso/initialize_headers_before_assignment
Merge into: lp:usso
Diff against target: 35 lines (+3/-7)
2 files modified
oauth.go (+3/-0)
usso.go (+0/-7)
To merge this branch: bzr merge lp:~vds/usso/initialize_headers_before_assignment
Reviewer Review Type Date Requested Status
Matthew Williams (community) Approve
Andrew W. Deane (community) Approve
usso Hackers Pending
Review via email: mp+148565@code.launchpad.net

Commit message

Request Header map needs to be initialized before Header.Add can be used. The seed initialization is not needed in that module anymore.

Description of the change

Request Header map needs to be initialized before Header.Add can be used. The seed initialization is not needed in that module anymore.

To post a comment you must log in.
Revision history for this message
Andrew W. Deane (andrew-w-deane) :
review: Approve
Revision history for this message
Matthew Williams (mattyw) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'oauth.go'
2--- oauth.go 2013-02-05 12:37:03 +0000
3+++ oauth.go 2013-02-14 22:19:25 +0000
4@@ -140,6 +140,9 @@
5 func (ssodata *SSOData) SignRequest(
6 rp *RequestParameters, req *http.Request) error {
7 auth, error := ssodata.GetAuthorizationHeader(rp)
8+ if req.Header == nil {
9+ req.Header = make(map[string][]string)
10+ }
11 req.Header.Add("Authorization", auth)
12 return error
13 }
14
15=== modified file 'usso.go'
16--- usso.go 2013-01-31 17:57:52 +0000
17+++ usso.go 2013-02-14 22:19:25 +0000
18@@ -6,17 +6,10 @@
19 "fmt"
20 "io/ioutil"
21 "log"
22- "math/rand"
23 "net/http"
24 "strings"
25- "time"
26 )
27
28-func init() {
29- // Initialize the random generator.
30- rand.Seed(time.Now().UTC().UnixNano())
31-}
32-
33 type UbuntuSSOServer struct {
34 baseUrl string
35 }

Subscribers

People subscribed via source and target branches

to all changes: