aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--RELEASE-NOTES3
-rw-r--r--lib/ldap.c17
3 files changed, 21 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index c58ccae1e..cb3c43885 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,11 @@
Changelog
+Daniel Stenberg (2 Nov 2009)
+- As reported independent by both Stan van de Burgt and Didier Brisebourg,
+ CURLINFO_SIZE_DOWNLOAD (the -w variable size_download) didn't work when
+ getting data from ldap!
+
Daniel Stenberg (31 Oct 2009)
- Gabriel Kuri reported a problem with CURLINFO_CONTENT_LENGTH_DOWNLOAD if the
download was 0 bytes, as libcurl would then return the size as unknown (-1)
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 5c74df455..e7142cc0f 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -45,6 +45,7 @@ This release includes the following bugfixes:
o POST with Digest authentication and "Transfer-Encoding: chunked"
o SCP connection re-use with wrong auth
o CURLINFO_CONTENT_LENGTH_DOWNLOAD for 0 bytes transfers
+ 0 CURLINFO_SIZE_DOWNLOAD for ldap transfers (-w size_download)
This release includes the following known bugs:
@@ -58,6 +59,6 @@ advice from friends like these:
Claes Jakobsson, Sven Anders, Chris Mumford, John P. McCaskey,
Constantine Sapuntzakis, Michael Stillwell, Tom Mueller, Dan Fandrich,
Kevin Baughman, John Dennis, Ray Dassen, Johan van Selst, Dima Barsky,
- Liza Alenchery, Gabriel Kuri
+ Liza Alenchery, Gabriel Kuri, Stan van de Burgt, Didier Brisebourg
Thanks! (and sorry if I forgot to mention someone)
diff --git a/lib/ldap.c b/lib/ldap.c
index f440ee914..11d9f31f6 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -177,6 +177,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
int ldap_ssl = 0;
char *val_b64;
size_t val_b64_sz;
+ curl_off_t dlsize=0;
#ifdef LDAP_OPT_NETWORK_TIMEOUT
struct timeval ldap_timeout = {10,0}; /* 10 sec connection/search timeout */
#endif
@@ -383,6 +384,8 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)dn, 0);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
+ dlsize += strlen(dn)+5;
+
for (attribute = ldap_first_attribute(server, entryIterator, &ber);
attribute;
attribute = ldap_next_attribute(server, entryIterator, ber))
@@ -396,30 +399,38 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *) attribute, 0);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)": ", 2);
+ dlsize += strlen(attribute)+3;
+
if((strlen(attribute) > 7) &&
(strcmp(";binary",
(char *)attribute +
(strlen((char *)attribute) - 7)) == 0)) {
/* Binary attribute, encode to base64. */
- val_b64_sz = Curl_base64_encode(conn->data,
+ val_b64_sz = Curl_base64_encode(data,
vals[i]->bv_val,
vals[i]->bv_len,
&val_b64);
if(val_b64_sz > 0) {
Curl_client_write(conn, CLIENTWRITE_BODY, val_b64, val_b64_sz);
free(val_b64);
+ dlsize += val_b64_sz;
}
- } else
+ }
+ else {
Curl_client_write(conn, CLIENTWRITE_BODY, vals[i]->bv_val,
vals[i]->bv_len);
+ dlsize += vals[i]->bv_len;
+ }
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0);
+ dlsize++;
}
/* Free memory used to store values */
ldap_value_free_len(vals);
}
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
-
+ dlsize++;
+ Curl_pgrsSetDownloadCounter(data, dlsize);
ldap_memfree(attribute);
}
ldap_memfree(dn);