178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/* Message buffer for type = MESSAGE */
/* Path buffer for type = TRANSFER */
char buffer[FILED_PATH_BUFFER_SIZE];
/* Items for type = TRANSFER */
int http_code;
const char *reason;
time_t starttime;
time_t endtime;
off_t req_offset;
off_t req_length;
off_t sent_length;
off_t file_length;
char ip[128];
|
>
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/* Message buffer for type = MESSAGE */
/* Path buffer for type = TRANSFER */
char buffer[FILED_PATH_BUFFER_SIZE];
/* Items for type = TRANSFER */
int http_code;
const char *reason;
time_t connecttime;
time_t starttime;
time_t endtime;
off_t req_offset;
off_t req_length;
off_t sent_length;
off_t file_length;
char ip[128];
|
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
break;
}
if (curr->endtime == ((time_t) -1)) {
curr->endtime = now;
}
fprintf(fp, "TRANSFER METHOD=%s PATH=%s SRC=%s:%i TIME.START=%llu TIME.END=%llu CODE.VALUE=%u CODE.REASON=%s REQUEST.OFFSET=%llu REQUEST.LENGTH=%llu FILE.LENGTH=%llu TRANSFER.LENGTH=%llu",
method,
curr->buffer,
curr->ip, curr->port,
(unsigned long long) curr->starttime,
(unsigned long long) curr->endtime,
curr->http_code, curr->reason,
(unsigned long long) curr->req_offset,
(unsigned long long) curr->req_length,
(unsigned long long) curr->file_length,
(unsigned long long) curr->sent_length
|
|
>
|
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
|
break;
}
if (curr->endtime == ((time_t) -1)) {
curr->endtime = now;
}
fprintf(fp, "TRANSFER METHOD=%s PATH=%s SRC=%s:%i CLIENT.TIME.CONNECT=%llu REQUEST.TIME.START=%llu REQUEST.TIME.END=%llu CODE.VALUE=%u CODE.REASON=%s REQUEST.OFFSET=%llu REQUEST.LENGTH=%llu FILE.LENGTH=%llu TRANSFER.LENGTH=%llu",
method,
curr->buffer,
curr->ip, curr->port,
(unsigned long long) curr->connecttime,
(unsigned long long) curr->starttime,
(unsigned long long) curr->endtime,
curr->http_code, curr->reason,
(unsigned long long) curr->req_offset,
(unsigned long long) curr->req_length,
(unsigned long long) curr->file_length,
(unsigned long long) curr->sent_length
|
514
515
516
517
518
519
520
521
522
523
524
525
526
527
|
struct filed_log_entry *retval;
retval = malloc(sizeof(*retval));
if (initialize) {
retval->buffer[0] = '\0';
retval->http_code = -1;
retval->starttime = 0;
retval->endtime = 0;
retval->req_offset = 0;
retval->req_length = 0;
retval->sent_length = 0;
retval->file_length = 0;
retval->ip[0] = '\0';
|
>
|
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
|
struct filed_log_entry *retval;
retval = malloc(sizeof(*retval));
if (initialize) {
retval->buffer[0] = '\0';
retval->http_code = -1;
retval->connecttime = 0;
retval->starttime = 0;
retval->endtime = 0;
retval->req_offset = 0;
retval->req_length = 0;
retval->sent_length = 0;
retval->file_length = 0;
retval->ip[0] = '\0';
|
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
|
ssize_t sendfile_ret;
size_t sendfile_size;
off_t sendfile_offset, sendfile_sent, sendfile_len;
char *path;
char *date_current, date_current_b[64];
int http_code;
FILE *fp;
/* Determine current time */
date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));
/* Open socket as ANSI I/O for ease of use */
fp = fdopen(fd, "w+b");
if (fp == NULL) {
|
>
>
>
|
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
|
ssize_t sendfile_ret;
size_t sendfile_size;
off_t sendfile_offset, sendfile_sent, sendfile_len;
char *path;
char *date_current, date_current_b[64];
int http_code;
FILE *fp;
/* Indicate the connection start time */
log->connecttime = time(NULL);
/* Determine current time */
date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));
/* Open socket as ANSI I/O for ease of use */
fp = fdopen(fd, "w+b");
if (fp == NULL) {
|