Skip to content

Commit f2c856d

Browse files
authored
Merge pull request #17 from mhickman/fix_clrf_ending_multipart
Add CRLF character to end of multipart body.
2 parents e362829 + 11b7a66 commit f2c856d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/http/form_data/multipart.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def glue
5252

5353
# @return [String]
5454
def tail
55-
@tail ||= "--#{@boundary}--"
55+
@tail ||= "--#{@boundary}--#{CRLF}"
5656
end
5757
end
5858
end

spec/lib/http/form_data/multipart_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def disposition(params)
2626
"#{disposition 'name' => 'baz', 'filename' => file.filename}#{crlf}",
2727
"Content-Type: #{file.content_type}#{crlf}",
2828
"#{crlf}#{file}#{crlf}",
29-
"--#{boundary_value}--"
29+
"--#{boundary_value}--#{crlf}"
3030
].join("")
3131
end
3232

@@ -44,7 +44,7 @@ def disposition(params)
4444
"#{disposition 'name' => 'baz', 'filename' => file.filename}#{crlf}",
4545
"Content-Type: #{file.content_type}#{crlf}",
4646
"#{crlf}#{file}#{crlf}",
47-
"--my-boundary--"
47+
"--my-boundary--#{crlf}"
4848
].join("")
4949
end
5050
end
@@ -61,7 +61,7 @@ def disposition(params)
6161
"#{disposition 'name' => 'foo'}#{crlf}",
6262
"Content-Type: #{part.content_type}#{crlf}",
6363
"#{crlf}s#{crlf}",
64-
"--#{boundary_value}--"
64+
"--#{boundary_value}--#{crlf}"
6565
].join("")
6666
end
6767
end
@@ -77,7 +77,7 @@ def disposition(params)
7777
"--#{boundary_value}#{crlf}",
7878
"#{disposition 'name' => 'foo'}#{crlf}",
7979
"#{crlf}s#{crlf}",
80-
"--#{boundary_value}--"
80+
"--#{boundary_value}--#{crlf}"
8181
].join("")
8282
end
8383
end

0 commit comments

Comments
 (0)