Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging in after logging out after a search results in a 500 error. #67

Closed
jschuck opened this issue Oct 4, 2016 · 2 comments
Closed

Comments

@jschuck
Copy link

jschuck commented Oct 4, 2016

The following scenario leads to a thrown exception in the code:

  1. I'm logged in, and perform a normal search. Note that it doesn't happen with an advanced search.
  2. While the search results are still visible, i log out.
  3. I now immedeatly either log in as the same user or another user.
  4. It returns to the search result page, but with an empty query (http:/calibremachine.home/calibre/search for example)

And that results in the followin exception being thrown:

Oct 04 21:35:58 calibremachine python2[343]: ERROR:cps.web:Exception on /search [GET]
Oct 04 21:35:58 calibremachine python2[343]: Traceback (most recent call last):
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1817, in wsgi_app
Oct 04 21:35:58 calibremachine python2[343]:     response = self.full_dispatch_request()
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1477, in full_dispatch_request
Oct 04 21:35:58 calibremachine python2[343]:     rv = self.handle_user_exception(e)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1381, in handle_user_exception
Oct 04 21:35:58 calibremachine python2[343]:     reraise(exc_type, exc_value, tb)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1475, in full_dispatch_request
Oct 04 21:35:58 calibremachine python2[343]:     rv = self.dispatch_request()
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask/app.py", line 1461, in dispatch_request
Oct 04 21:35:58 calibremachine python2[343]:     return self.view_functions[rule.endpoint](**req.view_args)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/vendor/flask_login.py", line 717, in decorated_view
Oct 04 21:35:58 calibremachine python2[343]:     return func(*args, **kwargs)
Oct 04 21:35:58 calibremachine python2[343]:   File "/usr/share/webapps/calibre-web/cps/web.py", line 477, in search
Oct 04 21:35:58 calibremachine python2[343]:     term = request.args.get("query").strip()
Oct** 04 21:35:58 calibremachine python2[343]: AttributeError: 'NoneType' object has no attribute 'strip'
Oct 04 21:35:58 calibremachine python2[343]: ERROR:tornado.access:500 GET /calibre/search (10.10.0.100) 50.28ms

The advanced search just returns me to the advanced search page in this case.

If i manually change the url from calibre/search to calibre/ in my example, i'm correctly logged in and it works normally.

Closing the tab or the browser and normally going to the login page doesn't do this as well.

OzzieIsaacs added a commit that referenced this issue Oct 5, 2016
@OzzieIsaacs
Copy link
Collaborator

@jschuck could you please check now.

And could you please post your nginx config? I'have a problem of logging in and out and I'd like to check the differences.

@jschuck
Copy link
Author

jschuck commented Oct 5, 2016

I can confirm, that fixed that problem. I now get a Search page stating that nothing was found for an empty search query.

As for my nginx config, leaving out the unimportant parts it's basically this:

http {
    upstream calibre {
        server  127.0.0.1:8083;
    }
    server {
            location /calibre {
                proxy_bind              $server_addr;
                proxy_pass              http://calibre;
                proxy_set_header        Host            $http_host;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header        X-Scheme        $scheme;
                proxy_set_header        X-Script-Name   /calibre;
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants