Skip to content

Commit

Permalink
debug HTTP output
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby committed Oct 2, 2024
1 parent b4bef00 commit 0795bae
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions library/oidc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0795bae

Please sign in to comment.