diff --git a/library/oidc.c b/library/oidc.c index e9ad78a5..b0351c27 100644 --- a/library/oidc.c +++ b/library/oidc.c @@ -482,11 +482,28 @@ static void ext_accept(uv_work_t *wr) { string_buf_fmt(&resp_buf, RESP_FMT, strlen(resp_body), resp_body); size_t resp_len; char *resp = string_buf_to_string(&resp_buf, &resp_len); + const char *rp = resp; + + while (resp_len > 0) { + ssize_t wc = +#if _WIN32 + send(clt, rp, resp_len, 0); +#else + write(clt, rp, resp_len); +#endif + if (wc < 0) { + int err = #if _WIN32 - send(clt, resp, resp_len, 0); + WSAGetLastError(); #else - write(clt, resp, resp_len); + errno; #endif + ZITI_LOG(WARN, "failed to write HTTP resp: %d/%s", err, strerror(err)); + break; + } + resp_len -= wc; + rp += wc; + } free(resp); string_buf_free(&resp_buf);