This commit is contained in:
Daniel Stenberg 2000-03-01 22:07:46 +00:00
Родитель cf23986a70
Коммит 14e71a04d5
1 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -46,10 +46,15 @@
typedef enum { typedef enum {
VAR_NONE, /* must be the first */ VAR_NONE, /* must be the first */
VAR_TOTAL_TIME, VAR_TOTAL_TIME,
VAR_NAMELOOKUP_TIME,
VAR_CONNECT_TIME,
VAR_PRETRANSFER_TIME,
VAR_SIZE_DOWNLOAD, VAR_SIZE_DOWNLOAD,
VAR_SIZE_UPLOAD, VAR_SIZE_UPLOAD,
VAR_SPEED_DOWNLOAD, VAR_SPEED_DOWNLOAD,
VAR_SPEED_UPLOAD, VAR_SPEED_UPLOAD,
VAR_HTTP_CODE,
VAR_EFFECTIVE_URL,
VAR_NUM_OF_VARS /* must be the last */ VAR_NUM_OF_VARS /* must be the last */
} replaceid; } replaceid;
@ -60,7 +65,12 @@ struct variable {
static struct variable replacements[]={ static struct variable replacements[]={
{"effective_url", VAR_EFFECTIVE_URL},
{"http_code", VAR_HTTP_CODE},
{"total_time", VAR_TOTAL_TIME}, {"total_time", VAR_TOTAL_TIME},
{"namelookup_time", VAR_NAMELOOKUP_TIME},
{"connect_time", VAR_CONNECT_TIME},
{"pretransfer_time", VAR_PRETRANSFER_TIME},
{"size_download", VAR_SIZE_DOWNLOAD}, {"size_download", VAR_SIZE_DOWNLOAD},
{"size_upload", VAR_SIZE_UPLOAD}, {"size_upload", VAR_SIZE_UPLOAD},
{"speed_download", VAR_SPEED_DOWNLOAD}, {"speed_download", VAR_SPEED_DOWNLOAD},
@ -89,9 +99,24 @@ void WriteOut(struct UrlData *data)
for(i=0; replacements[i].name; i++) { for(i=0; replacements[i].name; i++) {
if(strequal(ptr, replacements[i].name)) { if(strequal(ptr, replacements[i].name)) {
switch(replacements[i].id) { switch(replacements[i].id) {
case VAR_EFFECTIVE_URL:
fprintf(stream, "%s", data->url?data->url:"");
break;
case VAR_TOTAL_TIME: case VAR_TOTAL_TIME:
fprintf(stream, "%.3f", data->progress.timespent); fprintf(stream, "%.3f", data->progress.timespent);
break; break;
case VAR_NAMELOOKUP_TIME:
fprintf(stream, "%.3f", tvdiff(data->progress.t_nslookup,
data->progress.start));
break;
case VAR_CONNECT_TIME:
fprintf(stream, "%.3f", tvdiff(data->progress.t_connect,
data->progress.start));
break;
case VAR_PRETRANSFER_TIME:
fprintf(stream, "%.3f", tvdiff(data->progress.t_pretransfer,
data->progress.start));
break;
case VAR_SIZE_UPLOAD: case VAR_SIZE_UPLOAD:
fprintf(stream, "%.0f", data->progress.uploaded); fprintf(stream, "%.0f", data->progress.uploaded);
break; break;