Skip to content

Commit 4a40f4e

Browse files
committed
Sepcial casing content-length header when length is 0
1 parent 7c0288e commit 4a40f4e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ds3/networking/httpRequestBuilder.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ func (builder *HttpRequestBuilder) Build(conn *ConnectionInfo) (*http.Request, e
104104

105105
if builder.contentLength != nil {
106106
httpRequest.ContentLength = *builder.contentLength
107+
108+
// Special casing for content length == 0. Go won't include the content length header
109+
// if the length is 0, but BlackPearl needs the content length header to be there and be 0
110+
// to create a folder.
111+
if *builder.contentLength == 0 {
112+
httpRequest.Body = http.NoBody
113+
}
107114
}
108115

109116
builder.signatureFields.Date = getCurrentTime()

0 commit comments

Comments
 (0)