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

Function http_error_reply

lib_acl/samples/dict/unix/http_error.c:18–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

http_serviceFunction · 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_vstream_writevnFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…