Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define APPLE_CERT_NAME "certs/apple.cer"
- #define APPLE_CERT_TYPE "PK12"
- #define APPLE_PUSH_SERVICE_URL "gateway.sandbox.push.apple.com:2195"
- CURLcode c;
- c = curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
- if (c != CURLE_OK)
- WARNX("curl_easy_setopt error CURLOPT_USE_SLL %s", curl_easy_strerror(c));
- c = curl_easy_setopt(curl, CURLOPT_SSLCERT, APPLE_CERT_NAME);
- if (c != CURLE_OK)
- WARNX("curl_easy_setopt error CURLOPT_SSLCERT: %s", curl_easy_strerror(c));
- c = curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, APPLE_CERT_TYPE);
- if (c != CURLE_OK)
- WARNX("curl_easy_setopt error CURLOPT_SSL_CERTTYPE: %s", curl_easy_strerror(c));
- curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
- curl_easy_setopt(curl, CURLOPT_URL, APPLE_PUSH_SERVICE_URL);
- // curl_easy_perform
- size_t sent, rec = 0;
- ccode = curl_easy_send(curl, ((struct ios_push_request *)buffer->aux_data)->sbuffer, ((struct ios_push_request *)buffer->aux_data)->request_size, &sent);
- if (ccode != CURLE_OK)
- WARNX("curl_easy_send %s", curl_easy_strerror(ccode));
- LOG("----- Sent %lu bytes from %lu", sent, ((struct ios_push_request *)buffer->aux_data)->request_size); // it always sends all the data
- sleep(3);
- ccode = curl_easy_recv(curl, buf, 1024, &rec);
- if (ccode != CURLE_OK)
- WARNX("curl_easy_recv %s", curl_easy_strerror(ccode)); // unsupported protocol
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement