Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (c *Client) wrap(req *http.Request) error {
length := make([]byte, 4)
binary.LittleEndian.PutUint32(length, uint32(len(signature)))

body, newContentType, err := Wrap(concat(length, signature, sealed), contentType)
body, newContentType, err := Wrap(concat(length, signature, sealed), contentType, len(body))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions http/mime.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func fromWSMV(r io.Reader) io.Reader {
})
}

func Wrap(input []byte, ct string) ([]byte, string, error) {
func Wrap(input []byte, ct string, contentLength int) ([]byte, string, error) {
b := &bytes.Buffer{}

writer := multipart.NewWriter(b)
Expand All @@ -109,7 +109,7 @@ func Wrap(input []byte, ct string) ([]byte, string, error) {
header := make(textproto.MIMEHeader)
header.Set(contentTypeHeader, mimeProtocol)
// Using Set() will canonicalise this to "Originalcontent" which may cause problems
header["OriginalContent"] = []string{fmt.Sprintf("type=%s;Length=%d", ct, len(input))}
header["OriginalContent"] = []string{fmt.Sprintf("type=%s;Length=%d", ct, contentLength)}

if _, err := writer.CreatePart(header); err != nil {
return nil, "", err
Expand Down