Lines Matching refs:curl
29 static CURLcode send_ping(CURL *curl, const char *send_payload) in send_ping() argument
33 curl_ws_send(curl, send_payload, strlen(send_payload), &sent, 0, in send_ping()
41 static CURLcode recv_pong(CURL *curl, const char *expected_payload) in recv_pong() argument
46 CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta); in recv_pong()
70 static CURLcode recv_any(CURL *curl) in recv_any() argument
75 CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta); in recv_any()
85 static void websocket_close(CURL *curl) in websocket_close() argument
89 curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE); in websocket_close()
94 static void websocket(CURL *curl) in websocket() argument
99 recv_any(curl); in websocket()
101 if(send_ping(curl, "foobar")) in websocket()
104 if(recv_pong(curl, "foobar")) { in websocket()
110 websocket_close(curl); in websocket()
115 CURL *curl; in test() local
120 curl = curl_easy_init(); in test()
121 if(curl) { in test()
122 curl_easy_setopt(curl, CURLOPT_URL, URL); in test()
125 curl_easy_setopt(curl, CURLOPT_USERAGENT, "websocket/2304"); in test()
126 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); in test()
127 curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */ in test()
128 res = curl_easy_perform(curl); in test()
131 websocket(curl); in test()
134 curl_easy_cleanup(curl); in test()