<div dir="ltr"><div class="gmail_extra">I hope slice module can satisfy customer requirements.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Now the key point is users want to control the behavior of slice.</div><div class="gmail_extra">And this is common.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Here's the patch, take a look please!</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">diff -r 5e05118678af src/http/modules/ngx_http_slice_filter_module.c</div><div class="gmail_extra">--- a/src/http/modules/ngx_http_slice_filter_module.c<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>Mon May 29 23:33:38 2017 +0300</div><div class="gmail_extra">+++ b/src/http/modules/ngx_http_slice_filter_module.c<span class="gmail-Apple-tab-span" style="white-space:pre">      </span>Tue Jun 20 13:17:17 2017 -0400</div><div class="gmail_extra">@@ -12,6 +12,7 @@</div><div class="gmail_extra"><br></div><div class="gmail_extra"> typedef struct {</div><div class="gmail_extra">     size_t               size;</div><div class="gmail_extra">+    ngx_flag_t           always;</div><div class="gmail_extra"> } ngx_http_slice_loc_conf_t;</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">@@ -57,6 +58,13 @@</div><div class="gmail_extra">       offsetof(ngx_http_slice_loc_conf_t, size),</div><div class="gmail_extra">       NULL },</div><div class="gmail_extra"><br></div><div class="gmail_extra">+    { ngx_string("slice_always"),</div><div class="gmail_extra">+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,</div><div class="gmail_extra">+      ngx_conf_set_flag_slot,</div><div class="gmail_extra">+      NGX_HTTP_LOC_CONF_OFFSET,</div><div class="gmail_extra">+      offsetof(ngx_http_slice_loc_conf_t, always),</div><div class="gmail_extra">+      NULL },</div><div class="gmail_extra">+</div><div class="gmail_extra">       ngx_null_command</div><div class="gmail_extra"> };</div><div class="gmail_extra"><br></div><div class="gmail_extra">@@ -389,6 +397,7 @@</div><div class="gmail_extra">     ngx_http_variable_value_t *v, uintptr_t data)</div><div class="gmail_extra"> {</div><div class="gmail_extra">     u_char                     *p;</div><div class="gmail_extra">+    off_t                      start;</div><div class="gmail_extra">     ngx_http_slice_ctx_t       *ctx;</div><div class="gmail_extra">     ngx_http_slice_loc_conf_t  *slcf;</div><div class="gmail_extra"><br></div><div class="gmail_extra">@@ -407,6 +416,12 @@</div><div class="gmail_extra">             return NGX_OK;</div><div class="gmail_extra">         }</div><div class="gmail_extra"><br></div><div class="gmail_extra">+        start = ngx_http_slice_get_start(r);</div><div class="gmail_extra">+        if (start == -1 && slcf->always == 0) {</div><div class="gmail_extra">+            v->not_found = 1;</div><div class="gmail_extra">+            return NGX_OK;</div><div class="gmail_extra">+        }</div><div class="gmail_extra">+</div><div class="gmail_extra">         ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_slice_ctx_t));</div><div class="gmail_extra">         if (ctx == NULL) {</div><div class="gmail_extra">             return NGX_ERROR;</div><div class="gmail_extra">@@ -419,7 +434,7 @@</div><div class="gmail_extra">             return NGX_ERROR;</div><div class="gmail_extra">         }</div><div class="gmail_extra"><br></div><div class="gmail_extra">-        ctx->start = slcf->size * (ngx_http_slice_get_start(r) / slcf->size);</div><div class="gmail_extra">+        ctx->start = slcf->size * (start / slcf->size);</div><div class="gmail_extra"><br></div><div class="gmail_extra">         ctx->range.data = p;</div><div class="gmail_extra">         ctx->range.len = ngx_sprintf(p, "bytes=%O-%O", ctx->start,</div><div class="gmail_extra">@@ -445,7 +460,7 @@</div><div class="gmail_extra">     ngx_table_elt_t  *h;</div><div class="gmail_extra"><br></div><div class="gmail_extra">     if (r->headers_in.if_range) {</div><div class="gmail_extra">-        return 0;</div><div class="gmail_extra">+        return -1;</div><div class="gmail_extra">     }</div><div class="gmail_extra"><br></div><div class="gmail_extra">     h = r->headers_in.range;</div><div class="gmail_extra">@@ -454,13 +469,13 @@</div><div class="gmail_extra">         || h->value.len < 7</div><div class="gmail_extra">         || ngx_strncasecmp(h->value.data, (u_char *) "bytes=", 6) != 0)</div><div class="gmail_extra">     {</div><div class="gmail_extra">-        return 0;</div><div class="gmail_extra">+        return -1;</div><div class="gmail_extra">     }</div><div class="gmail_extra"><br></div><div class="gmail_extra">     p = h->value.data + 6;</div><div class="gmail_extra"><br></div><div class="gmail_extra">     if (ngx_strchr(p, ',')) {</div><div class="gmail_extra">-        return 0;</div><div class="gmail_extra">+        return -1;</div><div class="gmail_extra">     }</div><div class="gmail_extra"><br></div><div class="gmail_extra">     while (*p == ' ') { p++; }</div><div class="gmail_extra">@@ -476,7 +491,7 @@</div><div class="gmail_extra"><br></div><div class="gmail_extra">     while (*p >= '0' && *p <= '9') {</div><div class="gmail_extra">         if (start >= cutoff && (start > cutoff || *p - '0' > cutlim)) {</div><div class="gmail_extra">-            return 0;</div><div class="gmail_extra">+            return -1;</div><div class="gmail_extra">         }</div><div class="gmail_extra"><br></div><div class="gmail_extra">         start = start * 10 + *p++ - '0';</div><div class="gmail_extra">@@ -497,6 +512,7 @@</div><div class="gmail_extra">     }</div><div class="gmail_extra"><br></div><div class="gmail_extra">     slcf->size = NGX_CONF_UNSET_SIZE;</div><div class="gmail_extra">+    slcf->always = NGX_CONF_UNSET;</div><div class="gmail_extra"><br></div><div class="gmail_extra">     return slcf;</div><div class="gmail_extra"> }</div><div class="gmail_extra">@@ -509,6 +525,7 @@</div><div class="gmail_extra">     ngx_http_slice_loc_conf_t *conf = child;</div><div class="gmail_extra"><br></div><div class="gmail_extra">     ngx_conf_merge_size_value(conf->size, prev->size, 0);</div><div class="gmail_extra">+    ngx_conf_merge_value(conf->always, prev->always, 1);</div><div class="gmail_extra"><br></div><div class="gmail_extra">     return NGX_CONF_OK;</div><div class="gmail_extra"> }</div></div></div>