065: strange stuff with Test Server - news.kpn.nl on non-KPN DSL

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: 9429
Joined: January 22nd, 2008, 2:22 pm

065: strange stuff with Test Server - news.kpn.nl on non-KPN DSL

Post by sander »

Something strange with SABnzbd 0.6.5 (and also 0.6.1)

Test Server with news.kpn.nl (without username/password) on a non-KPN DSL connection results in a time-out / no message in the WebGUI, and this on the stdout/stderr

Code: Select all

2011-06-29 11:52:45,212::DEBUG::[misc:802] Checked for a new release, cur= 60599, latest= 60599 (on https://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/sabnzbd-0.6.5)

2011-06-29 11:53:13,056::INFO::[_cplogging:55] [29/Jun/2011:11:53:13] HTTP 
Request Headers:
  REFERER: http://localhost:8080/sabnzbd/config/server/
  Content-Length: 188
  ACCEPT-CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  USER-AGENT: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
  CONNECTION: keep-alive
  COOKIE: plushContainerWidth=100%25; plushNoTopMenu=0; session_id=8b66491777fd4a01c7987a9a80a2e202fc98201d
  Remote-Addr: ::ffff:127.0.0.1
  PRAGMA: no-cache
  X-REQUESTED-WITH: XMLHttpRequest
  HOST: localhost:8080
  CACHE-CONTROL: no-cache
  ACCEPT: */*
  ACCEPT-LANGUAGE: en-us,en;q=0.5
  Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  ACCEPT-ENCODING: gzip, deflate
2011-06-29 11:53:13,060::DEBUG::[_cplogging:55] [29/Jun/2011:11:53:13] HTTP Traceback (most recent call last):
  File "/home/sander/Downloads/SABnzbd-0.6.5/cherrypy/_cprequest.py", line 618, in respond
    cherrypy.response.body = self.handler()
  File "/home/sander/Downloads/SABnzbd-0.6.5/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/sander/Downloads/SABnzbd-0.6.5/sabnzbd/interface.py", line 388, in tapi
    return api_handler(kwargs)
  File "/home/sander/Downloads/SABnzbd-0.6.5/sabnzbd/api.py", line 84, in api_handler
    response = _api_table.get(mode, _api_undefined)(name, output, kwargs)
  File "/home/sander/Downloads/SABnzbd-0.6.5/sabnzbd/api.py", line 616, in _api_config
    return _api_config_table.get(name, _api_config_undefined)(output, kwargs)
  File "/home/sander/Downloads/SABnzbd-0.6.5/sabnzbd/api.py", line 676, in _api_config_test_server
    result, msg = test_nntp_server_dict(kwargs)
  File "/home/sander/Downloads/SABnzbd-0.6.5/sabnzbd/utils/servertests.py", line 52, in test_nntp_server_dict
    password=password, ssl=ssl)
  File "/home/sander/Downloads/SABnzbd-0.6.5/sabnzbd/utils/servertests.py", line 112, in test_nntp_server
    code = nw.lines[0][:3]
IndexError: list index out of range


A manual nntp / telnet session is more clear:

Code: Select all

sander@R540:~$ telnet news.kpn.nl nntp
Trying 213.75.12.10...
Connected to nova.planet.nl.
Escape character is '^]'.
502 news.kpn.nl: Access denied to your node
Connection closed by foreign host.
sander@R540:~$ 
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: 065: strange stuff with Test Server - news.kpn.nl on non-KPN DSL

Post by sander »

I fired up Wireshark with plain 0.6.5 running, clicked Test Server for news.kpn.nl, and the result as seen by Wireshark:

SAB makes a connection to news.kpn.nl, which immediately says "502 ... access denied" (and closes the connection as can be seen with a manual telnet nntp session)
SAB seems to ignore that, and says "ARTICLE test"
... and then nothing, which is as expected: news.kpn.nl has already disconnected after saying "502 ...."

So: is SAB ignoring the 502 and/or the connection being closed?


FWIW: the WebGUI stays on a turning wheel for minutes (no timeout?)
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: 065: strange stuff with Test Server - news.kpn.nl on non-KPN DSL

Post by sander »

OK, I seem to have patched it in the code by checking for 502. It works for news.kpn.nl. See screendump  :)  EDIT: "The upload folder is full. Please try a smaller file and/or contact an administrator."

Changed the code in newswrapper.py from

Code: Select all

        if code == '400':
            raise NNTPPermanentError(self.lines[0])
into

Code: Select all

        if code == '400' or code =='502' :
            raise NNTPPermanentError(self.lines[0])


@shypike, how does this look to you?



diff -u newswrapper.py.org newswrapper.py

Code: Select all

--- newswrapper.py.org	2011-06-13 12:08:48.000000000 +0200
+++ newswrapper.py	2011-06-29 18:59:19.350737427 +0200
@@ -271,7 +271,7 @@
             self.pass_sent = False
             self.pass_ok = False
 
-        if code == '400':
+        if code == '400' or code =='502' :
             raise NNTPPermanentError(self.lines[0])
         elif not self.user_sent:
             command = 'authinfo user %s\r\n' % (self.server.username)
@@ -280,6 +280,11 @@
         elif not self.user_ok:
             if code == '381':
                 self.user_ok = True
+            elif code == '281':			# '281' after a authinfo user means no password is needed (BTW: sending username was probably not needed at all), so skip sending a password and define we're connected:
+                self.user_ok = True
+                self.pass_sent = True
+                self.pass_ok = True
+	        self.connected = True
 
         if self.user_ok and not self.pass_sent:
             command = 'authinfo pass %s\r\n' % (self.server.password)

If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: 065: strange stuff with Test Server - news.kpn.nl on non-KPN DSL

Post by shypike »

Yes, makes sense.
In this case the 502 is appropriate because the refusal is independent from a username/password.
Thanks.

The forum is gradually falling apart.
inpheaux keeps promising the transfer to phpBB.
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: 065: strange stuff with Test Server - news.kpn.nl on non-KPN DSL

Post by sander »

shypike wrote:
In this case the 502 is appropriate because the refusal is independent from a username/password.
Well ... quote from http://tools.ietf.org/html/rfc3977 (yes, I now use a newer RFC for NNTP  ;) )

Code: Select all

5.1.  Initial Connection

5.1.1.  Usage

   This command MUST NOT be pipelined.

   Responses [1]
     200    Service available, posting allowed
     201    Service available, posting prohibited
     400    Service temporarily unavailable [2]
     502    Service permanently unavailable [2]

   [1] These are the only valid response codes for the initial greeting;
       the server MUST not return any other generic response code.

   [2] Following a 400 or 502 response, the server MUST immediately
       close the connection.

5.1.2.  Description

   There is no command presented by the client upon initial connection
   to the server.  The server MUST present an appropriate response code
   as a greeting to the client.  This response informs the client
   whether service is available and whether the client is permitted to
   post.

   If the server will accept further commands from the client including
   POST, the server MUST present a 200 greeting code.  If the server
   will accept further commands from the client, but the client is not
   authorized to post articles using the POST command, the server MUST
   present a 201 greeting code.

   Otherwise, the server MUST present a 400 or 502 greeting code and
   then immediately close the connection. 400 SHOULD be used if the
   issue is only temporary (for example, because of load) and the client
   can expect to be able to connect successfully at some point in the
   future without making any changes. 502 MUST be used if the client is
   not permitted under any circumstances to interact with the server,
   and MAY be used if the server has insufficient information to
   determine whether the issue is temporary or permanent.
... so I would say 502 + closing is RFC compliant.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Post Reply