From: Timothy Goddard Date: 2006-11-25T11:35:05+09:00 Subject: Re: simple ruby proxy Max Benjamin wrote: > Hello, > I'm trying to use a ruby program to grab html outside of my domain and > alter it for use in another page in my domain. This is a proxy, right? > I thought I wouldn't have a problem with this but... I do. > <% > require "cgi" > require "open-uri" > > cgi = CGI.new() > url = cgi.params['myURL'] > > htmlDoc = "" > test = open(url) > test.each() do |line| > htmlDoc += line > end > %> > <%= htmlDoc %> > When I ask for this program in a GET request I'm asked if I want to save > the file rather than getting a display of the html. I'm sure this is > just some stupid noob mistake I'm making. Any help would be > appreciated. > Best, > Max > > -- > Posted via http://www.ruby-forum.com/. OpenURI can be used to open files. A script like this would be a major security problem. The problem here with being asked to save it is that you aren't sending the proper MIME type. Look at the CGI docs for how to do this.