Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
971459e8
Commit
971459e8
authored
Jul 20, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/textproto: fix build
R=bradfitz CC=golang-dev
https://golang.org/cl/4815041
parent
27a3dcd0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
multipart_test.go
src/pkg/mime/multipart/multipart_test.go
+6
-6
reader.go
src/pkg/net/textproto/reader.go
+12
-3
No files found.
src/pkg/mime/multipart/multipart_test.go
View file @
971459e8
...
...
@@ -141,14 +141,14 @@ func testMultipart(t *testing.T, r io.Reader, onlyNewlines bool) {
t
.
Error
(
"Expected part1"
)
return
}
if
part
.
Header
.
Get
(
"Header1"
)
!=
"value1"
{
t
.
Error
(
"Expected Header1: value
"
)
if
x
:=
part
.
Header
.
Get
(
"Header1"
);
x
!=
"value1"
{
t
.
Error
f
(
"part.Header.Get(%q) = %q, want %q"
,
"Header1"
,
x
,
"value1
"
)
}
if
part
.
Header
.
Get
(
"foo-bar"
)
!=
"baz"
{
t
.
Error
(
"Expected foo-bar:
baz"
)
if
x
:=
part
.
Header
.
Get
(
"foo-bar"
);
x
!=
"baz"
{
t
.
Error
f
(
"part.Header.Get(%q) = %q, want %q"
,
"foo-bar"
,
x
,
"
baz"
)
}
if
part
.
Header
.
Get
(
"Foo-Bar"
)
!=
"baz"
{
t
.
Error
(
"Expected Foo-Bar:
baz"
)
if
x
:=
part
.
Header
.
Get
(
"Foo-Bar"
);
x
!=
"baz"
{
t
.
Error
f
(
"part.Header.Get(%q) = %q, want %q"
,
"Foo-Bar"
,
x
,
"
baz"
)
}
buf
.
Reset
()
if
_
,
err
:=
io
.
Copy
(
buf
,
part
);
err
!=
nil
{
...
...
src/pkg/net/textproto/reader.go
View file @
971459e8
...
...
@@ -115,6 +115,13 @@ func (r *Reader) readContinuedLineSlice() ([]byte, os.Error) {
}
line
=
trim
(
line
)
copied
:=
false
if
r
.
R
.
Buffered
()
<
1
{
// ReadByte will flush the buffer; make a copy of the slice.
copied
=
true
line
=
append
([]
byte
(
nil
),
line
...
)
}
// Look for a continuation line.
c
,
err
:=
r
.
R
.
ReadByte
()
if
err
!=
nil
{
...
...
@@ -127,6 +134,11 @@ func (r *Reader) readContinuedLineSlice() ([]byte, os.Error) {
return
line
,
nil
}
if
!
copied
{
// The next readLineSlice will invalidate the previous one.
line
=
append
(
make
([]
byte
,
0
,
len
(
line
)
*
2
),
line
...
)
}
// Read continuation lines.
for
{
// Consume leading spaces; one already gone.
...
...
@@ -140,9 +152,6 @@ func (r *Reader) readContinuedLineSlice() ([]byte, os.Error) {
break
}
}
// copy now since the next call to read a slice invalidates line
line
=
append
(
make
([]
byte
,
0
,
len
(
line
)
*
2
),
line
...
)
var
cont
[]
byte
cont
,
err
=
r
.
readLineSlice
()
cont
=
trim
(
cont
)
...
...
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