Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit 819b083

Browse files
authored
Merge pull request #12 from nmulcahey/master
Modify the ordering of 'digest-response'
2 parents 59f5e83 + dd672b1 commit 819b083

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

authorization.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,48 +130,48 @@ func (ah *authorization) toString() string {
130130

131131
buffer.WriteString("Digest ")
132132

133-
if ah.Algorithm != "" {
134-
buffer.WriteString(fmt.Sprintf("algorithm=%s, ", ah.Algorithm))
133+
if ah.Username != "" {
134+
buffer.WriteString(fmt.Sprintf("username=\"%s\", ", ah.Username))
135135
}
136136

137-
if ah.Cnonce != "" {
138-
buffer.WriteString(fmt.Sprintf("cnonce=\"%s\", ", ah.Cnonce))
137+
if ah.Realm != "" {
138+
buffer.WriteString(fmt.Sprintf("realm=\"%s\", ", ah.Realm))
139139
}
140140

141-
if ah.Nc != 0 {
142-
buffer.WriteString(fmt.Sprintf("nc=%08x, ", ah.Nc))
141+
if ah.Nonce != "" {
142+
buffer.WriteString(fmt.Sprintf("nonce=\"%s\", ", ah.Nonce))
143143
}
144144

145-
if ah.Opaque != "" {
146-
buffer.WriteString(fmt.Sprintf("opaque=\"%s\", ", ah.Opaque))
145+
if ah.URI != "" {
146+
buffer.WriteString(fmt.Sprintf("uri=\"%s\", ", ah.URI))
147147
}
148148

149-
if ah.Nonce != "" {
150-
buffer.WriteString(fmt.Sprintf("nonce=\"%s\", ", ah.Nonce))
149+
if ah.Response != "" {
150+
buffer.WriteString(fmt.Sprintf("response=\"%s\", ", ah.Response))
151151
}
152152

153-
if ah.Qop != "" {
154-
buffer.WriteString(fmt.Sprintf("qop=%s, ", ah.Qop))
153+
if ah.Algorithm != "" {
154+
buffer.WriteString(fmt.Sprintf("algorithm=%s, ", ah.Algorithm))
155155
}
156156

157-
if ah.Realm != "" {
158-
buffer.WriteString(fmt.Sprintf("realm=\"%s\", ", ah.Realm))
157+
if ah.Cnonce != "" {
158+
buffer.WriteString(fmt.Sprintf("cnonce=\"%s\", ", ah.Cnonce))
159159
}
160160

161-
if ah.Response != "" {
162-
buffer.WriteString(fmt.Sprintf("response=\"%s\", ", ah.Response))
161+
if ah.Opaque != "" {
162+
buffer.WriteString(fmt.Sprintf("opaque=\"%s\", ", ah.Opaque))
163163
}
164164

165-
if ah.URI != "" {
166-
buffer.WriteString(fmt.Sprintf("uri=\"%s\", ", ah.URI))
165+
if ah.Qop != "" {
166+
buffer.WriteString(fmt.Sprintf("qop=%s, ", ah.Qop))
167167
}
168168

169-
if ah.Userhash {
170-
buffer.WriteString("userhash=true, ")
169+
if ah.Nc != 0 {
170+
buffer.WriteString(fmt.Sprintf("nc=%08x, ", ah.Nc))
171171
}
172172

173-
if ah.Username != "" {
174-
buffer.WriteString(fmt.Sprintf("username=\"%s\", ", ah.Username))
173+
if ah.Userhash {
174+
buffer.WriteString("userhash=true, ")
175175
}
176176

177177
s := buffer.String()

0 commit comments

Comments
 (0)