MCPcopy Create free account
hub / github.com/acl-dev/acl / http_error_reply

Function http_error_reply

lib_acl/samples/dict/unix_aio/http_error.c:17–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17void http_error_reply(HTTP_CLIENT *http_client, int status, const char *msg)
18{
19 static __thread ACL_VSTRING *__buf = NULL;
20 const ACL_VSTRING *str;
21 const char *ptr;
22 struct iovec iov[2];
23
24 if (__buf == NULL) {
25 __buf = acl_vstring_alloc(256);
26 acl_pthread_atexit_add(__buf, free_buf);
27 }
28
29 ptr = http_tmpl_title(status);
30 str = http_tmpl_get(status);
31
32 if (msg == NULL || *msg == 0)
33 msg = acl_vstring_str(str);
34
35 acl_vstring_sprintf(__buf, reply_error_fmt, status, ptr);
36
37 iov[0].iov_base = acl_vstring_str(__buf);
38 iov[0].iov_len = ACL_VSTRING_LEN(__buf);
39 iov[1].iov_base = (char*) msg;
40 iov[1].iov_len = strlen(msg);
41
42 acl_aio_writev(http_client->stream, iov, 2);
43}

Callers 3

read_request_body_readyFunction · 0.70
http_serviceFunction · 0.70
request_header_readyFunction · 0.70

Calls 6

acl_vstring_allocFunction · 0.85
acl_pthread_atexit_addFunction · 0.85
http_tmpl_titleFunction · 0.85
http_tmpl_getFunction · 0.85
acl_vstring_sprintfFunction · 0.85
acl_aio_writevFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…