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

Delta Between Two Patch Sets: src/pkg/smtp/smtp.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/runtime/debug/stack_test.go ('k') | src/pkg/smtp/smtp_test.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 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 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 smtp implements the Simple Mail Transfer Protocol as defined in RFC 5 321. 5 // Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5 321.
6 // It also implements the following extensions: 6 // It also implements the following extensions:
7 // 8BITMIME RFC 1652 7 // 8BITMIME RFC 1652
8 // AUTH RFC 2554 8 // AUTH RFC 2554
9 // STARTTLS RFC 3207 9 // STARTTLS RFC 3207
10 // Additional extensions may be handled by clients. 10 // Additional extensions may be handled by clients.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 // ehlo sends the EHLO (extended hello) greeting to the server. It 88 // ehlo sends the EHLO (extended hello) greeting to the server. It
89 // should be the preferred greeting for servers that support it. 89 // should be the preferred greeting for servers that support it.
90 func (c *Client) ehlo() os.Error { 90 func (c *Client) ehlo() os.Error {
91 _, msg, err := c.cmd(250, "EHLO localhost") 91 _, msg, err := c.cmd(250, "EHLO localhost")
92 if err != nil { 92 if err != nil {
93 return err 93 return err
94 } 94 }
95 ext := make(map[string]string) 95 ext := make(map[string]string)
96 » extList := strings.Split(msg, "\n", -1) 96 » extList := strings.Split(msg, "\n")
97 if len(extList) > 1 { 97 if len(extList) > 1 {
98 extList = extList[1:] 98 extList = extList[1:]
99 for _, line := range extList { 99 for _, line := range extList {
100 » » » args := strings.Split(line, " ", 2) 100 » » » args := strings.SplitN(line, " ", 2)
101 if len(args) > 1 { 101 if len(args) > 1 {
102 ext[args[0]] = args[1] 102 ext[args[0]] = args[1]
103 } else { 103 } else {
104 ext[args[0]] = "" 104 ext[args[0]] = ""
105 } 105 }
106 } 106 }
107 } 107 }
108 if mechs, ok := ext["AUTH"]; ok { 108 if mechs, ok := ext["AUTH"]; ok {
109 » » c.auth = strings.Split(mechs, " ", -1) 109 » » c.auth = strings.Split(mechs, " ")
110 } 110 }
111 c.ext = ext 111 c.ext = ext
112 return err 112 return err
113 } 113 }
114 114
115 // StartTLS sends the STARTTLS command and encrypts all further communication. 115 // StartTLS sends the STARTTLS command and encrypts all further communication.
116 // Only servers that advertise the STARTTLS extension support this function. 116 // Only servers that advertise the STARTTLS extension support this function.
117 func (c *Client) StartTLS(config *tls.Config) os.Error { 117 func (c *Client) StartTLS(config *tls.Config) os.Error {
118 _, _, err := c.cmd(220, "STARTTLS") 118 _, _, err := c.cmd(220, "STARTTLS")
119 if err != nil { 119 if err != nil {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 // Quit sends the QUIT command and closes the connection to the server. 287 // Quit sends the QUIT command and closes the connection to the server.
288 func (c *Client) Quit() os.Error { 288 func (c *Client) Quit() os.Error {
289 _, _, err := c.cmd(221, "QUIT") 289 _, _, err := c.cmd(221, "QUIT")
290 if err != nil { 290 if err != nil {
291 return err 291 return err
292 } 292 }
293 return c.Text.Close() 293 return c.Text.Close()
294 } 294 }
LEFTRIGHT

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