diff options
| author | 2023-07-02 11:11:01 +0200 | |
|---|---|---|
| committer | 2023-07-02 11:11:01 +0200 | |
| commit | d343b40ee553de8d98c18d3547e6c9b12ab96b48 (patch) | |
| tree | 2f2d9ab495d2ad4e8187f31530d8019968b905bf /httpd.c | |
| parent | Fixed footer link. (diff) | |
| download | penes-snac2-d343b40ee553de8d98c18d3547e6c9b12ab96b48.tar.gz penes-snac2-d343b40ee553de8d98c18d3547e6c9b12ab96b48.tar.xz penes-snac2-d343b40ee553de8d98c18d3547e6c9b12ab96b48.zip | |
Added HTTP caching to static data.
Diffstat (limited to 'httpd.c')
| -rw-r--r-- | httpd.c | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -156,6 +156,7 @@ void httpd_connection(FILE *f) | |||
| 156 | xs *headers = NULL; | 156 | xs *headers = NULL; |
| 157 | xs *q_path = NULL; | 157 | xs *q_path = NULL; |
| 158 | xs *payload = NULL; | 158 | xs *payload = NULL; |
| 159 | xs *etag = NULL; | ||
| 159 | int p_size = 0; | 160 | int p_size = 0; |
| 160 | char *p; | 161 | char *p; |
| 161 | 162 | ||
| @@ -198,7 +199,7 @@ void httpd_connection(FILE *f) | |||
| 198 | #endif /* NO_MASTODON_API */ | 199 | #endif /* NO_MASTODON_API */ |
| 199 | 200 | ||
| 200 | if (status == 0) | 201 | if (status == 0) |
| 201 | status = html_get_handler(req, q_path, &body, &b_size, &ctype); | 202 | status = html_get_handler(req, q_path, &body, &b_size, &ctype, &etag); |
| 202 | } | 203 | } |
| 203 | else | 204 | else |
| 204 | if (strcmp(method, "POST") == 0) { | 205 | if (strcmp(method, "POST") == 0) { |
| @@ -263,6 +264,9 @@ void httpd_connection(FILE *f) | |||
| 263 | headers = xs_dict_append(headers, "content-type", ctype); | 264 | headers = xs_dict_append(headers, "content-type", ctype); |
| 264 | headers = xs_dict_append(headers, "x-creator", USER_AGENT); | 265 | headers = xs_dict_append(headers, "x-creator", USER_AGENT); |
| 265 | 266 | ||
| 267 | if (!xs_is_null(etag)) | ||
| 268 | headers = xs_dict_append(headers, "etag", etag); | ||
| 269 | |||
| 266 | if (b_size == 0 && body != NULL) | 270 | if (b_size == 0 && body != NULL) |
| 267 | b_size = strlen(body); | 271 | b_size = strlen(body); |
| 268 | 272 | ||