Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
2f4632fe
Commit
2f4632fe
authored
Jul 27, 2011
by
John Asmuth
Committed by
Robert Griesemer
Jul 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
container/vector: removed some uses of container/vector in other pkgs
R=gri CC=golang-dev
https://golang.org/cl/4823054
parent
22f71cde
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
32 deletions
+22
-32
src/pkg/crypto/x509/x509.go
src/pkg/crypto/x509/x509.go
+5
-6
src/pkg/http/request.go
src/pkg/http/request.go
+1
-4
src/pkg/json/decode.go
src/pkg/json/decode.go
+2
-3
src/pkg/net/dict/dict.go
src/pkg/net/dict/dict.go
+3
-4
src/pkg/net/textproto/reader.go
src/pkg/net/textproto/reader.go
+3
-6
src/pkg/websocket/client.go
src/pkg/websocket/client.go
+8
-9
No files found.
src/pkg/crypto/x509/x509.go
View file @
2f4632fe
...
...
@@ -9,7 +9,6 @@ import (
"asn1"
"big"
"bytes"
"container/vector"
"crypto"
"crypto/dsa"
"crypto/rsa"
...
...
@@ -794,7 +793,7 @@ func ParseCertificate(asn1Data []byte) (*Certificate, os.Error) {
// ParseCertificates parses one or more certificates from the given ASN.1 DER
// data. The certificates must be concatenated with no intermediate padding.
func
ParseCertificates
(
asn1Data
[]
byte
)
([]
*
Certificate
,
os
.
Error
)
{
v
:=
new
(
vector
.
Vector
)
v
ar
v
[]
interface
{}
for
len
(
asn1Data
)
>
0
{
cert
:=
new
(
certificate
)
...
...
@@ -803,12 +802,12 @@ func ParseCertificates(asn1Data []byte) ([]*Certificate, os.Error) {
if
err
!=
nil
{
return
nil
,
err
}
v
.
Push
(
cert
)
v
=
append
(
v
,
cert
)
}
ret
:=
make
([]
*
Certificate
,
v
.
Len
(
))
for
i
:=
0
;
i
<
v
.
Len
(
);
i
++
{
cert
,
err
:=
parseCertificate
(
v
.
At
(
i
)
.
(
*
certificate
))
ret
:=
make
([]
*
Certificate
,
len
(
v
))
for
i
:=
0
;
i
<
len
(
v
);
i
++
{
cert
,
err
:=
parseCertificate
(
v
[
i
]
.
(
*
certificate
))
if
err
!=
nil
{
return
nil
,
err
}
...
...
src/pkg/http/request.go
View file @
2f4632fe
...
...
@@ -12,7 +12,6 @@ import (
"bufio"
"bytes"
"crypto/tls"
"container/vector"
"encoding/base64"
"fmt"
"io"
...
...
@@ -674,9 +673,7 @@ func parseQuery(m Values, query string) (err os.Error) {
err
=
e
continue
}
vec
:=
vector
.
StringVector
(
m
[
key
])
vec
.
Push
(
value
)
m
[
key
]
=
vec
m
[
key
]
=
append
(
m
[
key
],
value
)
}
return
err
}
...
...
src/pkg/json/decode.go
View file @
2f4632fe
...
...
@@ -8,7 +8,6 @@
package
json
import
(
"container/vector"
"encoding/base64"
"os"
"reflect"
...
...
@@ -669,7 +668,7 @@ func (d *decodeState) valueInterface() interface{} {
// arrayInterface is like array but returns []interface{}.
func
(
d
*
decodeState
)
arrayInterface
()
[]
interface
{}
{
var
v
vector
.
Vector
var
v
[]
interface
{}
for
{
// Look ahead for ] - can only happen on first iteration.
op
:=
d
.
scanWhile
(
scanSkipSpace
)
...
...
@@ -681,7 +680,7 @@ func (d *decodeState) arrayInterface() []interface{} {
d
.
off
--
d
.
scan
.
undo
(
op
)
v
.
Push
(
d
.
valueInterface
())
v
=
append
(
v
,
d
.
valueInterface
())
// Next token must be , or ].
op
=
d
.
scanWhile
(
scanSkipSpace
)
...
...
src/pkg/net/dict/dict.go
View file @
2f4632fe
...
...
@@ -7,7 +7,6 @@
package
dict
import
(
"container/vector"
"net/textproto"
"os"
"strconv"
...
...
@@ -144,7 +143,7 @@ func (c *Client) Define(dict, word string) ([]*Defn, os.Error) {
// Fields are space separated unquoted words
// or quoted with single or double quote.
func
fields
(
s
string
)
([]
string
,
os
.
Error
)
{
var
v
vector
.
StringVector
var
v
[]
string
i
:=
0
for
{
for
i
<
len
(
s
)
&&
(
s
[
i
]
==
' '
||
s
[
i
]
==
'\t'
)
{
...
...
@@ -170,7 +169,7 @@ func fields(s string) ([]string, os.Error) {
break
}
}
v
.
Push
(
unquote
(
s
[
i
+
1
:
j
-
1
]))
v
=
append
(
v
,
unquote
(
s
[
i
+
1
:
j
-
1
]))
i
=
j
}
else
{
// atom
...
...
@@ -180,7 +179,7 @@ func fields(s string) ([]string, os.Error) {
break
}
}
v
.
Push
(
s
[
i
:
j
])
v
=
append
(
v
,
s
[
i
:
j
])
i
=
j
}
if
i
<
len
(
s
)
{
...
...
src/pkg/net/textproto/reader.go
View file @
2f4632fe
...
...
@@ -7,7 +7,6 @@ package textproto
import
(
"bufio"
"bytes"
"container/vector"
"io"
"io/ioutil"
"os"
...
...
@@ -400,7 +399,7 @@ func (r *Reader) ReadDotLines() ([]string, os.Error) {
// We could use ReadDotBytes and then Split it,
// but reading a line at a time avoids needing a
// large contiguous block of memory and is simpler.
var
v
vector
.
StringVector
var
v
[]
string
var
err
os
.
Error
for
{
var
line
string
...
...
@@ -419,7 +418,7 @@ func (r *Reader) ReadDotLines() ([]string, os.Error) {
}
line
=
line
[
1
:
]
}
v
.
Push
(
line
)
v
=
append
(
v
,
line
)
}
return
v
,
err
}
...
...
@@ -466,9 +465,7 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, os.Error) {
}
value
:=
string
(
kv
[
i
:
])
v
:=
vector
.
StringVector
(
m
[
key
])
v
.
Push
(
value
)
m
[
key
]
=
v
m
[
key
]
=
append
(
m
[
key
],
value
)
if
err
!=
nil
{
return
m
,
err
...
...
src/pkg/websocket/client.go
View file @
2f4632fe
...
...
@@ -7,7 +7,6 @@ package websocket
import
(
"bufio"
"bytes"
"container/vector"
"crypto/tls"
"fmt"
"http"
...
...
@@ -201,21 +200,21 @@ func handshake(resourceName, host, origin, location, protocol string, br *bufio.
bw
.
WriteString
(
"GET "
+
resourceName
+
" HTTP/1.1
\r\n
"
)
// Step 6-14. push request headers in fields.
var
fields
vector
.
StringVector
fields
.
Push
(
"Upgrade: WebSocket
\r\n
"
)
fields
.
Push
(
"Connection: Upgrade
\r\n
"
)
fields
.
Push
(
"Host: "
+
host
+
"
\r\n
"
)
fields
.
Push
(
"Origin: "
+
origin
+
"
\r\n
"
)
var
fields
[]
string
fields
=
append
(
fields
,
"Upgrade: WebSocket
\r\n
"
)
fields
=
append
(
fields
,
"Connection: Upgrade
\r\n
"
)
fields
=
append
(
fields
,
"Host: "
+
host
+
"
\r\n
"
)
fields
=
append
(
fields
,
"Origin: "
+
origin
+
"
\r\n
"
)
if
protocol
!=
""
{
fields
.
Push
(
"Sec-WebSocket-Protocol: "
+
protocol
+
"
\r\n
"
)
fields
=
append
(
fields
,
"Sec-WebSocket-Protocol: "
+
protocol
+
"
\r\n
"
)
}
// TODO(ukai): Step 15. send cookie if any.
// Step 16-23. generate keys and push Sec-WebSocket-Key<n> in fields.
key1
,
number1
:=
generateKeyNumber
()
key2
,
number2
:=
generateKeyNumber
()
fields
.
Push
(
"Sec-WebSocket-Key1: "
+
key1
+
"
\r\n
"
)
fields
.
Push
(
"Sec-WebSocket-Key2: "
+
key2
+
"
\r\n
"
)
fields
=
append
(
fields
,
"Sec-WebSocket-Key1: "
+
key1
+
"
\r\n
"
)
fields
=
append
(
fields
,
"Sec-WebSocket-Key2: "
+
key2
+
"
\r\n
"
)
// Step 24. shuffle fields and send them out.
for
i
:=
1
;
i
<
len
(
fields
);
i
++
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment