| 15 | } |
| 16 | |
| 17 | void 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 | } |
no test coverage detected
searching dependent graphs…