counts header and request size
authorDaniel Stenberg <daniel@haxx.se>
Wed, 4 Oct 2000 13:07:43 +0000 (13:07 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 4 Oct 2000 13:07:43 +0000 (13:07 +0000)
lib/getinfo.c
lib/highlevel.c
lib/http.c
lib/urldata.h

index a356741..177af97 100644 (file)
@@ -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;
index c3b6269..9c1a36c 100644 (file)
@@ -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;
index 7e20894..4b9da41 100644 (file)
@@ -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 */
     }
index f255fbf..241bfc2 100644 (file)
@@ -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;