If myConfig.url contains a numeric IP address, the connection does not succeed. If it contains a name which resolves to the same IP address, fetching data works.
The reason seems to be in httpclientFetch(), where espconn_gethostbyname() is called to resolve the hostname part of the URL. Once the name is resolved, this function calls a callback function which handles the rest of the connection. However, if the IP address is known immediately, espconn_gethostbyname() returns directly and does NOT call the callback function, which means that passing an IP address results in the connection failing.
I tried checking the return value of espconn_gethostbyname() and call the function myself. This still did not work, apparently because the network connection was not complete by the time this function was called. It seems espconn_gethostbyname() also provides a way here to ensure that the connection is up before proceeding.
This is an issue in the original code, but it is not on GitHub, so I post it here.
If myConfig.url contains a numeric IP address, the connection does not succeed. If it contains a name which resolves to the same IP address, fetching data works.
The reason seems to be in httpclientFetch(), where espconn_gethostbyname() is called to resolve the hostname part of the URL. Once the name is resolved, this function calls a callback function which handles the rest of the connection. However, if the IP address is known immediately, espconn_gethostbyname() returns directly and does NOT call the callback function, which means that passing an IP address results in the connection failing.
I tried checking the return value of espconn_gethostbyname() and call the function myself. This still did not work, apparently because the network connection was not complete by the time this function was called. It seems espconn_gethostbyname() also provides a way here to ensure that the connection is up before proceeding.
This is an issue in the original code, but it is not on GitHub, so I post it here.