rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* disable chunked transfer-encoding
@ 2019-05-23 15:19 dorian taylor
  2019-05-23 16:14 ` dorian taylor
  2019-05-23 16:15 ` James Tucker
  0 siblings, 2 replies; 7+ messages in thread
From: dorian taylor @ 2019-05-23 15:19 UTC (permalink / raw)
  To: Rack Development


[-- Attachment #1.1: Type: text/plain, Size: 1312 bytes --]

Hi,

I'm trying to use Rack as a FastCGI authorizer (cf 
https://github.com/fast-cgi/spec/blob/master/spec.md#63-authorizer ) in 
conjunction with Apache mod_authnz_fcgi 
(https://httpd.apache.org/docs/2.4/mod/mod_authnz_fcgi.html ). My problem 
is that mod_authnz_fcgi insists on a 200 status code and *only* a 200 
status code to communicate any results from the fastcgi script back up the 
line. This is where Rack::Chunked is ruining my day: it forces the choice 
of either a Content-Length header (which is transmitted upstream and 
truncates the output), or a Transfer-Encoding: chunked header where the 
accompanying *token* is removed upstream, resulting in a protocol error.

I would like to be able to express an HTTP 200 response that has neither a 
Content-Length nor a Transfer-Encoding header. Is there any way to disable 
Rack::Chunked for certain responses?

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rack-devel/ab1058ab-ba08-4843-9489-86bcc55bde19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1731 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: disable chunked transfer-encoding
  2019-05-23 15:19 disable chunked transfer-encoding dorian taylor
@ 2019-05-23 16:14 ` dorian taylor
  2019-05-23 16:15 ` James Tucker
  1 sibling, 0 replies; 7+ messages in thread
From: dorian taylor @ 2019-05-23 16:14 UTC (permalink / raw)
  To: Rack Development


[-- Attachment #1.1: Type: text/plain, Size: 731 bytes --]

Never mind, looks like after rummaging through handler/fastcgi.rb, the 
answer is to set a Content-Length header to the empty string. This tricks 
Rack::Chunked which only tests for the presence of the header, not its 
content. I'm a bit apprehensive about this solution but for now it works.

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rack-devel/3a971889-03c3-44b3-aade-d5cbe219e4e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1089 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: disable chunked transfer-encoding
  2019-05-23 15:19 disable chunked transfer-encoding dorian taylor
  2019-05-23 16:14 ` dorian taylor
@ 2019-05-23 16:15 ` James Tucker
  2019-05-23 16:18   ` dorian taylor
  1 sibling, 1 reply; 7+ messages in thread
From: James Tucker @ 2019-05-23 16:15 UTC (permalink / raw)
  To: Rack Development

[-- Attachment #1: Type: text/plain, Size: 2248 bytes --]

On Thu, May 23, 2019, 9:11 AM dorian taylor <dorian.taylor@gmail.com> wrote:

> Hi,
>
> I'm trying to use Rack as a FastCGI authorizer (cf
> https://github.com/fast-cgi/spec/blob/master/spec.md#63-authorizer ) in
> conjunction with Apache mod_authnz_fcgi (
> https://httpd.apache.org/docs/2.4/mod/mod_authnz_fcgi.html ). My problem
> is that mod_authnz_fcgi insists on a 200 status code and *only* a 200
> status code to communicate any results from the fastcgi script back up the
> line. This is where Rack::Chunked is ruining my day: it forces the choice
> of either a Content-Length header (which is transmitted upstream and
> truncates the output), or a Transfer-Encoding: chunked header where the
> accompanying *token* is removed upstream, resulting in a protocol error.
>
> I would like to be able to express an HTTP 200 response that has neither a
> Content-Length nor a Transfer-Encoding header. Is there any way to disable
> Rack::Chunked for certain responses?
>

Such a response is only valid in http 1.0, not http 1.1.

In this regard rack won't help you much, as it isn't trying to provide for
that case.

Have you considered not including this middleware for these requests?

-- 
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Rack Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rack-devel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rack-devel/ab1058ab-ba08-4843-9489-86bcc55bde19%40googlegroups.com
> <https://groups.google.com/d/msgid/rack-devel/ab1058ab-ba08-4843-9489-86bcc55bde19%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rack-devel/CABGa_T_%2Be%3DnzMuyhe9%2BzKrab1mBeEEzw04F96%3DdTuv2Hxf_02w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 3799 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: disable chunked transfer-encoding
  2019-05-23 16:15 ` James Tucker
@ 2019-05-23 16:18   ` dorian taylor
  2019-05-23 16:41     ` James Tucker
  0 siblings, 1 reply; 7+ messages in thread
From: dorian taylor @ 2019-05-23 16:18 UTC (permalink / raw)
  To: Rack Development


[-- Attachment #1.1: Type: text/plain, Size: 1065 bytes --]



On Thursday, May 23, 2019 at 9:15:24 AM UTC-7, raggi wrote:
>
>
> Such a response is only valid in http 1.0, not http 1.1.
>
> In this regard rack won't help you much, as it isn't trying to provide for 
> that case.
>
> Have you considered not including this middleware for these requests?
>
>
Do I get a choice in the matter? If I start the script with rackup it seems 
to add it all by itself:


#<Rack::ContentLength:0x000055d0e32f7f60
 @app=
  #<Rack::Chunked:0x000055d0e32f7fb0
   @app=
    #<Rack::TempfileReaper:0x000055d0e2a07db0
     @app=#<LazyAuth::App:0x000055d0e315e910>>>>
#<LazyAuth::App:0x000055d0e315e910>



-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rack-devel/7eb7b470-57d4-44dd-97fa-25bea17cce0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 3272 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: disable chunked transfer-encoding
  2019-05-23 16:18   ` dorian taylor
@ 2019-05-23 16:41     ` James Tucker
  2019-05-23 16:44       ` James Tucker
  2019-05-23 16:54       ` dorian taylor
  0 siblings, 2 replies; 7+ messages in thread
From: James Tucker @ 2019-05-23 16:41 UTC (permalink / raw)
  To: Rack Development

[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]

On Thu, May 23, 2019, 9:18 AM dorian taylor <dorian.taylor@gmail.com> wrote:

>
>
> On Thursday, May 23, 2019 at 9:15:24 AM UTC-7, raggi wrote:
>>
>>
>> Such a response is only valid in http 1.0, not http 1.1.
>>
>> In this regard rack won't help you much, as it isn't trying to provide
>> for that case.
>>
>> Have you considered not including this middleware for these requests?
>>
>>
> Do I get a choice in the matter? If I start the script with rackup it
> seems to add it all by itself:
>
>
> #<Rack::ContentLength:0x000055d0e32f7f60
>  @app=
>   #<Rack::Chunked:0x000055d0e32f7fb0
>    @app=
>     #<Rack::TempfileReaper:0x000055d0e2a07db0
>      @app=#<LazyAuth::App:0x000055d0e315e910>>>>
> #<LazyAuth::App:0x000055d0e315e910>
>
>
>
rackup is an opinionated tool that is good for 90% of use cases and adds
those middleware to meet that goal.

I would say the behavior you need falls out of that use case set, and you
should consider writing your fastcgi spawner using the library primitives.




> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Rack Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rack-devel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rack-devel/7eb7b470-57d4-44dd-97fa-25bea17cce0f%40googlegroups.com
> <https://groups.google.com/d/msgid/rack-devel/7eb7b470-57d4-44dd-97fa-25bea17cce0f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rack-devel/CABGa_T_d1Z6FaJhewsbP2P6rbtKdAXE_nZFEUfStBYT4DQib4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 5568 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: disable chunked transfer-encoding
  2019-05-23 16:41     ` James Tucker
@ 2019-05-23 16:44       ` James Tucker
  2019-05-23 16:54       ` dorian taylor
  1 sibling, 0 replies; 7+ messages in thread
From: James Tucker @ 2019-05-23 16:44 UTC (permalink / raw)
  To: Rack Development

[-- Attachment #1: Type: text/plain, Size: 2303 bytes --]

On Thu, May 23, 2019, 9:41 AM James Tucker <jftucker@gmail.com> wrote:

>
>
> On Thu, May 23, 2019, 9:18 AM dorian taylor <dorian.taylor@gmail.com>
> wrote:
>
>>
>>
>> On Thursday, May 23, 2019 at 9:15:24 AM UTC-7, raggi wrote:
>>>
>>>
>>> Such a response is only valid in http 1.0, not http 1.1.
>>>
>>> In this regard rack won't help you much, as it isn't trying to provide
>>> for that case.
>>>
>>> Have you considered not including this middleware for these requests?
>>>
>>>
>> Do I get a choice in the matter? If I start the script with rackup it
>> seems to add it all by itself:
>>
>>
>> #<Rack::ContentLength:0x000055d0e32f7f60
>>  @app=
>>   #<Rack::Chunked:0x000055d0e32f7fb0
>>    @app=
>>     #<Rack::TempfileReaper:0x000055d0e2a07db0
>>      @app=#<LazyAuth::App:0x000055d0e315e910>>>>
>> #<LazyAuth::App:0x000055d0e315e910>
>>
>>
>>
> rackup is an opinionated tool that is good for 90% of use cases and adds
> those middleware to meet that goal.
>
> I would say the behavior you need falls out of that use case set, and you
> should consider writing your fastcgi spawner using the library primitives.
>



It's been a long while, but I think if you pass the "none" environment
these middleware will be elided.


>
>
>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Rack Development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to rack-devel+unsubscribe@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/rack-devel/7eb7b470-57d4-44dd-97fa-25bea17cce0f%40googlegroups.com
>> <https://groups.google.com/d/msgid/rack-devel/7eb7b470-57d4-44dd-97fa-25bea17cce0f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rack-devel/CABGa_T82sGWikWx5H5oWS7%2BwxnFAU0%3Daiqczw9oFExmNEXuhaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 6907 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: disable chunked transfer-encoding
  2019-05-23 16:41     ` James Tucker
  2019-05-23 16:44       ` James Tucker
@ 2019-05-23 16:54       ` dorian taylor
  1 sibling, 0 replies; 7+ messages in thread
From: dorian taylor @ 2019-05-23 16:54 UTC (permalink / raw)
  To: Rack Development


[-- Attachment #1.1: Type: text/plain, Size: 985 bytes --]



On Thursday, May 23, 2019 at 9:42:06 AM UTC-7, raggi wrote:

rackup is an opinionated tool that is good for 90% of use cases and adds 
> those middleware to meet that goal.
>
> I would say the behavior you need falls out of that use case set, and you 
> should consider writing your fastcgi spawner using the library primitives.
>
>
Ah, yes, thanks. It'll probably end up that way; I'm just sketching it out 
right now: https://github.com/doriantaylor/rb-lazyauth

Also the 'none' environment indeed seems to skip the stock middleware. 
Thanks!

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rack-devel/fb1df7ca-7c07-4425-8336-099301549e59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1645 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-05-23 16:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 15:19 disable chunked transfer-encoding dorian taylor
2019-05-23 16:14 ` dorian taylor
2019-05-23 16:15 ` James Tucker
2019-05-23 16:18   ` dorian taylor
2019-05-23 16:41     ` James Tucker
2019-05-23 16:44       ` James Tucker
2019-05-23 16:54       ` dorian taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).