backend/common/rhnException.py | 3 +++
backend/common/rhnRepository.py | 13 +++++++++++--
backend/server/apacheRequest.py | 5 +++--
3 files changed, 17 insertions(+), 4 deletions(-)
New commits:
commit 27120d4714e0f19af7cbf1aef0e771c35203fb90
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Nov 23 11:08:06 2011 +0100
Ubuntu send request for translations, send 404 back and do not raise traceback
Ubuntu send such requests:
/XMLRPC/GET-REQ/ubuntu-server-10.04-lucid-lts-x86_64/i18n/Translation-en_US.bz2
This will create traceback and ISE.
Creating new function i18n, which will simply return:
404 Not Found
If somebody ever decide to support it, he can change this function to return
something
useful.
diff --git a/backend/common/rhnException.py b/backend/common/rhnException.py
index de3b05c..0fc5bad 100644
--- a/backend/common/rhnException.py
+++ b/backend/common/rhnException.py
@@ -439,6 +439,9 @@ class rhnFault(Exception):
return xmlrpclib.Fault(1, s.getvalue())
return xmlrpclib.Fault(-self.code, s.getvalue())
+class rhnNotFound(Exception):
+ """ Raised when we want return 404 Not Found """
+ pass
if __name__ == "__main__":
print "You can not run this module by itself"
diff --git a/backend/common/rhnRepository.py b/backend/common/rhnRepository.py
index 704590c..02baedd 100644
--- a/backend/common/rhnRepository.py
+++ b/backend/common/rhnRepository.py
@@ -27,7 +27,7 @@ from spacewalk.common import rhn_rpm
import rhnFlags
from rhnLog import log_debug
from rhnLib import rfc822time
-from rhnException import rhnException, rhnFault
+from rhnException import rhnException, rhnFault, rhnNotFound
from RPC_Base import RPC_Base
class Repository(RPC_Base):
@@ -43,7 +43,8 @@ class Repository(RPC_Base):
self.functions = [
'getPackage',
'getPackageHeader',
- 'getPackageSource'
+ 'getPackageSource',
+ 'i18n',
]
def set_compress_headers(self, val):
@@ -105,6 +106,14 @@ class Repository(RPC_Base):
return self._getFile(filePath)
+ def i18n(self, translation, *args):
+ """ Translations files for Ubuntu. E.g. Translation-en_US.bz2
+
+ We do not support it so just return 404. But do not fail with
+ traceback.
+ """
+ raise rhnNotFound()
+
def getPackageSource(self, pkgFilename):
""" Get srpm packrge. """
log_debug(3, pkgFilename)
diff --git a/backend/server/apacheRequest.py b/backend/server/apacheRequest.py
index d396746..5bb5f2d 100644
--- a/backend/server/apacheRequest.py
+++ b/backend/server/apacheRequest.py
@@ -27,7 +27,7 @@ from spacewalk.common import apache, rhnFlags
from spacewalk.common.rhnConfig import CFG
from spacewalk.common import byterange
from spacewalk.common.rhnLog import log_debug, log_error
-from spacewalk.common.rhnException import rhnFault, \
+from spacewalk.common.rhnException import rhnFault, rhnNotFound,\
redirectException #to catch redirect exception
from spacewalk.common.rhnTranslate import _
from spacewalk.common.rhnLib import setHeaderValue
@@ -136,7 +136,8 @@ class apacheRequest:
extra="Response sent back to the caller:\n%s\n" % (
response.faultString,),
severity="notification")
-
+ except rhnNotFound, e:
+ return apache.HTTP_NOT_FOUND
#pkilambi:catch exception if redirect
except redirectException, re:
log_debug(3,"redirect exception caught",re.path)
Show replies by date