- Removed uneeded extra slash in generated src attribute of <iframe>.

- Mapping of URIs to proper header/footer files is done properly now for
  relative paths. Buffer object is returned, but not used yet.
pull/4/head
Adrian Perez 2007-09-06 17:51:44 +02:00
parent 3bfd1094a5
commit 05be79d572
2 changed files with 5 additions and 10 deletions

View File

@ -13,6 +13,7 @@
ngx_buf_t* nfi_inline_getbuf(ngx_http_request_t *r, ngx_buf_t* nfi_inline_getbuf(ngx_http_request_t *r,
const ngx_str_t const * path, ngx_int_t mode) const ngx_str_t const * path, ngx_int_t mode)
{ {
size_t root_len;
ngx_str_t resolved; ngx_str_t resolved;
ngx_buf_t *buf; ngx_buf_t *buf;
ngx_file_t *bfile; ngx_file_t *bfile;
@ -21,17 +22,12 @@ ngx_buf_t* nfi_inline_getbuf(ngx_http_request_t *r,
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http nfi_inline_getbuf path: \"%V\"", path); "http nfi_inline_getbuf path: \"%V\"", path);
resolved.len = r->uri.len + path->len;
resolved.data = ngx_palloc(r->pool, resolved.len + 1);
if (resolved.data == NULL)
return NULL;
ngx_memcpy( ngx_memcpy(
ngx_cpymem(resolved.data, r->uri.data, r->uri.len), ngx_http_map_uri_to_path(r, &resolved, &root_len, path->len),
path->data, path->len); path->data, path->len);
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http nfi_inline_getbuf resolved: \"%V\"", &resolved); "nfi_inline_getbuf resolved: \"%V\"", &resolved);
/* /*
* Append final '\0' so we can use it to call ngx_file_info() below. * Append final '\0' so we can use it to call ngx_file_info() below.
@ -46,7 +42,7 @@ ngx_buf_t* nfi_inline_getbuf(ngx_http_request_t *r,
if (ngx_file_info(resolved.data, &bfileinfo) != 0) { if (ngx_file_info(resolved.data, &bfileinfo) != 0) {
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, ngx_errno, ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, ngx_errno,
"http nfi_inline_getbuf no file stats"); "nfi_inline_getbuf no file stats");
return NULL; return NULL;
} }

View File

@ -412,7 +412,7 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
if (readme_path.len == 0) goto skip_readme_len; if (readme_path.len == 0) goto skip_readme_len;
if (nfi_has_flag(alcf->readme_flags, NGX_HTTP_FANCYINDEX_README_IFRAME)) { if (nfi_has_flag(alcf->readme_flags, NGX_HTTP_FANCYINDEX_README_IFRAME)) {
len += 3 /* CR+LF+'/' */ len += 2 /* CR+LF */
+ nfi_sizeof_ssz("<iframe id=\"readme\" src=\"") + nfi_sizeof_ssz("<iframe id=\"readme\" src=\"")
+ r->uri.len + alcf->readme.len + r->uri.len + alcf->readme.len
+ nfi_sizeof_ssz("\">(readme file)</iframe>") + nfi_sizeof_ssz("\">(readme file)</iframe>")
@ -479,7 +479,6 @@ skip_readme_len:
do { \ do { \
b->last = nfi_cpymem_ssz(b->last, "<iframe id=\"readme\" src=\""); \ b->last = nfi_cpymem_ssz(b->last, "<iframe id=\"readme\" src=\""); \
b->last = nfi_cpymem_str(b->last, r->uri); \ b->last = nfi_cpymem_str(b->last, r->uri); \
*b->last++ = '/'; \
b->last = nfi_cpymem_str(b->last, alcf->readme); \ b->last = nfi_cpymem_str(b->last, alcf->readme); \
b->last = nfi_cpymem_ssz(b->last, "\">(readme file)</iframe>"); \ b->last = nfi_cpymem_ssz(b->last, "\">(readme file)</iframe>"); \
*b->last++ = CR; \ *b->last++ = CR; \