Skip to content

Commit d882e83

Browse files
committed
Revert "Fix curl GH test"
This reverts commit 0bff693.
1 parent 0bff693 commit d882e83

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

examples/mqttnet.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -737,16 +737,22 @@ mqttcurl_connect(SocketContext* sock, const char* host, word16 port,
737737

738738
if (timeout_ms != 0) {
739739
res = curl_easy_setopt(sock->curl, CURLOPT_CONNECTTIMEOUT_MS,
740-
(long)timeout_ms);
740+
timeout_ms);
741741

742742
if (res != CURLE_OK) {
743743
PRINTF("error: curl_easy_setopt(CONNECTTIMEOUT_MS, %d) "
744744
"returned %d", timeout_ms, res);
745745
return MQTT_CODE_ERROR_CURL;
746746
}
747-
/* Note: CURLOPT_TIMEOUT_MS is not used here because it sets a total
748-
* transfer timeout, which is not applicable with CURLOPT_CONNECT_ONLY
749-
* mode where we use curl_easy_send/recv manually after connect. */
747+
748+
res = curl_easy_setopt(sock->curl, CURLOPT_TIMEOUT_MS,
749+
timeout_ms);
750+
751+
if (res != CURLE_OK) {
752+
PRINTF("error: curl_easy_setopt(TIMEOUT_MS, %d) "
753+
"returned %d", timeout_ms, res);
754+
return MQTT_CODE_ERROR_CURL;
755+
}
750756
}
751757

752758
res = curl_easy_setopt(sock->curl, CURLOPT_URL, host);
@@ -757,7 +763,7 @@ mqttcurl_connect(SocketContext* sock, const char* host, word16 port,
757763
return MQTT_CODE_ERROR_CURL;
758764
}
759765

760-
res = curl_easy_setopt(sock->curl, CURLOPT_PORT, (long)port);
766+
res = curl_easy_setopt(sock->curl, CURLOPT_PORT, port);
761767

762768
if (res != CURLE_OK) {
763769
PRINTF("error: curl_easy_setopt(PORT, %d) returned: %d",
@@ -839,7 +845,7 @@ mqttcurl_connect(SocketContext* sock, const char* host, word16 port,
839845
*/
840846

841847
/* Set peer and host verification. */
842-
res = curl_easy_setopt(sock->curl, CURLOPT_SSL_VERIFYPEER, 1L);
848+
res = curl_easy_setopt(sock->curl, CURLOPT_SSL_VERIFYPEER, 1);
843849

844850
if (res != CURLE_OK) {
845851
PRINTF("error: curl_easy_setopt(SSL_VERIFYPEER) returned: %d",
@@ -850,10 +856,10 @@ mqttcurl_connect(SocketContext* sock, const char* host, word16 port,
850856
/* Only do server host verification when not running against
851857
* localhost broker. */
852858
if (XSTRCMP(host, "localhost") == 0) {
853-
res = curl_easy_setopt(sock->curl, CURLOPT_SSL_VERIFYHOST, 0L);
859+
res = curl_easy_setopt(sock->curl, CURLOPT_SSL_VERIFYHOST, 0);
854860
}
855861
else {
856-
res = curl_easy_setopt(sock->curl, CURLOPT_SSL_VERIFYHOST, 2L);
862+
res = curl_easy_setopt(sock->curl, CURLOPT_SSL_VERIFYHOST, 2);
857863
}
858864

859865
if (res != CURLE_OK) {
@@ -892,7 +898,7 @@ mqttcurl_connect(SocketContext* sock, const char* host, word16 port,
892898
}
893899
#endif
894900

895-
res = curl_easy_setopt(sock->curl, CURLOPT_CONNECT_ONLY, 1L);
901+
res = curl_easy_setopt(sock->curl, CURLOPT_CONNECT_ONLY, 1);
896902

897903
if (res != CURLE_OK) {
898904
PRINTF("error: curl_easy_setopt(CONNECT_ONLY, 1) returned: %d",

0 commit comments

Comments
 (0)