mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 15:48:49 -05:00
"Yet Another Geek" made %{content_type} work in the -w/--writeout option.
This commit is contained in:
parent
b1ffe7b74a
commit
95e601e2b1
@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man curl.1
|
.\" nroff -man curl.1
|
||||||
.\" Written by Daniel Stenberg
|
.\" Written by Daniel Stenberg
|
||||||
.\"
|
.\"
|
||||||
.TH curl 1 "30 Nov 2001" "Curl 7.9.2" "Curl Manual"
|
.TH curl 1 "25 Feb 2002" "Curl 7.9.5" "Curl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl \- transfer a URL
|
curl \- transfer a URL
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -594,6 +594,9 @@ The average download speed that curl measured for the complete download.
|
|||||||
.TP
|
.TP
|
||||||
.B speed_upload
|
.B speed_upload
|
||||||
The average upload speed that curl measured for the complete upload.
|
The average upload speed that curl measured for the complete upload.
|
||||||
|
.TP
|
||||||
|
.B content_type
|
||||||
|
The Content-Type of the requested document, if there was any. (Added in 7.9.5)
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
If this option is used several times, the last one will be used.
|
If this option is used several times, the last one will be used.
|
||||||
|
@ -46,6 +46,7 @@ typedef enum {
|
|||||||
VAR_HEADER_SIZE,
|
VAR_HEADER_SIZE,
|
||||||
VAR_REQUEST_SIZE,
|
VAR_REQUEST_SIZE,
|
||||||
VAR_EFFECTIVE_URL,
|
VAR_EFFECTIVE_URL,
|
||||||
|
VAR_CONTENT_TYPE,
|
||||||
VAR_NUM_OF_VARS /* must be the last */
|
VAR_NUM_OF_VARS /* must be the last */
|
||||||
} replaceid;
|
} replaceid;
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ static struct variable replacements[]={
|
|||||||
{"size_upload", VAR_SIZE_UPLOAD},
|
{"size_upload", VAR_SIZE_UPLOAD},
|
||||||
{"speed_download", VAR_SPEED_DOWNLOAD},
|
{"speed_download", VAR_SPEED_DOWNLOAD},
|
||||||
{"speed_upload", VAR_SPEED_UPLOAD},
|
{"speed_upload", VAR_SPEED_UPLOAD},
|
||||||
|
{"content_type", VAR_CONTENT_TYPE},
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -165,6 +167,11 @@ void ourWriteOut(CURL *curl, char *writeinfo)
|
|||||||
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))
|
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))
|
||||||
fprintf(stream, "%.3f", doubleinfo);
|
fprintf(stream, "%.3f", doubleinfo);
|
||||||
break;
|
break;
|
||||||
|
case VAR_CONTENT_TYPE:
|
||||||
|
if(CURLE_OK ==
|
||||||
|
curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &stringp))
|
||||||
|
fputs(stringp, stream);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user