Discussion:
libcurl LDAP in asyncmod
Fulup Ar Foll via curl-library
2021-04-30 14:58:02 UTC
Permalink
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Patrick Monnerat via curl-library
2021-04-30 15:17:47 UTC
Permalink
curl_easy_getinfo(httpRqt->easy, CURLINFO_RESPONSE_CODE,
&httpRqt->status); return ZERO
Question: how to retrieve conection-deny status in asynchronous mode ?
From the documentation at
https://curl.se/libcurl/c/CURLINFO_RESPONSE_CODE.html,
CURLINFO_RESPONSE_CODE is only available for http, ftp and smtp, not for
ldap.

In other words, you can't.

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https:
Fulup Ar Foll via curl-library
2021-04-30 16:37:52 UTC
Permalink
That's not the response I was hoppingh for, but I will do with it.

Thank you and have a nice weekend.

Fulup
Post by Patrick Monnerat via curl-library
curl_easy_getinfo(httpRqt->easy, CURLINFO_RESPONSE_CODE,
&httpRqt->status); return ZERO
Question: how to retrieve conection-deny status in asynchronous mode ?
From the documentation at
https://curl.se/libcurl/c/CURLINFO_RESPONSE_CODE.html,
CURLINFO_RESPONSE_CODE is only available for http, ftp and smtp, not
for ldap.
In other words, you can't.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiq
Daniel Stenberg via curl-library
2021-04-30 22:47:20 UTC
Permalink
+ curl_multi_info_read return CURLMSG_DONE
Allow me to quote curl_multi_info_read.3:

When msg is CURLMSG_DONE, the message identifies a transfer that is done,
and then result contains the return code for the easy handle that just
completed.
--
/ daniel.haxx.se
| Commercial curl support up to 24x7 is available!
| Private help, bug fixes, support, ports, new features
| https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiqu
Fulup Ar Foll via curl-library
2021-05-01 09:58:12 UTC
Permalink
Daniel,

As the error status exist in synchronous mode, it is obvious that you
handle it somewhere. I would have hope to get it from curl_easy_getinfo
with something like:

    curl_easy_getinfo(httpRqt->easy, CURLINFO_xxxxx_xxxxx, &code);

Unfortunately from what I understand the code "invalid_credential" is
not store into curl_easy_getinfo. With current behavior, I got
CURLMSG_DONE without any data, this allow me to understand something
went wrong, but I cannot make the difference in between a wrong LDAP
search and invalid credentials (in both case socket connection is
established and no data return).

May be in a futture version 😇.

Have a nice weekend.

Fulup
     +  curl_multi_info_read return CURLMSG_DONE
  When msg is CURLMSG_DONE, the message identifies a transfer that is
done,
  and then result contains the return code for the easy handle that just
  completed.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl
Daniel Stenberg via curl-library
2021-05-01 16:15:10 UTC
Permalink
As the error status exist in synchronous mode, it is obvious that you handle
it somewhere. I would have hope to get it from curl_easy_getinfo with
    curl_easy_getinfo(httpRqt->easy, CURLINFO_xxxxx_xxxxx, &code);
Unfortunately from what I understand the code "invalid_credential" is not
store into curl_easy_getinfo. With current behavior, I got CURLMSG_DONE
without any data, this allow me to understand something went wrong, but I
cannot make the difference in between a wrong LDAP search and invalid
credentials (in both case socket connection is established and no data
return).
You told us how curl_easy_perform() would return an error code for this
situation. I explained how you get the exact same error code when you instead
use the multi interface.

That has nothing to do with curl_easy_getinfo().
--
/ daniel.haxx.se
| Commercial curl support up to 24x7 is available!
| Private help, bug fixes, support, ports, new features
| https://www.wolfssl.com/contact/
Patrick Monnerat via curl-library
2021-05-01 22:44:12 UTC
Permalink
@patrick:  retrieving connection code with LDAP works in both
synchronous and asynchronous mode and not only in HTTP,TFTP,...
There are two things:

- the curl result code of type CURLcode: this one is always available as
this is the value returned by most functions in the API. It is generated
by curl and never transmitted across a connection.

- The protocol returned code: this code is protocol-dependent and sent
by the server within a response. You can get it with
curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &code). It has no
direct relationship with the curl result code.

Your initial question seemed to be about the second, that's why I
pointed you on its unavailablity for the LDAP protocol.

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:
Fulup Ar Foll via curl-library
2021-05-02 09:01:33 UTC
Permalink
Patrick,

It is not as clear as that, if you have a wrong LDAP request schema,
ldap returned code is also store into msg->result, when in my opinion
this is an LDAP protocol error. In any case it allows to retrieve an
classify low level errors as: invalid-credential, invalid-request, ...
which is what I was looking for.

Have a nice Sunday.

Fulup
Post by Patrick Monnerat via curl-library
@patrick:  retrieving connection code with LDAP works in both
synchronous and asynchronous mode and not only in HTTP,TFTP,...
- the curl result code of type CURLcode: this one is always available
as this is the value returned by most functions in the API. It is
generated by curl and never transmitted across a connection.
- The protocol returned code: this code is protocol-dependent and sent
by the server within a response. You can get it with
curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &code). It has no
direct relationship with the curl result code.
Your initial question seemed to be about the second, that's why I
pointed you on its unavailablity for the LDAP protocol.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Eti

Loading...