Browse Source

Fix extra LF between chunks

master
JustAnotherArchivist 9 months ago
parent
commit
8d48785caf
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      http-response-bodies.c

+ 4
- 1
http-response-bodies.c View File

@@ -296,7 +296,9 @@ checkstate:
DEBUG_PRINTF("Full body\n");
DEBUG_PRINTF("Copying %zu bytes to stdout\n", length - bytes_read);
fwrite(bufp, 1, length - bytes_read, stdout);
fprintf(stdout, "\n");
if (state == STATE_BODY) {
fprintf(stdout, "\n");
}
if (state == STATE_CHUNK_CONTENTS && *(bufp + length - bytes_read) == '\r') {
// Stupid hack to enforce the CRLF
++length;
@@ -363,6 +365,7 @@ checkstate:
fprintf(stderr, "Error: end of HTTP body not found\n");
return 1;
}
fprintf(stdout, "\n");
n -= 3;
bufp += 3;
state = STATE_HEADERS;


Loading…
Cancel
Save