Hi, this is my first post here. First of all, sorry for my english.
I have a problem:
I have a server pointing to raspberry server wich expects a JSON object.
When i pass parameters directly to raspberry server, there is no problem, it recive fine, but when i pass the parameters redirecting there is no answer. Every change if i encode base64 my JSON and send it, all works!. But when i try to implement in IDF doesnt work.
///////////////////////////ENCODING JSON//////////////////////////////////////////////////////////
char* to_Encode = "{\"user_usr\":\"DeviceUsr\",\"user_psw\":\"DevicePsw\"}";
size_t outPutLenght;
unsigned char * coded = base64_encode((const unsigned char *)to_Encode, strlen(to_Encode), &outPutLenght);
char* coded_send = (const char *)coded;
char* server_service_get_token = "http://myhost/user_login/";
char* full_service_token =concatb(server_service_get_token,coded_send);
///////////////////////////////CONFIGURE HTTP REQ//////////////////////////////////
esp_http_client_config_t config = {
.url = full_service_token,
.event_handler = _http_event_handler,
};
//////////////////////////////ERROR /////////////////////////////////////////////////////////
Error parse url http://myhost/user_login/eyJ1c2VyX3Vzci ... NlUHN3In0=
HTTP_CLIENT: Error set default configurations
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
But if i do this on . url works!, WTFF
esp_http_client_config_t config = {
.url = "http://myhost/user_login/eyJ1c2VyX3Vzci ... NlUHN3In0=",
.event_handler = _http_event_handler,
};
Any idea?
Send base64 by url
Re: Send base64 by url
maybe you are missing trailing \0 in coded variable?
Re: Send base64 by url
Tested "\0" and not work u.u
Re: Send base64 by url
Its how i am doing it:
I am allocating in spiram, because i need huge buffer.
Code: Select all
unsigned char *buffer = (unsigned char*) heap_caps_calloc(1, (size + 2 - ((size + 2) % 3)) / 3 * 4 + 1, MALLOC_CAP_SPIRAM);
if (buffer == NULL)
{
ESP_LOGE(TAG, "cant allocate memory");
return;
}
ESP_LOGI(TAG, "buffer size: %d", size);
int err64 = mbedtls_base64_encode(buffer, (size + 2 - ((size + 2) % 3)) / 3 * 4 + 1, &buff_size, image, size);
Who is online
Users browsing this forum: Baidu [Spider] and 87 guests