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

Delta Between Two Patch Sets: src/pkg/crypto/tls/conn.go

Issue 6654050: code review 6654050: crypto/tls: make closeNotify a warning alert. (Closed)
Left Patch Set: Created 11 years, 5 months ago
Right Patch Set: diff -r 6665bbc48b3b https://go.googlecode.com/hg/ Created 11 years, 5 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 | « no previous file | src/pkg/crypto/tls/handshake_client_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 // TLS low level connection and record layer 5 // TLS low level connection and record layer
6 6
7 package tls 7 package tls
8 8
9 import ( 9 import (
10 "bytes" 10 "bytes"
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 if b != nil { 598 if b != nil {
599 c.in.freeBlock(b) 599 c.in.freeBlock(b)
600 } 600 }
601 return c.error() 601 return c.error()
602 } 602 }
603 603
604 // sendAlert sends a TLS alert message. 604 // sendAlert sends a TLS alert message.
605 // c.out.Mutex <= L. 605 // c.out.Mutex <= L.
606 func (c *Conn) sendAlertLocked(err alert) error { 606 func (c *Conn) sendAlertLocked(err alert) error {
607 » c.tmp[0] = alertLevelError 607 » switch err {
608 » if err == alertNoRenegotiation { 608 » case alertNoRenegotiation, alertCloseNotify:
609 c.tmp[0] = alertLevelWarning 609 c.tmp[0] = alertLevelWarning
610 default:
611 c.tmp[0] = alertLevelError
610 } 612 }
611 c.tmp[1] = byte(err) 613 c.tmp[1] = byte(err)
612 c.writeRecord(recordTypeAlert, c.tmp[0:2]) 614 c.writeRecord(recordTypeAlert, c.tmp[0:2])
613 // closeNotify is a special case in that it isn't an error: 615 // closeNotify is a special case in that it isn't an error:
614 if err != alertCloseNotify { 616 if err != alertCloseNotify {
615 return c.setError(&net.OpError{Op: "local error", Err: err}) 617 return c.setError(&net.OpError{Op: "local error", Err: err})
616 } 618 }
617 return nil 619 return nil
618 } 620 }
619 621
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 c.handshakeMutex.Lock() 860 c.handshakeMutex.Lock()
859 defer c.handshakeMutex.Unlock() 861 defer c.handshakeMutex.Unlock()
860 if !c.isClient { 862 if !c.isClient {
861 return errors.New("VerifyHostname called on TLS server connectio n") 863 return errors.New("VerifyHostname called on TLS server connectio n")
862 } 864 }
863 if !c.handshakeComplete { 865 if !c.handshakeComplete {
864 return errors.New("TLS handshake has not yet been performed") 866 return errors.New("TLS handshake has not yet been performed")
865 } 867 }
866 return c.peerCertificates[0].VerifyHostname(host) 868 return c.peerCertificates[0].VerifyHostname(host)
867 } 869 }
LEFTRIGHT

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