Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: iothub_client_sample_http simplesample_http temp_sensor_anomaly
Revision 23:44d825a1cd09, committed 2016-09-22
- Comitter:
- AzureIoTClient
- Date:
- Thu Sep 22 18:15:56 2016 -0700
- Parent:
- 22:e0add922c564
- Child:
- 24:02406f4a78ae
- Commit message:
- 1.0.10
Changed in this revision
| iothubtransporthttp.c | Show annotated file Show diff for this revision Revisions of this file |
--- a/iothubtransporthttp.c Fri Aug 12 10:03:39 2016 -0700
+++ b/iothubtransporthttp.c Thu Sep 22 18:15:56 2016 -0700
@@ -668,35 +668,45 @@
return;
}
-
-/*Codes_SRS_TRANSPORTMULTITHTTP_17_005: [Otherwise, IoTHubTransportHttp_Create shall create an immutable string (further called hostname) containing config->upperConfig->iotHubName + config->upperConfig->iotHubSuffix.]*/
+/*Codes_SRS_TRANSPORTMULTITHTTP_17_005: [If config->upperConfig->protocolGatewayHostName is NULL, `IoTHubTransportHttp_Create` shall create an immutable string (further called hostname) containing `config->transportConfig->iotHubName + config->transportConfig->iotHubSuffix`.] */
+/*Codes_SRS_TRANSPORTMULTITHTTP_20_001: [If config->upperConfig->protocolGatewayHostName is not NULL, IoTHubTransportHttp_Create shall use it as hostname] */
static void destroy_hostName(HTTPTRANSPORT_HANDLE_DATA* handleData)
{
STRING_delete(handleData->hostName);
handleData->hostName = NULL;
}
-/*Codes_SRS_TRANSPORTMULTITHTTP_17_005: [Otherwise, IoTHubTransportHttp_Create shall create an immutable string (further called hostname) containing config->upperConfig->iotHubName + config->upperConfig->iotHubSuffix.]*/
static bool create_hostName(HTTPTRANSPORT_HANDLE_DATA* handleData, const IOTHUBTRANSPORT_CONFIG* config)
{
bool result;
- handleData->hostName = STRING_construct(config->upperConfig->iotHubName);
- if (handleData->hostName == NULL)
+ if (config->upperConfig->protocolGatewayHostName != NULL)
{
- result = false;
+ /*Codes_SRS_TRANSPORTMULTITHTTP_20_001: [If config->upperConfig->protocolGatewayHostName is not NULL, IoTHubTransportHttp_Create shall use it as hostname] */
+ handleData->hostName = STRING_construct(config->upperConfig->protocolGatewayHostName);
+ result = (handleData->hostName != NULL);
}
else
{
- if ((STRING_concat(handleData->hostName, ".") != 0) ||
- (STRING_concat(handleData->hostName, config->upperConfig->iotHubSuffix) != 0))
+ /*Codes_SRS_TRANSPORTMULTITHTTP_17_005: [If config->upperConfig->protocolGatewayHostName is NULL, `IoTHubTransportHttp_Create` shall create an immutable string (further called hostname) containing `config->transportConfig->iotHubName + config->transportConfig->iotHubSuffix`.] */
+ handleData->hostName = STRING_construct(config->upperConfig->iotHubName);
+
+ if (handleData->hostName == NULL)
{
- /*Codes_SRS_TRANSPORTMULTITHTTP_17_006: [ If creating the hostname fails then IoTHubTransportHttp_Create shall fail and return NULL. ] */
- destroy_hostName(handleData);
result = false;
}
else
{
- result = true;
+ if ((STRING_concat(handleData->hostName, ".") != 0) ||
+ (STRING_concat(handleData->hostName, config->upperConfig->iotHubSuffix) != 0))
+ {
+ /*Codes_SRS_TRANSPORTMULTITHTTP_17_006: [ If creating the hostname fails then IoTHubTransportHttp_Create shall fail and return NULL. ] */
+ destroy_hostName(handleData);
+ result = false;
+ }
+ else
+ {
+ result = true;
+ }
}
}
return result;