You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Presumably the boundary is --|||||||||||||| where -- is the stuff added on to
256
256
// the front as per the protocol and ||||||||||||| is the part we care about.
257
-
varline=reader.ReadLine();
257
+
258
+
// The following loop ignores blank lines that may be present before the first line of the form.
259
+
// It's highly unusual to find blank lines at the start of the data but it's a possible scenario described in GH-116.
260
+
// Please note that we intentionally do NOT check for "string.IsNullOrEmpty(line)" because NULL does
261
+
// not indicate a blank line. It indicates that we have reached the end of the stream.
262
+
varline=string.Empty;
263
+
while(line==string.Empty)
264
+
{
265
+
line=reader.ReadLine();
266
+
}
258
267
259
268
// The line must not be empty and must starts with "--".
260
269
if(string.IsNullOrEmpty(line))thrownewMultipartParseException("Unable to determine boundary: either the stream is empty or we reached the end of the stream");
@@ -296,7 +305,16 @@ private static async Task<string> DetectBoundaryAsync(RebufferableBinaryReader r
296
305
{
297
306
// Presumably the boundary is --|||||||||||||| where -- is the stuff added on to
298
307
// the front as per the protocol and ||||||||||||| is the part we care about.
// The line must not be empty and must starts with "--".
302
320
if(string.IsNullOrEmpty(line))thrownewMultipartParseException("Unable to determine boundary: either the stream is empty or we reached the end of the stream");
0 commit comments