Page 1 of 1

remote access: TypeError: startswith first arg must be str,

Posted: January 18th, 2015, 12:07 pm
by sander
When I remotely access my SABnzbd (through my NAT device) with curl or Android, I get an error "500 Internal Server Error" + cherrypy trackeback in my browser, and SAB's stdout/stderr says:

Code: Select all

2015-01-18 17:39:27,424::INFO::[_cplogging:55] [18/Jan/2015:17:39:27] HTTP 
Request Headers:
  HOST: 82.x.y.z:8080
  ACCEPT: */*
  USER-AGENT: curl/7.35.0
  Remote-Addr: 62.a.b.c
2015-01-18 17:39:27,426::DEBUG::[_cplogging:55] [18/Jan/2015:17:39:27] HTTP Traceback (most recent call last):
  File "/usr/share/sabnzbdplus/cherrypy/_cprequest.py", line 618, in respond
    cherrypy.response.body = self.handler()
  File "/usr/share/sabnzbdplus/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/share/sabnzbdplus/sabnzbd/interface.py", line 268, in index
    if not check_access(): return Protected()
  File "/usr/share/sabnzbdplus/sabnzbd/interface.py", line 91, in check_access
    return referrer in ('127.0.0.1', '::1') or referrer.startswith(cfg.local_range())
TypeError: startswith first arg must be str, unicode, or tuple, not list
Happens both with Ubuntu's stock version of SABnzbd 0.7.20 sabnzbdplus, and SAB's git version develop.

... hey, the same "check_access" as I saw a few days ago ... :-\

EDIT:

Hmm, it must be something in my sabnzbd.ini; when I start with a fresh setup ("./SABnzbd.py -f blabla.ini"), there is no error message ... ???

Re: remote access: TypeError: startswith first arg must be s

Posted: January 18th, 2015, 4:59 pm
by shypike
There could very well be a problem in the "develop" code.
But what you show is not from the "develop" branch.

The crash on 0.7.20 is probably caused by re-using a "develop" INI file for 0.7.20.
In 0.7.20, local_range is just a string, in "develop" it is a list of strings.

Re: remote access: TypeError: startswith first arg must be s

Posted: January 18th, 2015, 5:11 pm
by sander
Ah, interesting

Code: Select all

$ cat ~/.sabnzbd/sabnzbd.ini | grep range
local_range = ,
Is that good or not good for develop?
And should it be ignored by 0.7.x?

EDIT:

Removing local_range from sabnzbd.ini makes the remote access to 0.7.x OK again.

Re: remote access: TypeError: startswith first arg must be s

Posted: January 19th, 2015, 6:43 am
by shypike
The change to local_range in 0.8.0 broke backward compatibility with 0.7.x
That's not good. It's probably better to rename the option.