diff options
author | Arno Töll <arno@debian.org> | 2012-11-21 23:03:51 +0100 |
---|---|---|
committer | Arno Töll <arno@debian.org> | 2012-11-21 23:03:51 +0100 |
commit | f1532bfdd56dc641ae366f6ecd4c490c11117aac (patch) | |
tree | e58012163da210efa84fdbdcefd069ee511fd3e4 /src/mod_staticfile.c | |
parent | 3f9e670856f606be4d9899e2d2a9ed4708575f10 (diff) | |
download | lighttpd-f1532bfdd56dc641ae366f6ecd4c490c11117aac.tar.gz |
Imported Upstream version 1.4.19upstream/1.4.19
Diffstat (limited to 'src/mod_staticfile.c')
-rw-r--r-- | src/mod_staticfile.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c index 59fafee..0ffa901 100644 --- a/src/mod_staticfile.c +++ b/src/mod_staticfile.c @@ -352,7 +352,7 @@ URIHANDLER_FUNC(mod_staticfile_subrequest) { size_t k; int s_len; stat_cache_entry *sce = NULL; - buffer *mtime; + buffer *mtime = NULL; data_string *ds; int allow_caching = 1; @@ -450,7 +450,9 @@ URIHANDLER_FUNC(mod_staticfile_subrequest) { } } - response_header_overwrite(srv, con, CONST_STR_LEN("Accept-Ranges"), CONST_STR_LEN("bytes")); + if (con->conf.range_requests) { + response_header_overwrite(srv, con, CONST_STR_LEN("Accept-Ranges"), CONST_STR_LEN("bytes")); + } if (allow_caching) { if (p->conf.etags_used && con->etag_flags != 0 && !buffer_is_empty(sce->etag)) { @@ -483,7 +485,23 @@ URIHANDLER_FUNC(mod_staticfile_subrequest) { /* if the value is the same as our ETag, we do a Range-request, * otherwise a full 200 */ - if (!buffer_is_equal(ds->value, con->physical.etag)) { + if (ds->value->ptr[0] == '"') { + /** + * client wants a ETag + */ + if (!con->physical.etag) { + do_range_request = 0; + } else if (!buffer_is_equal(ds->value, con->physical.etag)) { + do_range_request = 0; + } + } else if (!mtime) { + /** + * we don't have a Last-Modified and can match the If-Range: + * + * sending all + */ + do_range_request = 0; + } else if (!buffer_is_equal(ds->value, mtime)) { do_range_request = 0; } } |