diff options
author | Daniel Stenberg <daniel@haxx.se> | 2009-11-02 18:49:56 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2009-11-02 18:49:56 +0000 |
commit | b19dc0eeb0a4495e5b6e8fce7f63b4ae6bc39fe5 (patch) | |
tree | cfd78c72835f2f4a076ee6980120dbe95e621bf8 /lib | |
parent | 41de897b6bf58919ffc18a21faa4e36963464a1d (diff) |
- 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!
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldap.c | 17 |
1 files changed, 14 insertions, 3 deletions
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); |