rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Windows CGI handler returns \r\r\n header
@ 2012-07-23  3:03 Randy M
  2012-07-31  8:38 ` Magnus Holm
  0 siblings, 1 reply; 3+ messages in thread
From: Randy M @ 2012-07-23  3:03 UTC (permalink / raw)
  To: rack-devel

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

Hello everyone.

I'm using rack (1.4.1) on Windows rubyinstaller.org version.
I encountered Handler::CGI trouble.
Response header becomes \r\r\n.

= code =
#!ruby 
require "rubygems" 
require "rack" 
class HelloRack 
def call(env) 
req = Rack::Request.new(env) 
return [200, {"Content-Type" => "text/plain"}, 
"Hello, Rack\n" + req.params.inspect ] 
end 
end 
Rack::Handler::CGI.run HelloRack.new

= output =
Status: 200\r\r\nContent-Type: text/plain\r\r\n\r\r\nHello, Rack\r\n{}

= version = 
E:\>ruby -v
ruby 1.8.7 (2012-06-29 patchlevel 370) [i386-mingw32]
E:\tmp>gem list
rack (1.4.1)


Could anyone tell me idea? 

---------- 
Randy Michaels 
randy_michaels@aol.com

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

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

* Re: Windows CGI handler returns \r\r\n header
  2012-07-23  3:03 Windows CGI handler returns \r\r\n header Randy M
@ 2012-07-31  8:38 ` Magnus Holm
  2012-08-09  7:14   ` Randy M
  0 siblings, 1 reply; 3+ messages in thread
From: Magnus Holm @ 2012-07-31  8:38 UTC (permalink / raw)
  To: rack-devel

I think we need a $stdout.binmode (after $stdin.binmode) here:
https://github.com/rack/rack/blob/master/lib/rack/handler/cgi.rb

// Magnus Holm


On Mon, Jul 23, 2012 at 5:03 AM, Randy M <randy_michaels@aol.com> wrote:
> Hello everyone.
>
> I'm using rack (1.4.1) on Windows rubyinstaller.org version.
> I encountered Handler::CGI trouble.
> Response header becomes \r\r\n.
>
> = code =
> #!ruby
> require "rubygems"
> require "rack"
> class HelloRack
> def call(env)
> req = Rack::Request.new(env)
> return [200, {"Content-Type" => "text/plain"},
> "Hello, Rack\n" + req.params.inspect ]
> end
> end
> Rack::Handler::CGI.run HelloRack.new
>
> = output =
> Status: 200\r\r\nContent-Type: text/plain\r\r\n\r\r\nHello, Rack\r\n{}
>
> = version =
> E:\>ruby -v
> ruby 1.8.7 (2012-06-29 patchlevel 370) [i386-mingw32]
> E:\tmp>gem list
> rack (1.4.1)
>
>
> Could anyone tell me idea?
>
> ----------
> Randy Michaels
> randy_michaels@aol.com

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

* Re: Windows CGI handler returns \r\r\n header
  2012-07-31  8:38 ` Magnus Holm
@ 2012-08-09  7:14   ` Randy M
  0 siblings, 0 replies; 3+ messages in thread
From: Randy M @ 2012-08-09  7:14 UTC (permalink / raw)
  To: rack-devel

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

 Yes, it is right fix in windows enviroment. 
 Thanks. It is happy if this fix has merged.

I think we need a $stdout.binmode (after $stdin.binmode) here: 
> https://github.com/rack/rack/blob/master/lib/rack/handler/cgi.rb 
>
> // Magnus Holm 
>
>
> On Mon, Jul 23, 2012 at 5:03 AM, Randy M <randy_m...@aol.com <javascript:>> 
> wrote: 
> > Hello everyone. 
> > 
> > I'm using rack (1.4.1) on Windows rubyinstaller.org version. 
> > I encountered Handler::CGI trouble. 
> > Response header becomes \r\r\n. 
> > 
> > = code = 
> > #!ruby 
> > require "rubygems" 
> > require "rack" 
> > class HelloRack 
> > def call(env) 
> > req = Rack::Request.new(env) 
> > return [200, {"Content-Type" => "text/plain"}, 
> > "Hello, Rack\n" + req.params.inspect ] 
> > end 
> > end 
> > Rack::Handler::CGI.run HelloRack.new 
> > 
> > = output = 
> > Status: 200\r\r\nContent-Type: text/plain\r\r\n\r\r\nHello, Rack\r\n{} 
> > 
> > = version = 
> > E:\>ruby -v 
> > ruby 1.8.7 (2012-06-29 patchlevel 370) [i386-mingw32] 
> > E:\tmp>gem list 
> > rack (1.4.1) 
> > 
> > 
> > Could anyone tell me idea? 
>
>

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

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

end of thread, other threads:[~2012-08-09  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-23  3:03 Windows CGI handler returns \r\r\n header Randy M
2012-07-31  8:38 ` Magnus Holm
2012-08-09  7:14   ` Randy M

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).