| 1044 | */ |
| 1045 | |
| 1046 | int /* O - 1 on success, 0 on error */ |
| 1047 | cupsdLogRequest(cupsd_client_t *con, /* I - Request to log */ |
| 1048 | http_status_t code) /* I - Response code */ |
| 1049 | { |
| 1050 | char temp[2048]; /* Temporary string for URI */ |
| 1051 | static const char * const states[] = /* HTTP client states... */ |
| 1052 | { |
| 1053 | "WAITING", |
| 1054 | "OPTIONS", |
| 1055 | "GET", |
| 1056 | "GET", |
| 1057 | "HEAD", |
| 1058 | "POST", |
| 1059 | "POST", |
| 1060 | "POST", |
| 1061 | "PUT", |
| 1062 | "PUT", |
| 1063 | "DELETE", |
| 1064 | "TRACE", |
| 1065 | "CLOSE", |
| 1066 | "STATUS" |
| 1067 | }; |
| 1068 | |
| 1069 | |
| 1070 | /* |
| 1071 | * Filter requests as needed... |
| 1072 | */ |
| 1073 | |
| 1074 | if (AccessLogLevel == CUPSD_ACCESSLOG_NONE || !AccessLog) |
| 1075 | return (1); |
| 1076 | else if (AccessLogLevel < CUPSD_ACCESSLOG_ALL) |
| 1077 | { |
| 1078 | /* |
| 1079 | * Eliminate simple GET, POST, and PUT requests... |
| 1080 | */ |
| 1081 | |
| 1082 | if ((con->operation == HTTP_GET && |
| 1083 | strncmp(con->uri, "/admin/conf", 11) && |
| 1084 | strncmp(con->uri, "/admin/log", 10)) || |
| 1085 | (con->operation == HTTP_POST && !con->request && |
| 1086 | strncmp(con->uri, "/admin", 6)) || |
| 1087 | (con->operation != HTTP_GET && con->operation != HTTP_POST && |
| 1088 | con->operation != HTTP_PUT)) |
| 1089 | return (1); |
| 1090 | |
| 1091 | if (con->request && con->response && |
| 1092 | (con->response->request.status.status_code < IPP_REDIRECTION_OTHER_SITE || |
| 1093 | con->response->request.status.status_code == IPP_NOT_FOUND)) |
| 1094 | { |
| 1095 | /* |
| 1096 | * Check successful requests... |
| 1097 | */ |
| 1098 | |
| 1099 | ipp_op_t op = con->request->request.op.operation_id; |
| 1100 | static cupsd_accesslog_t standard_ops[] = |
| 1101 | { |
| 1102 | CUPSD_ACCESSLOG_ALL, /* reserved */ |
| 1103 | CUPSD_ACCESSLOG_ALL, /* reserved */ |
no test coverage detected