[multiple] remove r->physical.etag

(no longer used; was used as temporary buffer)
master
Glenn Strauss 1 year ago
parent df070173af
commit 96fd7e5d04

@ -285,7 +285,6 @@ void http_response_reset (request_st * const r) {
if (r->physical.path.ptr) { /*(skip for mod_fastcgi authorizer)*/
buffer_clear(&r->physical.doc_root);
buffer_clear(&r->physical.basedir);
buffer_clear(&r->physical.etag);
buffer_reset(&r->physical.path);
buffer_reset(&r->physical.rel_path);
}

@ -1861,7 +1861,6 @@ REQUEST_FUNC(mod_deflate_handle_response_start) {
vb->ptr[etaglen-1] = '-'; /*(overwrite end '"')*/
buffer_append_string(vb, label);
buffer_append_string_len(vb, CONST_STR_LEN("\""));
/*buffer_copy_buffer(&r->physical.etag, vb);*//*(keep in sync?)*/
r->http_status = 304;
} else {
r->http_status = 412;
@ -1891,7 +1890,6 @@ REQUEST_FUNC(mod_deflate_handle_response_start) {
vb->ptr[etaglen-1] = '-'; /*(overwrite end '"')*/
buffer_append_string(vb, label);
buffer_append_string_len(vb, CONST_STR_LEN("\""));
/*buffer_copy_buffer(&r->physical.etag, vb);*//*(keep in sync?)*/
}
/* set Content-Encoding to show selected compression type */

@ -1601,8 +1601,8 @@ static int mod_ssi_handle_request(request_st * const r, handler_ctx * const p) {
if (TIME64_CAST(st.st_mtime) < include_file_last_mtime)
st.st_mtime = include_file_last_mtime;
http_etag_create(&r->physical.etag, &st, r->conf.etag_flags);
http_header_response_set(r, HTTP_HEADER_ETAG, CONST_STR_LEN("ETag"), BUF_PTR_LEN(&r->physical.etag));
http_etag_create(r->tmp_buf, &st, r->conf.etag_flags);
http_header_response_set(r, HTTP_HEADER_ETAG, CONST_STR_LEN("ETag"), BUF_PTR_LEN(r->tmp_buf));
const buffer * const mtime = http_response_set_last_modified(r, st.st_mtime);
if (HANDLER_FINISHED == http_response_handle_cachable(r, mtime, st.st_mtime)) {

@ -2256,7 +2256,8 @@ webdav_if_match_or_unmodified_since (request_st * const r, struct stat *st)
if (NULL == st)
st = (0 == lstat(r->physical.path.ptr, &stp)) ? &stp : NULL;
buffer *etagb = &r->physical.etag;
buffer * const etagb = r->tmp_buf;
buffer_clear(etagb);
if (NULL != st && (NULL != im || NULL != inm)) {
http_etag_create(etagb, st, r->conf.etag_flags);
}
@ -2288,17 +2289,13 @@ webdav_if_match_or_unmodified_since (request_st * const r, struct stat *st)
static void
webdav_response_etag (request_st * const r, struct stat *st)
{
buffer *etagb = NULL;
if (0 != r->conf.etag_flags) {
buffer *etagb = &r->physical.etag;
etagb = http_header_response_set_ptr(r, HTTP_HEADER_ETAG,
CONST_STR_LEN("ETag"));
http_etag_create(etagb, st, r->conf.etag_flags);
stat_cache_update_entry(BUF_PTR_LEN(&r->physical.path), st, etagb);
http_header_response_set(r, HTTP_HEADER_ETAG,
CONST_STR_LEN("ETag"),
BUF_PTR_LEN(etagb));
}
else {
stat_cache_update_entry(BUF_PTR_LEN(&r->physical.path), st, NULL);
}
stat_cache_update_entry(BUF_PTR_LEN(&r->physical.path), st, etagb);
}
@ -3217,7 +3214,7 @@ webdav_propfind_live_props (const webdav_propfind_bufs * const restrict pb,
__attribute_fallthrough__
case WEBDAV_PROP_GETETAG:
if (0 != pb->r->conf.etag_flags) {
buffer *etagb = &pb->r->physical.etag;
buffer * const etagb = pb->r->tmp_buf;
http_etag_create(etagb, &pb->st, pb->r->conf.etag_flags);
buffer_append_str3(b,
CONST_STR_LEN(
@ -3225,7 +3222,6 @@ webdav_propfind_live_props (const webdav_propfind_bufs * const restrict pb,
BUF_PTR_LEN(etagb),
CONST_STR_LEN(
"</D:getetag>"));
buffer_clear(etagb);
}
else if (pnum != WEBDAV_PROP_ALL)
return -1; /* invalid; report 'not found' */
@ -3828,7 +3824,7 @@ webdav_has_lock (request_st * const r,
return 0;
}
if (S_ISDIR(st.st_mode)) continue;/*we ignore etag if dir*/
buffer *etagb = &r->physical.etag;
buffer * const etagb = r->tmp_buf;
http_etag_create(etagb, &st, r->conf.etag_flags);
*p = '\0';
int ematch = http_etag_matches(etagb, etag, 0);

@ -223,7 +223,6 @@ request_free_data (request_st * const r)
free(r->physical.doc_root.ptr);
free(r->physical.path.ptr);
free(r->physical.basedir.ptr);
free(r->physical.etag.ptr);
free(r->physical.rel_path.ptr);
free(r->pathinfo.ptr);

@ -94,8 +94,6 @@ typedef struct {
buffer doc_root; /* path = doc_root + rel_path */
buffer rel_path;
buffer etag;
} physical;
typedef struct {

@ -163,7 +163,6 @@ void test_mod_ssi (void)
chunkqueue_reset(&r.write_queue);
free(r.uri.path.ptr);
free(r.physical.etag.ptr);
free(r.physical.path.ptr);
free(r.physical.rel_path.ptr);
free(r.physical.doc_root.ptr);

@ -19,7 +19,6 @@ static void test_mod_staticfile_reset (request_st * const r)
r->resp_htags = 0;
array_reset_data_strings(&r->resp_headers);
http_response_body_clear(r, 0);
buffer_clear(&r->physical.etag);
r->conf.etag_flags = ETAG_USE_INODE | ETAG_USE_MTIME | ETAG_USE_SIZE;
}
@ -424,7 +423,6 @@ void test_mod_staticfile (void)
chunkqueue_reset(&r.write_queue);
free(r.uri.path.ptr);
free(r.physical.etag.ptr);
free(r.physical.path.ptr);
free(r.physical.rel_path.ptr);
free(r.physical.doc_root.ptr);

Loading…
Cancel
Save