- 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
parent
3bfd1094a5
commit
05be79d572
12
inliner.c
12
inliner.c
|
@ -13,6 +13,7 @@
|
|||
ngx_buf_t* nfi_inline_getbuf(ngx_http_request_t *r,
|
||||
const ngx_str_t const * path, ngx_int_t mode)
|
||||
{
|
||||
size_t root_len;
|
||||
ngx_str_t resolved;
|
||||
ngx_buf_t *buf;
|
||||
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,
|
||||
"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_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);
|
||||
|
||||
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.
|
||||
|
@ -46,7 +42,7 @@ ngx_buf_t* nfi_inline_getbuf(ngx_http_request_t *r,
|
|||
|
||||
if (ngx_file_info(resolved.data, &bfileinfo) != 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
|
|||
if (readme_path.len == 0) goto skip_readme_len;
|
||||
|
||||
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=\"")
|
||||
+ r->uri.len + alcf->readme.len
|
||||
+ nfi_sizeof_ssz("\">(readme file)</iframe>")
|
||||
|
@ -479,7 +479,6 @@ skip_readme_len:
|
|||
do { \
|
||||
b->last = nfi_cpymem_ssz(b->last, "<iframe id=\"readme\" src=\""); \
|
||||
b->last = nfi_cpymem_str(b->last, r->uri); \
|
||||
*b->last++ = '/'; \
|
||||
b->last = nfi_cpymem_str(b->last, alcf->readme); \
|
||||
b->last = nfi_cpymem_ssz(b->last, "\">(readme file)</iframe>"); \
|
||||
*b->last++ = CR; \
|
||||
|
|
Loading…
Reference in New Issue