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

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

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

Post 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 ... ???
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

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

Post 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.
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

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

Post 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.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

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

Post 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.
Post Reply