Skip to content

Commit

Permalink
file: use private buffer for C-L output
Browse files Browse the repository at this point in the history
... instead of clobbering the download buffer.
  • Loading branch information
bagder committed May 1, 2017
1 parent c2ddc12 commit 7c312f8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -475,9 +475,10 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
time_t filetime;
struct tm buffer;
const struct tm *tm = &buffer;
snprintf(buf, CURL_BUFSIZE(data->set.buffer_size),
char header[80];
snprintf(header, sizeof(header),
"Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", expected_size);
result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
result = Curl_client_write(conn, CLIENTWRITE_BOTH, header, 0);
if(result)
return result;

Expand All @@ -492,7 +493,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
return result;

/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
snprintf(buf, BUFSIZE-1,
snprintf(header, sizeof(header),
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
tm->tm_mday,
Expand Down

0 comments on commit 7c312f8

Please sign in to comment.