On Fri, 6 Oct 2006 18:46:06 +0200 Wes Gamble <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > All, > > I''m attempting to GET a PDF file via Mongrel in my development > environment, and instead of returning a PDF file, I see it rendered as > text (%PDF-1.5 ...etc.) in my browser window. > > I was aware that Mongrel has a fairly limited set of mime-types that are > handled by default, so I went ahead and attempted to add the PDF > mime-type to the Mongrel handler.rb, like so: > > ".pdf" => "application/pdf" >Yikes, ok you should really be reading the -h help for start: mongrel_rails start -h You''ll see an option for -m or --mime PATH. You pass this a YAML file that looks like this: --- .jpeg: image/jpeg .png: yeah/wateva! Important point is to you put .jpeg and not jpeg. After that it should be all good.> After I reboot, I still get the junk and not the PDF. My browser has no > problems opening PDF files. > > What gives? Am I specifying the wrong mime-type? >Most likely, you should borrow your mime types from a server you know works with them. Use curl -i to figure out what another server uses. -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On Fri, 6 Oct 2006 20:43:03 +0200 Wes Gamble <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I just realized that there is something else I''m not understanding here. > I am able to successfully serve Word docs from my Mongrel server, but I > don''t have an entry for the Word mime type in handlers.rb. > > How is it that my Word docs. are being transferred correctly to the > browser when requested from Mongrel? Is that because the browser is > detecting that the incoming stream is actually a Word doc. (ie. all of > the MIME type handling is happening on the client)?Probably because Microsoft makes sure that all their products work together on another plane of existence. You should read about the crap IE does so that it works faster with IIS and slower with other servers, AND at the TCP/IP level no less. -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
All, I''m attempting to GET a PDF file via Mongrel in my development environment, and instead of returning a PDF file, I see it rendered as text (%PDF-1.5 ...etc.) in my browser window. I was aware that Mongrel has a fairly limited set of mime-types that are handled by default, so I went ahead and attempted to add the PDF mime-type to the Mongrel handler.rb, like so: ".pdf" => "application/pdf" After I reboot, I still get the junk and not the PDF. My browser has no problems opening PDF files. What gives? Am I specifying the wrong mime-type? Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I put the following in a file "config/mime.types" .pdf: application/pdf then I start mongrel with: mongrel_rails start -m config/mime.types ideally, when you switch to a production environment, you''ll have apache serving these pdf files directly, but until then, you can use the method above. Mike On 10/6/06, Wes Gamble <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > All, > > I''m attempting to GET a PDF file via Mongrel in my development > environment, and instead of returning a PDF file, I see it rendered as > text (%PDF-1.5 ...etc.) in my browser window. > > I was aware that Mongrel has a fairly limited set of mime-types that are > handled by default, so I went ahead and attempted to add the PDF > mime-type to the Mongrel handler.rb, like so: > > ".pdf" => "application/pdf" > > After I reboot, I still get the junk and not the PDF. My browser has no > problems opening PDF files. > > What gives? Am I specifying the wrong mime-type? > > Thanks, > Wes > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Mike Garey wrote:> I put the following in a file "config/mime.types" > > .pdf: application/pdf > > then I start mongrel with: > > mongrel_rails start -m config/mime.types > > ideally, when you switch to a production environment, you''ll have > apache serving these pdf files directly, but until then, you can use > the method above. > > MikeThat seems to work. I''m starting mongrel from within RadRails. Do you know: 1) how to tell mongrel to listen on a particular port using the command line above? 2) how to pass this -m parameter in RadRails? Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I just realized that there is something else I''m not understanding here. I am able to successfully serve Word docs from my Mongrel server, but I don''t have an entry for the Word mime type in handlers.rb. How is it that my Word docs. are being transferred correctly to the browser when requested from Mongrel? Is that because the browser is detecting that the incoming stream is actually a Word doc. (ie. all of the MIME type handling is happening on the client)? Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---