mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 05:31:44 +00:00
--log-sendfile
This commit is contained in:
@@ -8,6 +8,10 @@ void get_linux_tcp_info(int fd) {
|
||||
socklen_t tis = sizeof(struct tcp_info) ;
|
||||
|
||||
if (!getsockopt(fd, IPPROTO_TCP, TCP_INFO, &ti, &tis)) {
|
||||
// a check for older linux kernels
|
||||
if (!ti.tcpi_sacked) {
|
||||
return 0;
|
||||
}
|
||||
if (ti.tcpi_unacked >= ti.tcpi_sacked) {
|
||||
uwsgi_log_verbose("*** uWSGI listen queue of socket %d full !!! (%d/%d) ***\n", fd, ti.tcpi_unacked, ti.tcpi_sacked);
|
||||
}
|
||||
|
||||
@@ -149,6 +149,7 @@ static struct option long_options[] = {
|
||||
{"log-4xx", no_argument, 0, LONG_ARGS_LOG_4xx},
|
||||
{"log-5xx", no_argument, 0, LONG_ARGS_LOG_5xx},
|
||||
{"log-big", required_argument, 0, LONG_ARGS_LOG_BIG},
|
||||
{"log-sendfile", required_argument, 0, LONG_ARGS_LOG_SENDFILE},
|
||||
{"chdir", required_argument, 0, LONG_ARGS_CHDIR},
|
||||
{"chdir2", required_argument, 0, LONG_ARGS_CHDIR2},
|
||||
{"mount", required_argument, 0, LONG_ARGS_MOUNT},
|
||||
@@ -2322,6 +2323,9 @@ void manage_opt(int i, char *optarg) {
|
||||
case LONG_ARGS_LOG_BIG:
|
||||
uwsgi.shared->options[UWSGI_OPTION_LOG_BIG] = atoi(optarg);
|
||||
break;
|
||||
case LONG_ARGS_LOG_SENDFILE:
|
||||
uwsgi.shared->options[UWSGI_OPTION_LOG_SENDFILE] = 1;
|
||||
break;
|
||||
case LONG_ARGS_MOUNT:
|
||||
if (uwsgi.mounts_cnt < MAX_MOUNTPOINTS) {
|
||||
uwsgi.mounts[uwsgi.mounts_cnt] = optarg;
|
||||
@@ -2513,6 +2517,7 @@ void manage_opt(int i, char *optarg) {
|
||||
\t--log-4xx\t\t\tlog requests with status code 4xx\n\
|
||||
\t--log-5xx\t\t\tlog requests with status code 5xx\n\
|
||||
\t--log-big <n>\t\t\tlog requests bigger than <n> bytes\n\
|
||||
\t--log-sendfile\t\t\tlog sendfile() requests\n\
|
||||
\t--ignore-script-name\t\tdisable uWSGI management of SCRIPT_NAME\n\
|
||||
\t--no-default-app\t\tdo not fallback unknown SCRIPT_NAME requests\n\
|
||||
\t--ini <inifile>\t\t\tpath of ini config file\n\
|
||||
|
||||
@@ -211,6 +211,7 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t);
|
||||
#define LONG_ARGS_LOG_BIG 17052
|
||||
#define LONG_ARGS_MOUNT 17053
|
||||
#define LONG_ARGS_THREADS 17054
|
||||
#define LONG_ARGS_LOG_SENDFILE 17055
|
||||
|
||||
|
||||
|
||||
@@ -269,6 +270,7 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t);
|
||||
#define UWSGI_OPTION_LOG_4xx 11
|
||||
#define UWSGI_OPTION_LOG_5xx 12
|
||||
#define UWSGI_OPTION_LOG_BIG 13
|
||||
#define UWSGI_OPTION_LOG_SENDFILE 14
|
||||
|
||||
#define UWSGI_MODIFIER_ADMIN_REQUEST 10
|
||||
#define UWSGI_MODIFIER_SPOOL_REQUEST 17
|
||||
|
||||
@@ -406,5 +406,8 @@ void uwsgi_after_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_LOG_BIG]) {
|
||||
if (wsgi_req->response_size >= uwsgi.shared->options[UWSGI_OPTION_LOG_BIG]) { log_request(wsgi_req); return; }
|
||||
}
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_LOG_SENDFILE]) {
|
||||
if (wsgi_req->sendfile_fd > -1 && wsgi_req->sendfile_obj == wsgi_req->async_result) { log_request(wsgi_req); return; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user