Skip to content

Commit c236369

Browse files
committed
Add missing newline to GET requests embedded in multipart requests
The changes to MultipartContent should have no impact, as I don't expect we are often sending bodiless parts. HttpRequestContent previously was would not flush if bodiless, however the writer isn't buffered so the flush is unnecessary. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=96589029
1 parent 7548c14 commit c236369

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

google-http-client/src/main/java/com/google/api/client/http/MultipartContent.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,25 @@ public void writeTo(OutputStream out) throws IOException {
9191
headers.setContentLength(contentLength);
9292
}
9393
}
94-
// write separator
94+
// write multipart-body from RFC 1521 §7.2.1
95+
// write encapsulation
96+
// write delimiter
9597
writer.write(TWO_DASHES);
9698
writer.write(boundary);
9799
writer.write(NEWLINE);
98-
// write headers
100+
// write body-part; message from RFC 822 §4.1
101+
// write message fields
99102
HttpHeaders.serializeHeadersForMultipartRequests(headers, null, null, writer);
100-
// write content
101103
if (streamingContent != null) {
102104
writer.write(NEWLINE);
103105
writer.flush();
106+
// write message text/body
104107
streamingContent.writeTo(out);
105-
writer.write(NEWLINE);
106108
}
109+
// terminate encapsulation
110+
writer.write(NEWLINE);
107111
}
108-
// write end separator
112+
// write close-delimiter
109113
writer.write(TWO_DASHES);
110114
writer.write(boundary);
111115
writer.write(TWO_DASHES);

0 commit comments

Comments
 (0)