I noticed that I was trying to send a binary file by modifying sdk/system/netutils/webclient.c.
If I try to send more than 1500 bytes of text (buffer), I try to send the buffer bytes properly for a few minutes.
The contents appear to be repeating the first 1500 bytes.
I understand that wget_base is not binary, so I copied wget_base and tried creating another function called wget_base_post_binary, but there seemed to be a problem with the original wget_base.
Specifically, the following parts may be the problem.
sdk/system/netutils/webclient.c:wget_base(FAR const char*url, FAR char*buffer, int buflen,
wget_callback_t callback, FAR void*arg,
FAR const char* posts, uint8_t mode)
of the
do
{
ret = https?tls_socket_write(sockfd, buffer, len)
: send(sockfd, buffer, len, 0);
if(ret<0)
{
nerr("ERROR:send failed:%d\n", errno);
goto errout;
}
len = len-ret;
}
while(len!=0);
That's the part, but
char*p_buffer=buffer;
do
{
ret = https?tls_socket_write(sockfd, p_buffer, len)
: send(sockfd, p_buffer, len, 0);
if(ret<0)
{
nerr("ERROR:send failed:%d\n", errno);
goto errout;
}
p_buffer+=ret;
len = len-ret;
}
while(len!=0);
I think it's necessary to write
spresense http
I am in charge of SPRESENSE support for Sony.
As you pointed out, there was an error regarding the wget_base of webclient.c included in the SDK.
I have created and reflected the correction to Github Pull Request.
Thank you for your feedback to SDK.
Thank you for your continued support at SPRESENSE.
SPRESENSE Support Team
© 2024 OneMinuteCode. All rights reserved.