(FAST_HEADER): Do not remove intermediate newlines from the folded headers.
Showing
1 changed file
with
6 additions
and
2 deletions
... | @@ -387,7 +387,10 @@ do {\ | ... | @@ -387,7 +387,10 @@ do {\ |
387 | i = 10 * i + (*a - '0'); \ | 387 | i = 10 * i + (*a - '0'); \ |
388 | } while (0) | 388 | } while (0) |
389 | 389 | ||
390 | /* Save/concatenate the field-value in the fast header(fhd) field. */ | 390 | /* Save/concatenate the field-value in the fast header(fhd) field. |
391 | Notice that care is taken to preserve the intermediate newlines | ||
392 | in the folded headers. However, the final newline is always | ||
393 | removed. */ | ||
391 | #define FAST_HEADER(field,buf,n) \ | 394 | #define FAST_HEADER(field,buf,n) \ |
392 | do { \ | 395 | do { \ |
393 | int i = 0; \ | 396 | int i = 0; \ |
... | @@ -406,10 +409,11 @@ do { \ | ... | @@ -406,10 +409,11 @@ do { \ |
406 | if (!field) \ | 409 | if (!field) \ |
407 | SKIPSPACE(p); \ | 410 | SKIPSPACE(p); \ |
408 | l = n - (p - buf); \ | 411 | l = n - (p - buf); \ |
409 | tmp = realloc (field, (l + i + 1) * sizeof (char)); \ | 412 | tmp = realloc (field, (l + (i ? i + 1 : 0) + 1) * sizeof (char)); \ |
410 | if (tmp) \ | 413 | if (tmp) \ |
411 | { \ | 414 | { \ |
412 | field = tmp; \ | 415 | field = tmp; \ |
416 | if (i) field[i++] = '\n'; \ | ||
413 | memcpy (field + i, p, l); \ | 417 | memcpy (field + i, p, l); \ |
414 | } \ | 418 | } \ |
415 | } \ | 419 | } \ | ... | ... |
-
Please register or sign in to post a comment