net: http: switch to zsock_ for http_client
Using zsock_ in http_client instead of the POSIX API versions of the functions allows the usage of http_client in combination with CONFIG_POSIX_API. Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
This commit is contained in:
parent
23c0e16782
commit
a8b7caa58d
1 changed files with 3 additions and 3 deletions
|
@ -32,7 +32,7 @@ LOG_MODULE_REGISTER(net_http, CONFIG_NET_HTTP_LOG_LEVEL);
|
||||||
static ssize_t sendall(int sock, const void *buf, size_t len)
|
static ssize_t sendall(int sock, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
while (len) {
|
while (len) {
|
||||||
ssize_t out_len = send(sock, buf, len, 0);
|
ssize_t out_len = zsock_send(sock, buf, len, 0);
|
||||||
|
|
||||||
if (out_len < 0) {
|
if (out_len < 0) {
|
||||||
return -errno;
|
return -errno;
|
||||||
|
@ -415,7 +415,7 @@ static int http_wait_data(int sock, struct http_request *req)
|
||||||
int received, ret;
|
int received, ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
received = recv(sock, req->internal.response.recv_buf + offset,
|
received = zsock_recv(sock, req->internal.response.recv_buf + offset,
|
||||||
req->internal.response.recv_buf_len - offset,
|
req->internal.response.recv_buf_len - offset,
|
||||||
0);
|
0);
|
||||||
if (received == 0) {
|
if (received == 0) {
|
||||||
|
@ -460,7 +460,7 @@ static void http_timeout(struct k_work *work)
|
||||||
struct http_client_internal_data *data =
|
struct http_client_internal_data *data =
|
||||||
CONTAINER_OF(work, struct http_client_internal_data, work);
|
CONTAINER_OF(work, struct http_client_internal_data, work);
|
||||||
|
|
||||||
(void)close(data->sock);
|
(void)zsock_close(data->sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int http_client_req(int sock, struct http_request *req,
|
int http_client_req(int sock, struct http_request *req,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue