Commit 5865860a authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

counts header and request size

parent bf563778
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
+2 −0
Original line number Diff line number Diff line
@@ -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;
+8 −3
Original line number Diff line number Diff line
@@ -475,6 +475,7 @@ CURLcode http(struct connectdata *conn)
      /* set upload size to the progress meter */
      pgrsSetUploadSize(data, http->postsize);

      data->request_size = 
        add_buffer_send(data->firstsocket, conn, req_buffer);
      result = Transfer(conn, data->firstsocket, -1, TRUE,
                        &http->readbytecount,
@@ -500,6 +501,7 @@ CURLcode http(struct connectdata *conn)
      pgrsSetUploadSize(data, data->infilesize);

      /* this sends the buffer and frees all the buffer resources */
      data->request_size = 
        add_buffer_send(data->firstsocket, conn, req_buffer);

      /* prepare for transfer */
@@ -544,8 +546,11 @@ CURLcode http(struct connectdata *conn)
      else
        add_buffer(req_buffer, "\r\n", 2);

      /* HTTP GET/HEAD download: */
      /* issue the request */
      data->request_size = 
        add_buffer_send(data->firstsocket, conn, req_buffer);

      /* HTTP GET/HEAD download: */
      result = Transfer(conn, data->firstsocket, -1, TRUE, bytecount,
                        -1, NULL); /* nothing to upload */
    }
+7 −1
Original line number Diff line number Diff line
@@ -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;