From patchwork Thu Feb 9 20:46:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 6735 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D79F723E16 for ; Thu, 9 Feb 2012 20:46:12 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id A1E7BA181F7 for ; Thu, 9 Feb 2012 20:46:12 +0000 (UTC) Received: by mail-gx0-f180.google.com with SMTP id r1so1460165ggn.11 for ; Thu, 09 Feb 2012 12:46:12 -0800 (PST) Received: by 10.50.156.133 with SMTP id we5mr31659043igb.12.1328820372249; Thu, 09 Feb 2012 12:46:12 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.12.131 with SMTP id x3cs53690ibx; Thu, 9 Feb 2012 12:46:11 -0800 (PST) Received: by 10.181.11.227 with SMTP id el3mr5107172wid.18.1328820370389; Thu, 09 Feb 2012 12:46:10 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id c1si2627767wed.8.2012.02.09.12.46.09 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Feb 2012 12:46:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Rvasb-0005TI-SX for ; Thu, 09 Feb 2012 20:46:09 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id C8436E04EB for ; Thu, 9 Feb 2012 20:46:09 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-scheduler X-Launchpad-Branch: ~linaro-validation/lava-scheduler/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 129 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 129: handle invalid values for start in job_output (which googlebot likes to provide) Message-Id: <20120209204609.27530.44881.launchpad@ackee.canonical.com> Date: Thu, 09 Feb 2012 20:46:09 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14763"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 7f01bd715cc6f609406bea31f360ed333f0d898d X-Gm-Message-State: ALoCoQkidnS+pXM/joqNDKvdWKDsfwmHrORxEchMhIpH2KQ5lCytrms1gluW2Vut6MvsoGVjsC7T ------------------------------------------------------------ revno: 129 committer: Michael Hudson-Doyle branch nick: trunk timestamp: Thu 2012-02-09 12:44:59 -0800 message: handle invalid values for start in job_output (which googlebot likes to provide) modified: lava_scheduler_app/views.py --- lp:lava-scheduler https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk You are subscribed to branch lp:lava-scheduler. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription === modified file 'lava_scheduler_app/views.py' --- lava_scheduler_app/views.py 2012-02-09 18:29:39 +0000 +++ lava_scheduler_app/views.py 2012-02-09 20:44:59 +0000 @@ -7,6 +7,7 @@ from django.http import ( HttpResponse, + HttpResponseBadRequest, HttpResponseForbidden, HttpResponseNotAllowed, ) @@ -183,7 +184,11 @@ def job_output(request, pk): - start = int(request.GET.get('start', 0)) + start = request.GET.get('start', 0) + try: + start = int(start) + except ValueError: + return HttpResponseBadRequest("invalid start") count_present = 'count' in request.GET job = get_object_or_404(TestJob, pk=pk) log_file = job.log_file