counts header and request size
This commit is contained in:
Родитель
bf56377865
Коммит
5865860ad6
|
@ -84,6 +84,12 @@ CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
|
|||
case CURLINFO_HTTP_CODE:
|
||||
*param_longp = data->progress.httpcode;
|
||||
break;
|
||||
case CURLINFO_HEADER_SIZE:
|
||||
*param_longp = data->header_size;
|
||||
break;
|
||||
case CURLINFO_REQUEST_SIZE:
|
||||
*param_longp = data->request_size;
|
||||
break;
|
||||
case CURLINFO_TOTAL_TIME:
|
||||
*param_doublep = data->progress.timespent;
|
||||
break;
|
||||
|
|
|
@ -349,6 +349,7 @@ _Transfer(struct connectdata *c_conn)
|
|||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
data->header_size += p - data->headerbuff;
|
||||
break; /* exit header line loop */
|
||||
}
|
||||
|
||||
|
@ -425,6 +426,7 @@ _Transfer(struct connectdata *c_conn)
|
|||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
data->header_size += hbuflen;
|
||||
|
||||
/* reset hbufp pointer && hbuflen */
|
||||
hbufp = data->headerbuff;
|
||||
|
|
11
lib/http.c
11
lib/http.c
|
@ -475,7 +475,8 @@ CURLcode http(struct connectdata *conn)
|
|||
/* set upload size to the progress meter */
|
||||
pgrsSetUploadSize(data, http->postsize);
|
||||
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
data->request_size =
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
result = Transfer(conn, data->firstsocket, -1, TRUE,
|
||||
&http->readbytecount,
|
||||
data->firstsocket,
|
||||
|
@ -500,7 +501,8 @@ CURLcode http(struct connectdata *conn)
|
|||
pgrsSetUploadSize(data, data->infilesize);
|
||||
|
||||
/* this sends the buffer and frees all the buffer resources */
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
data->request_size =
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
|
||||
/* prepare for transfer */
|
||||
result = Transfer(conn, data->firstsocket, -1, TRUE,
|
||||
|
@ -544,8 +546,11 @@ CURLcode http(struct connectdata *conn)
|
|||
else
|
||||
add_buffer(req_buffer, "\r\n", 2);
|
||||
|
||||
/* issue the request */
|
||||
data->request_size =
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
|
||||
/* HTTP GET/HEAD download: */
|
||||
add_buffer_send(data->firstsocket, conn, req_buffer);
|
||||
result = Transfer(conn, data->firstsocket, -1, TRUE, bytecount,
|
||||
-1, NULL); /* nothing to upload */
|
||||
}
|
||||
|
|
|
@ -211,7 +211,6 @@ struct connectdata {
|
|||
the same we read from. -1 disables */
|
||||
long *writebytecountp; /* return number of bytes written or NULL */
|
||||
|
||||
|
||||
#ifdef KRB4
|
||||
|
||||
enum protection_level command_prot;
|
||||
|
@ -357,6 +356,10 @@ struct UrlData {
|
|||
proxy string features a ":[port]" that one will override
|
||||
this. */
|
||||
|
||||
|
||||
long header_size; /* size of read header(s) in bytes */
|
||||
long request_size; /* the amount of bytes sent in the request(s) */
|
||||
|
||||
/*************** Request - specific items ************/
|
||||
|
||||
union {
|
||||
|
@ -463,8 +466,11 @@ struct UrlData {
|
|||
char *headerbuff; /* allocated buffer to store headers in */
|
||||
int headersize; /* size of the allocation */
|
||||
|
||||
#if 0
|
||||
/* this was removed in libcurl 7.4 */
|
||||
char *writeinfo; /* if non-NULL describes what to output on a successful
|
||||
completion */
|
||||
#endif
|
||||
|
||||
struct Progress progress;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче