Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(249)

Delta Between Two Patch Sets: src/pkg/crypto/x509/verify.go

Issue 4661051: code review 4661051: strings.Split: make the default to split all. (Closed)
Left Patch Set: Created 12 years, 9 months ago
Right Patch Set: diff -r eaa696629d4d https://go.googlecode.com/hg/ Created 12 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/compress/lzw/reader_test.go ('k') | src/pkg/debug/proc/proc_linux.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package x509 5 package x509
6 6
7 import ( 7 import (
8 "os" 8 "os"
9 "strings" 9 "strings"
10 "time" 10 "time"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 return 197 return
198 } 198 }
199 199
200 func matchHostnames(pattern, host string) bool { 200 func matchHostnames(pattern, host string) bool {
201 if len(pattern) == 0 || len(host) == 0 { 201 if len(pattern) == 0 || len(host) == 0 {
202 return false 202 return false
203 } 203 }
204 204
205 » patternParts := strings.Split(pattern, ".", -1) 205 » patternParts := strings.Split(pattern, ".")
206 » hostParts := strings.Split(host, ".", -1) 206 » hostParts := strings.Split(host, ".")
207 207
208 if len(patternParts) != len(hostParts) { 208 if len(patternParts) != len(hostParts) {
209 return false 209 return false
210 } 210 }
211 211
212 for i, patternPart := range patternParts { 212 for i, patternPart := range patternParts {
213 if patternPart == "*" { 213 if patternPart == "*" {
214 continue 214 continue
215 } 215 }
216 if patternPart != hostParts[i] { 216 if patternPart != hostParts[i] {
(...skipping 13 matching lines...) Expand all
230 return nil 230 return nil
231 } 231 }
232 } 232 }
233 // If Subject Alt Name is given, we ignore the common name. 233 // If Subject Alt Name is given, we ignore the common name.
234 } else if matchHostnames(c.Subject.CommonName, h) { 234 } else if matchHostnames(c.Subject.CommonName, h) {
235 return nil 235 return nil
236 } 236 }
237 237
238 return HostnameError{c, h} 238 return HostnameError{c, h}
239 } 239 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b