Libcurl: Difference between revisions
No edit summary |
|||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
This page documents the libcurl package used by official sw. This is statically linked in the main-codebin, on old versions (~v2.x) this was a subsdk NSO. This page does not apply to the libcurl build included in the browser OSS NRO. | This page documents the libcurl package used by official sw. This is statically linked in the main-codebin, on old versions (~v2.x) this was a subsdk NSO. This page does not apply to the libcurl build included in the browser OSS NRO. | ||
Starting with sdkver 10.x, this is built with support for NGHTTP2 with the relevant [[SSL_services|Alpn]] cmds being used for this. | |||
The changes to libcurl compared to the original libcurl are documented below, etc. | The changes to libcurl compared to the original libcurl are documented below, etc. | ||
| Line 7: | Line 7: | ||
= CURLOPT = | = CURLOPT = | ||
The 50X options are custom, the default values for some of these are set in Curl_init_userdefined. | The 50X/900 options are custom, the default values for some of these are set in Curl_init_userdefined. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! CINIT name || CINIT type || CINIT number || CURLoption value || Default value | ! CINIT name || CINIT type || CINIT number || CURLoption value || Default value | ||
|- | |||
| [[#URL]] || STRINGPOINT || 2 || 10002 || | |||
|- | |||
| [[#SSL_CTX_FUNCTION]] || FUNCTIONPOINT || 108 || 20108 || | |||
|- | |- | ||
| [[#PROXYAUTOCONFIG]] || LONG || 500 || 500 || 1 | | [[#PROXYAUTOCONFIG]] || LONG || 500 || 500 || 1 | ||
| Line 17: | Line 21: | ||
| [[#UNK501]] || LONG || 501 || 501 || 0 | | [[#UNK501]] || LONG || 501 || 501 || 0 | ||
|- | |- | ||
| || || 502 || || | | [[#UNK502]] || OBJECTPOINT || 502 || 10502 || | ||
|- | |- | ||
| || || 503 || || | | [[#UNK503]] || FUNCTIONPOINT || 503 || 20503 || | ||
|- | |- | ||
| || || 504 || || | | [[#UNK504]] || FUNCTIONPOINT || 504 || 20504 || | ||
|- | |- | ||
| || || 505 || || | | [[#UNK505]] || OBJECTPOINT || 505 || 10505 || | ||
|- | |- | ||
| [[#UNK506]] || LONG || 506 || 506 || 0 | | [[#UNK506]] || LONG || 506 || 506 || 0 | ||
|- | |- | ||
| [[#UNK507]] || LONG || 507 || 507 || | | [[#UNK507]] || LONG || 507 || 507 || | ||
|- | |||
| [[#UNK900]] || LONG || 900 || 900 || | |||
|} | |} | ||
== URL == | |||
The following only runs when the [[#UNK900]] flag is not set, otherwise the URL is set directly using the input string. | |||
This was patched to use various string functionality and [[Sockets_services#nsd:u.2C_nsd:a|ResolveEx]] (only used if needed). sscanf is used twice with the following two format strings, with the input URL. If the first one returns <=1 and the second one returns <=0, the input URL is just copied to state, otherwise this continues with using ResolveEx etc. Format strings: | |||
* "%15[^\n:]://%[^\n/?:]%[^\n]" | |||
* "%[^\n/?:]%[^\n]" | |||
Afterwards, ResolveEx is used with the first output string from the latter sscanf as the input. Then the final URL is constructed with the output from ResolveEx. | |||
== SSL_CTX_FUNCTION == | |||
This funcptr is called with the same params as normal, with the context ptr being {sdknso container object for [[SSL_services#ISslContext|ISslContext]]}. If this funcptr returns non-zero, the CURLcode is set to CURLE_ABORTED_BY_CALLBACK. | |||
This is only used if [[#UNK502]] is not set, in which case an error is thrown if this funcptr is not set. An error is also thrown afterwards if the context wasn't created. | |||
The user must create the [[SSL_services#ISslContext|ISslContext]] using this funcptr, with all required ISslContext initialization - no cmds are used by the caller with ISslContext besides [[SSL_services#CreateConnection|CreateConnection]] (the caller doesn't use [[SSL_services#CreateContext|CreateContext]], the user must). | |||
== PROXYAUTOCONFIG == | == PROXYAUTOCONFIG == | ||
| Line 35: | Line 57: | ||
A warning is printed if this option is set when CURLOPT_PROXY is already set - in which case CURLOPT_PROXY is freed. | A warning is printed if this option is set when CURLOPT_PROXY is already set - in which case CURLOPT_PROXY is freed. | ||
This option controls whether to load the system proxy from [[Network_Interface_services#GetCurrentNetworkProfile|nifm]]. The code handling this option was added to the start of the inlined create_conn_helper_init_proxy func. | This option controls whether to load the system proxy from [[Network_Interface_services#GetCurrentNetworkProfile|nifm]]. The code handling this option was added to the start of the inlined create_conn_helper_init_proxy func. The loaded proxy info is written to the CURLOPT PROXY* options as needed. | ||
== UNK501 == | == UNK501 == | ||
| Line 41: | Line 63: | ||
This controls the value of the DataCheck [[SSL_services#VerifyOption|VerifyOption]] bit. | This controls the value of the DataCheck [[SSL_services#VerifyOption|VerifyOption]] bit. | ||
== UNK502 == | |||
If set, this is a ptr to a pre-initialized {sdknso container object for [[SSL_services#ISslContext|ISslContext]]}, which is used instead of creating a new one via [[#SSL_CTX_FUNCTION]]. | |||
== UNK503 == | |||
If set, this funcptr is called at the end of [[SSL_services#ISslConnection|ISslConnection]] setup, prior to using [[SSL_services#SetIoMode|SetIoMode]]. If this funcptr returns non-zero, the CURLcode is set to CURLE_ABORTED_BY_CALLBACK. | |||
This funcptr is called with the following params: (Curl_easy*, {sdknso container object for [[SSL_services#ISslConnection|ISslConnection]]}, [[#UNK505]]). | |||
This allows the user to optionally do additional custom [[SSL_services#ISslConnection|ISslConnection]] setup. | |||
== UNK504 == | |||
If set, this funcptr is called following [[SSL_services#DoHandshakeGetServerCert|DoHandshakeGetServerCert]] usage, if it didn't return error 0x1987B. If this funcptr returns non-zero, the CURLcode is set to CURLE_ABORTED_BY_CALLBACK. | |||
This is essentially a custom version of getting the CERTINFO. | |||
This funcptr is called with the following params: (Curl_easy*, {sdknso container object for [[SSL_services#ISslConnection|ISslConnection]]}, [[#UNK505]], {struct ptr}). | |||
Where the struct has the following format: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x1 || bool CURLcode==0 | |||
|- | |||
| 0x1 || 0x7 || Padding | |||
|- | |||
| 0x8 || 0x8 || Output-size from [[SSL_services#DoHandshakeGetServerCert|DoHandshakeGetServerCert]]. | |||
|- | |||
| 0x10 || 0x8 || Total-certs from [[SSL_services#DoHandshakeGetServerCert|DoHandshakeGetServerCert]]. | |||
|} | |||
== UNK505 == | |||
This option value is used as a param for the [[#UNK503]]/[[#UNK504]] funcptrs. | |||
== UNK506 == | == UNK506 == | ||
| Line 51: | Line 108: | ||
This controls the value of the [[SSL_services#OptionType|SkipDefaultVerify]] option flag. | This controls the value of the [[SSL_services#OptionType|SkipDefaultVerify]] option flag. | ||
== UNK900 == | |||
This option is handled as a bool. | |||
This is used during Curl_resolver_getaddrinfo. See also [[#URL]]. | |||
= CURLcode = | |||
This section documents the custom CURLcode values. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 95 || {sdknso container object for [[SSL_services#ISslContext|ISslContext]]} isn't initialized. | |||
|- | |||
| 96 || nnsslContextGetContextId failed. | |||
|- | |||
| 98 || Ptr is NULL. | |||
|} | |||