view · edit · sidebar · attach · print · history

Index>

20170321-davaz

Summary

Commits

Index

Fix davaz.com

I will test the changes in sbsm and davaz.com on oddb-ci2 and run manual tests to see how the app permits editing an art-object directly after a login.

SBSM has 4 skips in tests around feedback. In Davaz.com replaced some @session.load_<something> by @session.app.load_<something>. But I have still 10 failures.

Running manual tests with the locally modified SBSM and davaz.com, showed that the logout problem could be reproduced and that login still does not work correctly. Eg. I fin in the yus log /service/davaz.com-yus/log/main/current

@4000000058d0e2592ce9565c I, [2017-03-21T09:20:31.753465 #16923]  INFO -- Yus::Server: Login attempt for juerg@davaz.com from com.davaz
@4000000058d0e2592cea5444 I, [2017-03-21T09:20:31.753535 #16923]  INFO -- Yus::Server: Authentication succeeded for juerg@davaz.com
@4000000058d0e2592f8415dc D, [2017-03-21T09:20:31.797140 #16923] DEBUG -- Yus::EntitySession: juerg@davaz.com allowed?(edit, com.davaz) returns true
@4000000058d0e259317d847c I, [2017-03-21T09:20:31.830237 #16923]  INFO -- Yus::Server: Logout for #<DRb::DRbUnknown:0x00000002188290>
@4000000058d0e259328b6654 W, [2017-03-21T09:20:31.847932 #16923]  WARN -- Yus::Server: Token-Authentication failed for juerg@davaz.com
@4000000058d0e2681d15b39c I, [2017-03-21T09:20:46.487894 #16923]  INFO -- Yus::Server: Logout for #<DRb::DRbUnknown:0x0000000216d9b8>
@4000000058d0e2681ede88d4 W, [2017-03-21T09:20:46.517851 #16923]  WARN -- Yus::Server: Token-Authentication failed for juerg@davaz.com

In SBSM 1.3.0 (the last version without rack) I found in the method process in lib/sbsm/session.rb the following statements

        @request_path = @request.unparsed_uri
<..>
        unless(@state.request_path)
          @state.request_path = @request_path
          @state.init
        end

Analysed with HTTP-Fox the fragment returned on http://davaz.com when pressing Logout. I see

00:00:55.519	0.546	493	0	GET	303	Redirect (cached)	http://davaz.com/en/admin/logout/fragment/Rack_AEA

(Request-Zeile)	GET /en/admin/logout/fragment/Rack_AEA HTTP/1.1
Host	davaz.com
User-Agent	Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language	de-CH,en-US;q=0.7,en;q=0.3
Accept-Encoding	gzip, deflate
Referer	http://davaz.com/en/gallery/gallery/
Cookie	language=en; _session_id=c9b1c2ba4847887c290a660e6; davaz.com-preferences=c9b1c2ba4847887c290a660e6; davaz.com-preferences=language%3Den

Cookies
language	en	/en/	davaz.com	End Of Session
_session_id	c9b1c2ba4847887c290a660e6	/en/	davaz.com	End Of Session
davaz.com-preferences	c9b1c2ba4847887c290a660e6	/en/	davaz.com	End Of Session
davaz.com-preferences	language%3Den	/	davaz.com	19.12.2026, 09:06:53

And in the /var/www/new.davaz.com/log/2017/03/21/access_log I see

77.57.3.67 - - [21/Mar/2017:11:56:14 +0100] "GET /en/admin?login_email=juerg%40davaz.com&login_password=&flavor=&language=en&event=login&state_id=69992730257240&fragment= HTTP/1.1" 200 16 "http://davaz.com/en/gallery/gallery/" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
77.57.3.67 - - [21/Mar/2017:11:56:29 +0100] "GET /en/admin/logout/fragment/Rack_AEA HTTP/1.1" 303 - "http://davaz.com/en/gallery/gallery/" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"

The session pool in sbsm/app.rb does not work correctly. Proof is this pry snippet while being in call(request)

[11] pry(#<DaVaz::Util::RackInterface>)> request.cookies
=> {"language"=>"en", "remember"=>"69ccc4ffb323dd98925103cdde05ce73f2cd6e3b6abe748cf3356c7d18e53402", "name"=>"juerg@davaz.com", "davaz.com-preferences"=>"0000000000000007"}
[12] pry(#<DaVaz::Util::RackInterface>)> session_id
=> "0000000000000004"

After moving the initialization of Rack::Cookie into lib/sbm/app.rb and reading/setting the cookie for the session_id in the call method I was able to login from the gallery (login still visible). After going to movies I was able to edit an art_item with a click on its "more" link. But only when I started with bundle exec rackup test/config.r, but not with bundle exec rackup config.ru. Why?

With test/config.ru I am now always logged in a logging out fails, because the previous.request_path is nil. After clearing the browser cache, I was able to login again.

When I tried a logout while being at /en/work/movies/111 I got the following debugoutput

request_path for /en/admin/logout/fragment/111 prev /en/works/movies/
NoMethodError: undefined method `request_path' for "/en/works/movies/#111":String
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:225:in `block in process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:213:in `synchronize'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:213:in `process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/app.rb:168:in `call'

May be the trigger method in sbsm/state.rb is not working correctly.

Somewhere we must assign a string to state, eg. I see in my pry session

[13] pry(#<DaVaz::Util::Session>)> @state.class
=> String
[14] pry(#<DaVaz::Util::Session>)> @state
=> "/en/home#111"

Or was there a relation between the yus-sessions and the sessions maintained by SBSM via DRb?

view · edit · sidebar · attach · print · history
Page last modified on March 21, 2017, at 05:54 PM