Networking_Proxy_SetBasicAuthentication Function

Header: #include <applibs/networking.h>

Sets the proxy authentication method to basic.

Updates the specified Networking_ProxyConfig struct with the new authentication method.

  int Networking_Proxy_SetBasicAuthentication(Networking_ProxyConfig *proxyConfig, const char *username, const char *password);

Parameters

  • proxyConfig A pointer to the Networking_ProxyConfig struct to update.

  • username A pointer to the string containing the username to be used for authentication.

  • password A pointer to the string containing the password to be used for authentication.

Errors

If an error is encountered, returns -1 and sets errno to the error value.

  • EFAULT: The proxyConfig, username or password parameter is NULL.

  • ERANGE: The username length is greater than PROXY_USERNAME_MAX_LENGTH or is not null-terminated, or password length is greater than PROXY_PASSWORD_MAX_LENGTH or is not null-terminated.

Any other errno may also be specified; such errors aren't deterministic and there's no guarantee that the same behavior will be retained through system updates.

Returns

0 for success, or -1 for failure, in which case errno will be set to the error value.

Concepts and samples

The proxy code snippets demonstrate the following:

  • The Configure Proxy Settings code snippet demonstrates how to configure the proxy settings on an Azure Sphere device.
  • The Get Proxy Settings code snippet demonstrates how to retrieve the proxy settings on an Azure Sphere device.
  • The Enable/Disable Configured Proxy code snippet demonstrates how to enable/disable an already configured proxy on an Azure Sphere device.

The HTTPS samples demonstrate using the HTTPS_Curl_Easy and HTTPS_Curl_Multi APIs to fetch content over HTTPS. By default, they configure the cURL handle to use a proxy.

The AzureIoT sample contains instructions and code for adding web proxy support to the sample.