[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] Require HTTP "POST" method in the HTTP-based scheduler; GET requests should be idempotent

Holger Levsen gitlab at salsa.debian.org
Thu Mar 5 07:50:00 GMT 2020



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
4e1682b2 by Chris Lamb at 2020-03-04T15:00:24-08:00
Require HTTP "POST" method in the HTTP-based scheduler; GET requests should be idempotent

- - - - -


1 changed file:

- bin/cgi-bin/schedule


Changes:

=====================================
bin/cgi-bin/schedule
=====================================
@@ -1,6 +1,7 @@
 #!/usr/bin/python3
 
 # Copyright © 2018 Mattia Rizzolo <mattia at debian.org>
+# Copyright © 2020 Chris Lamb <lamby at debian.org>
 # Licensed under GPL-2
 
 import os
@@ -75,6 +76,22 @@ def validate(form):
 
 
 def main(args):
+    # Require POST HTTP method; GET requests should be idempotent
+    if os.environ.get('REQUEST_METHOD', 'GET') != 'POST':
+        print('Status: 200 OK')
+        print('Content-Type: text/html; charset="utf-8"')
+        print()
+        print('<html><form method="POST"><button type="submit">')
+        print('Reschedule build(s) of {} on {}/{}'.format(
+            ', '.join(form.getlist('pkg')),
+            ', '.join(form.getlist('suite')),
+            ', '.join(form.getlist('architecture')),
+        ))
+        print('</button</form><pre>')
+        debug_info()
+        print('</pre></html>')
+        sys.exit()
+
     processes = []
     failure = False
     for s in form.getlist('suite'):



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/4e1682b21d70fc897e4659b9df81e4d62aaa4837

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/4e1682b21d70fc897e4659b9df81e4d62aaa4837
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20200305/c8e84035/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list