diff --git a/http-response-bodies.c b/http-response-bodies.c index 898d040..0fbb4ce 100644 --- a/http-response-bodies.c +++ b/http-response-bodies.c @@ -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;