view · edit · sidebar · attach · print · history

Index>

20170703-oddb-org-rack

Summary

  • Port oddb.org to use rack
  • Fix rapflag problems
  • Keep in Mind

Commits

Index

Port oddb.org to use rack

Must fix the following problems:

Fix non working links:

Download problem oddb2.csvfixed with Fix getting download files

Running the download watir tests produce (among others) the following error

[2017-07-03 08:35:44] ERROR URI::InvalidURIError: URI must be ascii only "https://www.paypal.com/cgi-bin/webscr?business=zdavatz@ywesee.com&item_name=Marcoumar.Preisvergleich.csv&item_number=35933747&invoice=35933747&custom=ch.oddb.org&amount=3.78&no_shipping=1&no_note=1&currency_code=EUR&return=http://oddb-ci2.dyndns.org/de/gcc/paypal_return/invoice/35933747&cancel_return=http://oddb-ci2.dyndns.org/de/gcc&image_url=https://www.generika.cc/images/oddb_paypal.jpg&email=info@desitin.ch&first_name=Max&last_name=M\u00FCller&address1=&city=&zip=&redirect_cmd=_xclick&cmd=_ext-enter"
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/uri/rfc3986_parser.rb:21:in `split'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/uri/rfc3986_parser.rb:73:in `parse'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/uri/rfc3986_parser.rb:117:in `convert_to_uri'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/uri/generic.rb:1099:in `merge'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpresponse.rb:277:in `setup_header'
        /var/www/oddb.org.rack/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:16:in `setup_header'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpresponse.rb:207:in `send_response'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:112:in `run'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'

To log only errors in services log we just have to append in the service/ch.oddb/run "--quiet" to rackup parameters.

Looking why we cannot save the preferences correctly for differenc color. Separated the watir test for ZSR and color. Testing whether a color is used or not is possible in a watir test with an expression like expect(@browser.image(:src => /blue/).exist?).to eql true

Remarked that login(ViewerUser, ViewerPassword) does no longer work when running a watir test. Why? Fixed that problem add added a watir tests for checking colors which passes on ch.oddb.org and fails on oddb-ci2 with commit Added watir tests for checking preferences color

Looks like we still have problems saving/restoring cookies. Eg. in watir I see a path of /en for the session_id, even if I would expect a path of /

[9] pry(#<RSpec::ExampleGroups::ChOddbOrg>)> @browser.cookies['_session_id']
=> {:name=>"_session_id", :value=>"1dace95de7baa5ab16a90c6184b", :path=>"/en", :domain=>"oddb-ci2.dyndns.org", :expires=>nil, :secure=>false}
10] pry(#<RSpec::ExampleGroups::ChOddbOrg>)> @browser.cookies['search_form']
=> {:name=>"search_form", :value=>"instant", :path=>"/", :domain=>"oddb-ci2.dyndns.org", :expires=>nil, :secure=>false}

The the persistent cookie item (self::class::PERSISTENT_COOKIE_NAME or @cookiename) are not saved/restored correctly.

After some changes, the color is preserved unless I change the language. Using yaml to save/restore the persistent user input. But this did not help. Looks like changing the color setting creates a POST request which does not set the cookies correctly. Must place a debug statement there, too.

How did mod_ruby really handle the cookies? If got them from @cgi.cookies and lib/sbsm/request.rb contained a generate_cookie method like

def generate_cookie(cookie_input)
  cookie_pairs = cookie_input.collect { |pair|
    pair.join('=')
  }.join(';')
  cookie_hash = {
    "name"		=>	@proxy.cookie_name || 'sbsm-persistent-cookie',
    "value"		=>	cookie_pairs,
    "path"		=>	"/",
    "expires"	=>	(Time.now + (60 * 60 * 24 * 365 * 10)),
  }
  CGI::Cookie.new(cookie_hash).to_s
end

This proved to be a good approach. But I had to add a cuki.split(';') in import_cookies(request) to get the old behaviour. Adding a small unit test for it. Now the spec/preferences_spec.rb passes.

Tried to run the ./spec/download_spec.rb resulted in

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /de/gcc.

Reason: Error reading from remote server

and in the error output of the services I see

[2017-07-03 17:01:16] ERROR URI::InvalidURIError: URI must be ascii only "https://www.paypal.com/cgi-bin/webscr?business=zdavatz@ywesee.com&item_name=Marcoumar.Preisvergleich.csv&item_number=35933772&invoice=35933772&custom=ch.oddb.org&amount=3.78&no_shipping=1&no_note=1&currency_code=EUR&return=http://oddb-ci2.dyndns.org/de/gcc/paypal_return/invoice/35933772&cancel_return=http://oddb-ci2.dyndns.org/de/gcc&image_url=https://www.generika.cc/images/oddb_paypal.jpg&email=info@desitin.ch&first_name=Max&last_name=M\u00FCller&address1=&city=&zip=&redirect_cmd=_xclick&cmd=_ext-enter"

Did not find an easy solution here. Will continue working on it tomorrow.

view · edit · sidebar · attach · print · history
Page last modified on July 03, 2017, at 06:01 PM