Browse Source

only set the etag if we have one

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1380 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.13
Jan Kneschke 16 years ago
parent
commit
e49da67a47
  1. 17
      src/mod_magnet.c

17
src/mod_magnet.c

@ -177,7 +177,7 @@ static int magnet_stat(lua_State *L) {
const char *s = luaL_checkstring(L, 1);
server *srv;
connection *con;
buffer sb, *b;
buffer sb;
stat_cache_entry *sce = NULL;
lua_pushstring(L, "lighty.srv");
@ -243,16 +243,19 @@ static int magnet_stat(lua_State *L) {
lua_pushinteger(L, sce->st.st_ino);
lua_setfield(L, -2, "st_ino");
/* we have to mutate the etag */
b = buffer_init();
etag_mutate(b, sce->etag);
if (!buffer_is_empty(sce->etag)) {
/* we have to mutate the etag */
buffer *b = buffer_init();
etag_mutate(b, sce->etag);
lua_pushlstring(L, b->ptr, b->used - 1);
lua_pushlstring(L, b->ptr, b->used - 1);
buffer_free(b);
} else {
lua_pushnil(L);
}
lua_setfield(L, -2, "etag");
buffer_free(b);
if (!buffer_is_empty(sce->content_type)) {
lua_pushlstring(L, sce->content_type->ptr, sce->content_type->used - 1);
} else {

Loading…
Cancel
Save