Overview
Comment: | Added support for sending correct MIME type |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
12083325549fb0a7c0fbc76a581221d2 |
User & Date: | rkeene on 2014-02-07 22:56:36 |
Other Links: | manifest | tags |
Context
2014-02-07
| ||
23:23 | Added start of logging check-in: 08a3222e4b user: rkeene tags: trunk | |
22:56 | Added support for sending correct MIME type check-in: 1208332554 user: rkeene tags: trunk | |
21:51 | Updated wiki HTML page check-in: e7fa8416e1 user: rkeene tags: trunk | |
Changes
Modified Makefile from [d4f93cadc6] to [1dfba37223].
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + + + + + + + - + | mandir = $(prefix)/share/man all: filed filed: filed.o $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^ $(LIBS) |
Modified filed.c from [5138c920c1] to [dc9403b4bb].
︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | + - + | #include <errno.h> #include <time.h> #include <pwd.h> /* Compile time constants */ #define FILED_SENDFILE_MAX 16777215 #define MAX_FAILURE_COUNT 30 #define FILED_DEFAULT_TYPE "application/octet-stream" /* Default values */ #define PORT 80 #define THREAD_COUNT 5 #define BIND_ADDR "::" #define CACHE_SIZE 8209 /* Arguments for worker threads */ struct filed_worker_thread_args { int fd; }; /* File information */ struct filed_fileinfo { pthread_mutex_t mutex; char *path; int fd; off_t len; char *lastmod; char lastmod_b[64]; |
︙ | |||
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | + + + + + + + + + + + + + + + + + + + + + + + + | } if (prev < curr) { diff = curr - prev; } else { diff = prev - curr; } prev = curr; retval <<= 3; retval &= 0xFFFFFFFFLU; retval ^= diff; value++; } retval = retval % modulus; return(retval); } /* Find a mime-type based on the filename */ static const char *filed_determine_mimetype(const char *path) { const char *p; p = strrchr(path, '.'); if (p == NULL) { return(FILED_DEFAULT_TYPE); } p++; if (*p == '\0') { return(FILED_DEFAULT_TYPE); } filed_log_msg_debug("Looking up MIME type for %s (hash = %llu)", p, (unsigned long long) filed_hash((const unsigned char *) p, 16777259)); #include "filed-mime-types.h" return(FILED_DEFAULT_TYPE); } /* Open a file and return file information */ static struct filed_fileinfo *filed_open_file(const char *path, struct filed_fileinfo *buffer) { struct filed_fileinfo *cache; unsigned int cache_idx; off_t len; int fd; |
︙ | |||
268 269 270 271 272 273 274 275 276 | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | + - | len = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); cache->fd = fd; cache->len = len; cache->path = strdup(path); cache->type = filed_determine_mimetype(path); /* XXX:TODO: Determine */ |
︙ |
Added generate-mime-types version [a953fb49d0].
|