| 1966 | }; |
| 1967 | |
| 1968 | static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, |
| 1969 | int propid, dav_prop_insert what, |
| 1970 | apr_text_header *phdr) |
| 1971 | { |
| 1972 | const char *value; |
| 1973 | const char *s; |
| 1974 | apr_pool_t *p = resource->info->pool; |
| 1975 | const dav_liveprop_spec *info; |
| 1976 | long global_ns; |
| 1977 | |
| 1978 | /* an HTTP-date can be 29 chars plus a null term */ |
| 1979 | /* a 64-bit size can be 20 chars plus a null term */ |
| 1980 | char buf[DAV_TIMEBUF_SIZE]; |
| 1981 | |
| 1982 | /* |
| 1983 | ** None of FS provider properties are defined if the resource does not |
| 1984 | ** exist. Just bail for this case. |
| 1985 | ** |
| 1986 | ** Even though we state that the FS properties are not defined, the |
| 1987 | ** client cannot store dead values -- we deny that thru the is_writable |
| 1988 | ** hook function. |
| 1989 | */ |
| 1990 | if (!resource->exists) |
| 1991 | return DAV_PROP_INSERT_NOTDEF; |
| 1992 | |
| 1993 | switch (propid) { |
| 1994 | case DAV_PROPID_creationdate: |
| 1995 | /* |
| 1996 | ** Closest thing to a creation date. since we don't actually |
| 1997 | ** perform the operations that would modify ctime (after we |
| 1998 | ** create the file), then we should be pretty safe here. |
| 1999 | */ |
| 2000 | dav_format_time(DAV_STYLE_ISO8601, |
| 2001 | resource->info->finfo.ctime, |
| 2002 | buf, sizeof(buf)); |
| 2003 | value = buf; |
| 2004 | break; |
| 2005 | |
| 2006 | case DAV_PROPID_getcontentlength: |
| 2007 | /* our property, but not defined on collection resources */ |
| 2008 | if (resource->collection) |
| 2009 | return DAV_PROP_INSERT_NOTDEF; |
| 2010 | |
| 2011 | apr_snprintf(buf, sizeof(buf), "%" APR_OFF_T_FMT, resource->info->finfo.size); |
| 2012 | value = buf; |
| 2013 | break; |
| 2014 | |
| 2015 | case DAV_PROPID_getetag: |
| 2016 | value = dav_fs_getetag(resource); |
| 2017 | break; |
| 2018 | |
| 2019 | case DAV_PROPID_getlastmodified: |
| 2020 | dav_format_time(DAV_STYLE_RFC822, |
| 2021 | resource->info->finfo.mtime, |
| 2022 | buf, sizeof(buf)); |
| 2023 | value = buf; |
| 2024 | break; |
| 2025 |
no test coverage detected