Overview
Comment: | Merged in trunk |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | remove-c11-atomics |
Files: | files | file ages | folders |
SHA1: |
1c1d95a764aee834a7b3e1d3e2e462f4 |
User & Date: | rkeene on 2020-03-31 13:41:47 |
Other Links: | branch diff | manifest | tags |
Context
2020-03-31
| ||
14:19 | Use a mutex (for now?) for closing idle sockets check-in: 158143b222 user: rkeene tags: remove-c11-atomics | |
13:41 | Merged in trunk check-in: 1c1d95a764 user: rkeene tags: remove-c11-atomics | |
2018-05-03
| ||
20:08 | Added support for not redirecting to index.html check-in: 879cdc86ce user: rkeene tags: trunk | |
2016-09-22
| ||
17:35 | Started branch to replace C11 atomics with simpler (but hopefully lock-free) implementation check-in: c6f6825723 user: rkeene tags: remove-c11-atomics | |
Changes
Modified .fossil-settings/ignore-glob from [72ecff7281] to [3d8734b3a3].
1 2 3 | 1 2 3 4 | + | filed filed.o filed-mime-types.h compiled |
Modified Makefile from [d6a72f7309] to [2fd19df44e].
1 | 1 2 3 4 5 6 7 8 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 36 | - + + + - + - - - + + + - + - + | CC = gcc |
︙ |
Modified README from [280019e35b] to [dc3dfdd9b3].
︙ | |||
70 71 72 73 74 75 76 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | + + + + + - + | rather than call chroot() at startup. This is less secure and slower and should be generally avoided -- however it may be necessary to do. In these cases the executable may be compiled with the FILED_FAKE_CHROOT C preprocessor macro defined and instead of calling chroot() all HTTP requests will have the root suffix specified as the argument to the "-r" or "--root" option prepended to them. 5. Differing "index.html" handling (CFLAGS, -DFILED_DONT_REDIRECT_DIRECTORIES=1) Normally "filed" redirects users who request a directory to the index.html file in that directory so that no memory allocations are required; This option lets the server generate the new path. |
︙ |
Added build/build-precompiled version [46b4f35d88].
|
Modified filed.1 from [322827fb73] to [193b38d17e].
1 | 1 2 3 4 5 6 7 8 9 | - + | .PU |
︙ |
Modified filed.c from [a92c173e7c] to [66294af131].
︙ | |||
40 41 42 43 44 45 46 | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | - + | #include <fcntl.h> #include <stdio.h> #include <errno.h> #include <time.h> #include <pwd.h> /* Compile time constants */ |
︙ | |||
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | + + + - - + + + + + + + + + - + + | return(0); } /* Initialize process */ static int filed_init(unsigned int cache_size) { static int called = 0; struct sigaction signal_handler_info; sigset_t signal_handler_mask; ssize_t read_ret = 0; unsigned int random_value = 0; int cache_ret; int random_fd; if (called) { return(0); } called = 1; /* Attempt to lock all memory to physical RAM (but don't care if we can't) */ mlockall(MCL_CURRENT | MCL_FUTURE); /* Establish signal handlers */ |
︙ | |||
603 604 605 606 607 608 609 | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | - + | #define filed_sockettimeout_close(x) /**/ #else time_t filed_sockettimeout_time; struct { time_t expiration_time; pthread_t thread_id; int valid; |
︙ | |||
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | + + + - + | atomic_store(&filed_sockettimeout_sockstatus[sockfd].valid, false); return; } static void *filed_sockettimeout_thread(void *arg) { struct timespec sleep_time; time_t now, expiration_time; pthread_t thread_id; long idx; int count; int valid; while (1) { for (count = 0; count < 10; count++) { sleep_time.tv_sec = 30; sleep_time.tv_nsec = 0; |
︙ | |||
736 737 738 739 740 741 742 | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | + - + - | long maxfd, idx; maxfd = sysconf(_SC_OPEN_MAX); if (maxfd <= 0) { maxfd = 4096; } filed_sockettimeout_sockstatus_length = maxfd; |
︙ | |||
1167 1168 1169 1170 1171 1172 1173 1174 | 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 | + - + | fclose(fp); return; } /* Return a redirect to index.html */ #ifndef FILED_DONT_REDIRECT_DIRECTORIES static void filed_redirect_index(FILE *fp, const char *date_current, const char *path, struct filed_log_entry *log) { |
︙ | |||
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | + | fclose(fp); return; /* Currently unused: path */ path = path; } #endif /* Convert an enum representing the "Connection" header value to a string */ static const char *filed_connection_str(int connection_value) { switch (connection_value) { case FILED_CONNECTION_CLOSE: return("close"); case FILED_CONNECTION_KEEP_ALIVE: |
︙ | |||
1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 | + + + + + + + + + + + + + + + | path = request->path; strcpy(log->buffer, path); log->method = request->method; /* If the requested path is a directory, redirect to index page */ if (request->type == FILED_REQUEST_TYPE_DIRECTORY) { #ifdef FILED_DONT_REDIRECT_DIRECTORIES char localpath[8192]; int snprintf_ret; snprintf_ret = snprintf(localpath, sizeof(localpath), "%s/index.html", path); if (snprintf_ret <= 0 || snprintf_ret > (sizeof(localpath) - 1)) { filed_error_page(fp, date_current, 500, request->method, "path_format", log); return(FILED_CONNECTION_CLOSE); } path = localpath; #else filed_redirect_index(fp, date_current, path, log); return(FILED_CONNECTION_CLOSE); #endif } fileinfo = filed_open_file(path, &request->fileinfo, options); if (fileinfo == NULL) { filed_error_page(fp, date_current, 404, request->method, "open_failed", log); return(FILED_CONNECTION_CLOSE); |
︙ | |||
1874 1875 1876 1877 1878 1879 1880 | 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 | - + | return(5); } /* Wait for threads to exit */ /* XXX:TODO: Monitor thread usage */ while (1) { |