1
0
Fork 0

Send xml PI encoding. Route through Stream.send for logging.

This commit is contained in:
Matt Goodall 2012-07-09 02:49:33 +01:00
parent 56a481ff8e
commit e2c05fea94
1 changed files with 4 additions and 3 deletions

View File

@ -31,12 +31,13 @@ func NewStream(addr string) (*Stream, error) {
return nil, err
}
if _, err := conn.Write([]byte("<?xml version='1.0'?>")); err != nil {
stream := &Stream{conn, xml.NewDecoder(conn)}
if err := stream.send([]byte("<?xml version='1.0' encoding='utf-8'?>")); err != nil {
return nil, err
}
dec := xml.NewDecoder(conn)
return &Stream{conn, dec}, nil
return stream, nil
}
// Upgrade the stream's underlying net conncetion to TLS.