Overview
Comment: | Updated to support HTTP Connection Keep-Alive |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b4fa45b6aa3bc1a7390f3ae961a921ed |
User & Date: | rkeene on 2014-10-13 08:04:09 |
Other Links: | manifest | tags |
References
2014-10-13
| ||
14:59 | Fixed file descriptor leaking introduced in [b4fa45b6aa] and made connection re-use more clean check-in: 679bcc1373 user: rkeene tags: trunk | |
Context
2014-10-13
| ||
08:12 | Filed 1.10 check-in: dd8a7297f3 user: rkeene tags: trunk, 1.10 | |
08:04 | Updated to support HTTP Connection Keep-Alive check-in: b4fa45b6aa user: rkeene tags: trunk | |
2014-08-31
| ||
18:07 | Updated to use a fallback mime.types file if specified one is unavailable check-in: 862bf6f56b user: rkeene tags: trunk | |
Changes
Modified filed.c from [9ca8af3757] to [d1e3cfdb7f].
︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | + + + + + | off_t length; /*** Range length ***/ } range; struct { int present; char host[FILED_PATH_BUFFER_SIZE]; } host; enum { FILED_CONNECTION_CLOSE, FILED_CONNECTION_KEEP_ALIVE } connection; } headers; }; /* Log record */ struct filed_log_entry { /* Type of log entry */ enum { |
︙ | |||
685 686 687 688 689 690 691 692 693 694 695 696 697 698 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | + | /* Set to default values */ range_start = 0; range_end = 0; range_request = 0; range_length = -1; buffer_st->headers.host.present = 0; buffer_st->headers.connection = FILED_CONNECTION_CLOSE; buffer = buffer_st->tmpbuf; buffer_len = sizeof(buffer_st->tmpbuf); fgets_ret = fgets(buffer, buffer_len, fp); if (fgets_ret == NULL) { return(NULL); |
︙ | |||
784 785 786 787 788 789 790 791 792 793 794 795 796 797 | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | + + | workbuffer = buffer + 5; while (*workbuffer == ' ') { workbuffer++; } strcpy(buffer_st->headers.host.host, workbuffer); } else if (strncasecmp(buffer, "Connection: Keep-Alive", 22) == 0) { buffer_st->headers.connection = FILED_CONNECTION_KEEP_ALIVE; } if (memcmp(buffer, "\r\n", 2) == 0) { break; } } |
︙ | |||
887 888 889 890 891 892 893 894 895 | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | + + + + + + + + + + + + - + | fclose(fp); return; /* Currently unused: path */ path = path; } /* 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: return("keep-alive"); } return("close"); } /* Handle a single request from a client */ |
︙ | |||
913 914 915 916 917 918 919 | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | - + - + - + - + - + | log->buffer[0] = '\0'; log->http_code = -1; log->reason = "fdopen_failed"; filed_log_entry(log); |
︙ | |||
979 980 981 982 983 984 985 | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | - + + | http_code = 200; /* Compute fake range parameters that includes the entire file */ request->headers.range.offset = 0; request->headers.range.length = fileinfo->len; } |
︙ | |||
1075 1076 1077 1078 1079 1080 1081 | 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | + - + - + - + + + + + - + | } log->endtime = (time_t) -1; log->sent_length = sendfile_sent; filed_log_entry(log); if (request->headers.connection != FILED_CONNECTION_KEEP_ALIVE) { |
︙ | |||
1116 1117 1118 1119 1120 1121 1122 | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 | + - - + + + | break; } log->type = FILED_LOG_TYPE_TRANSFER; /* Accept a new client */ if (accept_new) { |
︙ | |||
1146 1147 1148 1149 1150 1151 1152 | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | - + | log->port = addr.sin6_port; } /* Reset failure count*/ failure_count = 0; /* Handle socket */ |
︙ |