|
@@ -386,7 +386,6 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
|
|
|
|
|
*done = TRUE; /* unconditionally */
|
|
|
|
|
|
- Curl_initinfo(data);
|
|
|
Curl_pgrsStartNow(data);
|
|
|
|
|
|
if(data->set.upload)
|
|
@@ -413,21 +412,18 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /* If we have selected NOBODY and HEADER, it means that we only want file
|
|
|
- information. Which for FILE can't be much more than the file size and
|
|
|
- date. */
|
|
|
- if(data->set.opt_no_body && data->set.include_header && fstated) {
|
|
|
+ if(fstated) {
|
|
|
time_t filetime;
|
|
|
struct tm buffer;
|
|
|
const struct tm *tm = &buffer;
|
|
|
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, header, 0);
|
|
|
+ result = Curl_client_write(conn, CLIENTWRITE_HEADER, header, 0);
|
|
|
if(result)
|
|
|
return result;
|
|
|
|
|
|
- result = Curl_client_write(conn, CLIENTWRITE_BOTH,
|
|
|
+ result = Curl_client_write(conn, CLIENTWRITE_HEADER,
|
|
|
(char *)"Accept-ranges: bytes\r\n", 0);
|
|
|
if(result)
|
|
|
return result;
|
|
@@ -439,19 +435,22 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
|
|
|
|
|
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
|
|
|
snprintf(header, sizeof(header),
|
|
|
- "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
|
|
|
+ "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n%s",
|
|
|
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
|
|
tm->tm_mday,
|
|
|
Curl_month[tm->tm_mon],
|
|
|
tm->tm_year + 1900,
|
|
|
tm->tm_hour,
|
|
|
tm->tm_min,
|
|
|
- tm->tm_sec);
|
|
|
- result = Curl_client_write(conn, CLIENTWRITE_BOTH, header, 0);
|
|
|
- if(!result)
|
|
|
- /* set the file size to make it available post transfer */
|
|
|
- Curl_pgrsSetDownloadSize(data, expected_size);
|
|
|
- return result;
|
|
|
+ tm->tm_sec,
|
|
|
+ data->set.opt_no_body ? "": "\r\n");
|
|
|
+ result = Curl_client_write(conn, CLIENTWRITE_HEADER, header, 0);
|
|
|
+ if(result)
|
|
|
+ return result;
|
|
|
+ /* set the file size to make it available post transfer */
|
|
|
+ Curl_pgrsSetDownloadSize(data, expected_size);
|
|
|
+ if(data->set.opt_no_body)
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/* Check whether file range has been specified */
|