Closed xiaowen581 closed 4 months ago
cupsConnectDest ... http = httpConnect2(hostname, port, addrlist, AF_UNSPEC, encryption, 1, 0, NULL); ★the seventh parameter means returns without connect, so http is always non-nullptr. ... if (!httpReconnect2(http, msec, cancel) && cb) ★httpReconnect2 returns 0 on success, but 0 is treated as an error. (cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR, dest); else if (cb) (cb)(user_data, CUPS_DEST_FLAGS_NONE, dest); return (http);
Describe the bug
Based on the above observations, I cannot determine whether the connection was successfully established through the results of cupsConnectDest...
To Reproduce sample:
the output:
In the above case, pdest1 is a unreachable printer, but still get a non-nullptr http_t*(0x5585a8ef01a0 ), and flags changs from 0x11 -> 0x21 -> 0x0(CUPS_DEST_FLAGS_NONE) . pdest2 is a connectable printer, but flags changs from 0x11 -> 0x21 -> 0x9(CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR), and cupsLastError() returns 502.
Expected behavior There should be a way to determine if the connection is successful based on the result of cupsConnectDest.
System Information: