Browse Source

final fix for testcase and #177

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@378 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.3.14
Jan Kneschke 17 years ago
parent
commit
7bca57bb6b
  1. 8
      src/etag.c
  2. 10
      tests/core-response.t

8
src/etag.c

@ -9,13 +9,11 @@ int etag_is_equal(buffer *etag, const char *matches) {
}
int etag_create(buffer *etag, struct stat *st) {
buffer_copy_string_len(etag, CONST_STR_LEN("\""));
buffer_append_off_t(etag, st->st_ino);
buffer_copy_off_t(etag, st->st_ino);
buffer_append_string_len(etag, CONST_STR_LEN("-"));
buffer_append_off_t(etag, st->st_size);
buffer_append_string_len(etag, CONST_STR_LEN("-"));
buffer_append_long(etag, st->st_mtime);
buffer_append_string_len(etag, CONST_STR_LEN("\""));
return 0;
}
@ -26,7 +24,9 @@ int etag_mutate(buffer *mut, buffer *etag) {
for (h=0, i=0; i < etag->used; ++i) h = (h<<5)^(h>>27)^(etag->ptr[i]);
buffer_reset(mut);
buffer_copy_long(mut, h);
buffer_copy_string_len(mut, CONST_STR_LEN("\""));
buffer_append_long(mut, h);
buffer_append_string_len(mut, CONST_STR_LEN("\""));
return 0;
}

10
tests/core-response.t

@ -173,10 +173,12 @@ sub handle_http {
}
if ($no_val == 0) {
if ($href->{$_} =~ /^\/(.+)\/$/ && $resp_hdr{$k} !~ /$1/) {
diag(sprintf("response-header failed: expected '%s', got '%s', regex: %s\n",
$href->{$_}, $resp_hdr{$k}, $1));
return -1;
if ($href->{$_} =~ /^\/(.+)\/$/) {
if ($resp_hdr{$k} !~ /$1/) {
diag(sprintf("response-header failed: expected '%s', got '%s', regex: %s\n",
$href->{$_}, $resp_hdr{$k}, $1));
return -1;
}
} elsif ($href->{$_} ne $resp_hdr{$k}) {
diag(sprintf("response-header failed: expected '%s', got '%s'\n",
$href->{$_}, $resp_hdr{$k}));

Loading…
Cancel
Save