webrick

Webrick transparent proxy

风流意气都作罢 提交于 2019-12-04 20:54:08
I've a absolute simple proxy running. require 'webrick' require 'webrick/httpproxy' s = WEBrick::HTTPProxyServer.new(:Port => 8080, :RequestCallback => Proc.new{|req,res| puts req.request_line, req.raw_header}) # Shutdown functionality trap("INT"){s.shutdown} # run the beast s.start This should in my mind not influence the communication in any way. But some sites doesn't work any more. Specially http://lastfm.de 's embedded flash players doesn't work. The header looks link: - -> http://ext.last.fm/2.0/?api%5Fsig=aa3e9ac9edf46ceb9a673cb76e61fef4&flashresponse=true&y=1269686332&streaming=true

Start webrick in port 80 (mysql2 gem issue)

為{幸葍}努か 提交于 2019-12-04 18:48:44
问题 I am trying to get my webrick serve in port 80. I tried: rails server -p 80 but get a access denied. I later understood that using port 1-1024 needs a root permission, so I tried this instead sudo rails server -p 80 However, now i get a mysql2 error this time. Don't know what happened here. I tried to run: rails server -p 1025 and it's working fine, I think it's something about root and mysql2. Can anyone help? below is the error message in console: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7

Server won't start on using authlogic-oauth2

纵然是瞬间 提交于 2019-12-04 16:58:55
I have included oauth2 and authlogic-oauth2 in the gemfile as I want to use them and am trying to start the server. It doesn't start and gives me the error: /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails.rb:44:in `configuration': undefined method `config' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/1.8/gems/authlogic_oauth2-1.1.2/lib/authlogic_oauth2.rb:14 from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib

Request-URI Too Large Error - Get rid of GET?

百般思念 提交于 2019-12-04 11:10:25
I have a form on my site where users can submit answer text to be checked by the controller. It uses a standard GET form: <%= form_tag('/submit', method: "get", remote: true) do %> But I recently got the following error on long answer: Request-URI Too Large WEBrick::HTTPStatus::RequestURITooLarge Should I change the form to POST to fix the error? Would this require any other changes? Runthral It depends on the browser / web server, but the average limit for a URL is 2000 characters. So yes, if you are hitting the limit change it to POST. This will require changing the form tag: <%= form_tag('

rails mysql gem problem on ubuntu

筅森魡賤 提交于 2019-12-04 10:43:21
Ruby on Rails: I would like to call a controller on the localhost, but the server said !!! Missing the mysql gem. Add it to your Gemfile: gem 'mysql', '2.8.1' The problem ? When I hit 'gem list' command then I got a list witch is containing the mysql 2.8.1 . So the gem is INSTALLED ! WHY can't it see by the webrick ? Thank you. You need to add the line gem 'mysql', '2.8.1' to your Gemfile. Then type bundle install in the root folder of your Rails project. It sounds like you forgot to run bundler. The MySQL gem does require native C extensions. So you'll need to make sure that you have all the

Ruby Webrick HTTP Authentication

非 Y 不嫁゛ 提交于 2019-12-04 05:36:38
问题 How can I do the same authentication stuff in this page using a subclass like this: class Configuration < HTTPServlet::AbstractServlet def do_GET (request, response) SOMETHING.... end end server = HTTPServer.new(:Port => 666) server.mount "/conf", Configuration trap "INT" do server.shutdown end server.start 回答1: Seems to work OK for me if you do it in pretty much the same style e.g. class Configuration < HTTPServlet::AbstractServlet def do_GET(req, res) HTTPAuth.basic_auth(req, res, "My Realm

How do you run Rails with HTTPs locally for testing?

狂风中的少年 提交于 2019-12-03 14:51:15
Our dev envs use HTTP, prod uses HTTPS, this is causing issues that we can't reproduce locally with are HTTPS related. How can I run rails with SSL locally for testing purposes? Is there a Webrick config? Thanks you should to use thin to do it: $ sudo apt-get install thin And add this line in config/application.rb config.force_ssl = true Then run app on thin with command line: $ thin start --ssl I think the question here is specific to the Rails 'testing' environment, which might mean rspec, and if so, this gist by jaikoo was what worked for me: https://gist.github.com/jaikoo

Start webrick in port 80 (mysql2 gem issue)

随声附和 提交于 2019-12-03 12:15:46
I am trying to get my webrick serve in port 80. I tried: rails server -p 80 but get a access denied. I later understood that using port 1-1024 needs a root permission, so I tried this instead sudo rails server -p 80 However, now i get a mysql2 error this time. Don't know what happened here. I tried to run: rails server -p 1025 and it's working fine, I think it's something about root and mysql2. Can anyone help? below is the error message in console: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9):

Why would I want to use unicorn or thin instead of WEBrick for development purposes?

孤人 提交于 2019-12-03 03:33:09
问题 I've recently found that some people prefer using unicorn_rails instead of the default WEBrick as a web server for developing Rails applications. I understand that if I wanted to use unicorn in production, it could make kind of sense to try it out in development, but since the configuration is different in production, is it even relevant? Is there any real, tangible advantage that I would get from using thin or unicorn instead of WEBrick for developing a Rails application, such as speed or

Access Rails Development Server From A Different Computer

淺唱寂寞╮ 提交于 2019-12-03 02:44:24
问题 I'm using webrick to develop my rails app on Mac OS X Lion. I'm trying to access the site from another computer (for testing). The internal IP of my computer is 10.1.10.100. Accessing 10.1.10.100 displays the page served by the apache server running on my computer. Accessing 10.1.10.100:3000 times out, both from my computer and from another computer on the same network. I can ping 10.1.10.100 . From my computer, loaclhost:3000 displays the app. Is there are firewall I need to open up on Mac