Модель консоли: PS3 SS
Прошивка: HFW 4.91.2
Регистрация: 10.04.2016
Возраст: 49
Сообщений: 27,529
Вы сказали Спасибо: 10,200
Поблагодарили 14,684 раз(а) в 6,609 сообщениях
Сила репутации: 10Репутация: 14559 
(репутация неоспорима)
|
Сообщение от Inpos
я не нашёл в силу незнания SDK PS3
|
https://www.psdevwiki.com/ps3/VSH_Exports#cellHttp
0x4D40CF98 cellHttpClientGetProxy int cellHttpClientGetProxy(CellHttpClientId clientId, CellHttpUri *proxy, void *pool, size_t poolSize, size_t *required)
Если нужно еще, через поиск proxy думаю найдете.
цитата из pkgi_ps3
код
void pkgi_curl_init(CURL *curl)
{
// Set user agent string
curl_easy_setopt(curl, CURLOPT_USERAGENT, PKGI_USER_AGENT);
// don't verify the certificate's name against host
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
// don't verify the peer's SSL certificate
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
// Set SSL VERSION to TLS 1.2
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
// Set timeout for the connection to build
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 20L);
// Follow redirects
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
// maximum number of redirects allowed
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 20L);
// Fail the request if the HTTP code returned is equal to or larger than 400
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
}
pkgi_http* pkgi_http_get(const char* url, const char* content, uint64_t offset)
{
LOG("http get");
if (!pkgi_validate_url(url))
{
LOG("unsupported URL (%s)", url);
return NULL;
}
pkgi_http* http = NULL;
for (size_t i = 0; i < 4; i++)
{
if (g_http[i].used == 0)
{
http = &g_http[i];
break;
}
}
if (!http)
{
LOG("too many simultaneous http requests");
return NULL;
}
http->curl = curl_easy_init();
if (!http->curl)
{
LOG("curl init error");
return NULL;
}
pkgi_curl_init(http->curl);
curl_easy_setopt(http->curl, CURLOPT_URL, url);
LOG("starting http GET request for %s", url);
if (offset != 0)
{
LOG("setting http offset %ld", offset);
/* resuming upload at this position */
curl_easy_setopt(http->curl, CURLOPT_RESUME_FROM_LARGE, (curl_off_t) offset);
}
http->used = 1;
return(http);
}
int pkgi_http_response_length(pkgi_http* http, int64_t* length)
{
CURLcode res;
// do the download request without getting the body
curl_easy_setopt(http->curl, CURLOPT_NOBODY, 1L);
curl_easy_setopt(http->curl, CURLOPT_NOPROGRESS, 1L);
// Perform the request
res = curl_easy_perform(http->curl);
if(res != CURLE_OK)
{
LOG("curl_easy_perform() failed: %s", curl_easy_strerror(res));
return 0;
}
long status = 0;
curl_easy_getinfo(http->curl, CURLINFO_RESPONSE_CODE, &status);
LOG("http status code = %d", status);
curl_easy_getinfo(http->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, length);
LOG("http response length = %llu", *length);
http->size = *length;
return 1;
}
int pkgi_http_read(pkgi_http* http, void* write_func, void* xferinfo_func)
{
CURLcode res;
curl_easy_setopt(http->curl, CURLOPT_NOBODY, 0L);
// The function that will be used to write the data
curl_easy_setopt(http->curl, CURLOPT_WRITEFUNCTION, write_func);
// The data file descriptor which will be written to
curl_easy_setopt(http->curl, CURLOPT_WRITEDATA, NULL);
if (xferinfo_func)
{
/* pass the struct pointer into the xferinfo function */
curl_easy_setopt(http->curl, CURLOPT_XFERINFOFUNCTION, xferinfo_func);
curl_easy_setopt(http->curl, CURLOPT_XFERINFODATA, NULL);
curl_easy_setopt(http->curl, CURLOPT_NOPROGRESS, 0L);
}
// Perform the request
res = curl_easy_perform(http->curl);
if(res != CURLE_OK)
{
LOG("curl_easy_perform() failed: %s", curl_easy_strerror(res));
return 0;
}
return 1;
}
void pkgi_http_close(pkgi_http* http)
{
LOG("http close");
curl_easy_cleanup(http->curl);
http->used = 0;
}
|