goto errout_before_tlsinit;
}
- if (param->callback) {
- param->response = &response;
- if (http_client_response_init(param->response) < 0) {
- ndbg("ERROR: response init failed: %d\n", ret);
- goto errout_before_tlsinit;
- }
- }
-
#ifdef CONFIG_NET_SECURITY_TLS
client_tls->client_fd = sockfd;
if (param->tls && (ret = wget_tls_handshake(client_tls, ws.hostname))) {
}
}
+ if (param->callback && param->response == NULL) {
+ param->response = &response;
+ if (http_client_response_init(param->response) < 0) {
+ ndbg("ERROR: response init failed: %d\n", ret);
+ param->response = NULL;
+ goto errout;
+ }
+ }
+
buf_len = 0;
while (!read_finish) {
if (remain <= 0) {
param->response->entity_len = strlen(param->response->entity);
}
- if (param->callback) {
+ if (param->callback && param->response) {
param->callback(param->response);
http_client_response_release(param->response);
}
return (pthread_addr_t)WGET_OK;
errout:
- if (param->callback) {
+ if (param->callback && param->response) {
http_client_response_release(param->response);
}
#ifdef CONFIG_NET_SECURITY_TLS