# Gunzip module and buffer managment

**URL:** <https://www.ruby-forum.com/t/gunzip-module-and-buffer-managment/235213>\
**Category:** NGINX\
**Created:** [June 6, 2013, 11:58pm UTC](https://www.ruby-forum.com/t/gunzip-module-and-buffer-managment/235213 "2013-06-06T23:58:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [June 6, 2013, 11:58pm UTC](https://www.ruby-forum.com/t/gunzip-module-and-buffer-managment/235213/1 "2013-06-06T23:58:34Z")

</div>

I’m trying to use the http\_gunzip module as an example for a filter I  
am  
trying to write. I’m particularly interested in the buffer management.

The module has a value in its ctx stuct called last\_buf

…  
ngx\_chain\_t \*\*last\_out;  
…

last\_out is set in various places throughout the code. Sometimes to  
other  
chains in the ctx, sometimes to newly allocated chains.

But as far as I can tell, none of the code ever uses the value stored in  
last\_out. (It seems to be a write-only variable 🙂

Anybody know what I’m missing?

Posted at Nginx Forum:

> **[gunzip module and buffer managment](https://forum.nginx.org/read.php?2,239934,239934#msg-239934)**
>
> I'm trying to use the http\_gunzip module as an example for a filter I am trying to write. I'm particularly interested in the buffer management. The module has a value in its ctx stuct called last\_buf ... ngx\_chain\_t \*\*last\_out; ... last\_o

---

<div class="post-metadata">

**Author:** ![kpstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9e8a1a/32.png) [@kpstein](https://www.ruby-forum.com/u/kpstein)\
**Post date:** [June 7, 2013, 12:34am UTC](https://www.ruby-forum.com/t/gunzip-module-and-buffer-managment/235213/2 "2013-06-07T00:34:13Z")

</div>

On Friday 07 June 2013 01:57:54 kpstein wrote:

> chains in the ctx, sometimes to newly allocated chains.
> 
> But as far as I can tell, none of the code ever uses the value stored in  
> last\_out. (It seems to be a write-only variable 🙂
> 
> Anybody know what I’m missing?

% grep ‘\*ctx-\>last\_out’ -n  
src/http/modules/ngx\_http\_gunzip\_filter\_module.c  
461: \*ctx-\>last\_out = cl;  
497: \*ctx-\>last\_out = cl;  
546: \*ctx-\>last\_out = cl;  
592: \*ctx-\>last\_out = cl;

wbr, Valentin V. Bartenev

–

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![kpstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9e8a1a/32.png) [@kpstein](https://www.ruby-forum.com/u/kpstein)\
**Post date:** [June 7, 2013, 4:09am UTC](https://www.ruby-forum.com/t/gunzip-module-and-buffer-managment/235213/3 "2013-06-07T04:09:06Z")

</div>

second rank pointer.

---- ctx-\>last\_out Matches (10 in 1 files) ----  
Ngx\_http\_gunzip\_filter\_module.c (add-on): ctx-\>last\_out =  
&ctx-\>out;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): ctx-\>last\_out = &ctx-\>out;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): \*ctx-\>last\_out = cl;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): ctx-\>last\_out =  
&cl-\>next;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): \*ctx-\>last\_out = cl;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): ctx-\>last\_out =  
&cl-\>next;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): \*ctx-\>last\_out = cl;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): ctx-\>last\_out =  
&cl-\>next;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): \*ctx-\>last\_out = cl;  
Ngx\_http\_gunzip\_filter\_module.c (add-on): ctx-\>last\_out = &cl-\>next;

Posted at Nginx Forum:

> **[Re: gunzip module and buffer managment](https://forum.nginx.org/read.php?2,239934,239941#msg-239941)**
>
> I'm trying to use the http\_gunzip module as an example for a filter I am trying to write. I'm particularly interested in the buffer management. The module has a value in its ctx stuct called last\_buf ... ngx\_chain\_t \*\*last\_out; ... last\_o
