python-jenkins-developers team mailing list archive
-
python-jenkins-developers team
-
Mailing list archive
-
Message #00010
[Bug 811044] Re: With authorization, build job doesn't work using POST request
Here's a wireshark capture of my test script (stuff in square brackets I have removed):
---
GET /jenkins/queue/api/json?depth=0 HTTP/1.1
Accept-Encoding: identity
Host: tom-jdvm:8080
Connection: close
Authorization: Basic [password, encoded]
User-Agent: Python-urllib/2.6
---
HTTP/1.1 200 OK
Server: Winstone Servlet Engine v0.9.10
Content-Type: application/javascript;charset=UTF-8
Content-Length: 12
Connection: Close
Date: Fri, 15 Jul 2011 14:55:05 GMT
X-Powered-By: Servlet/2.5 (Winstone/0.9.10)
{"items":[]}
---
GET /jenkins/job/poetry_writer/api/json?depth=0 HTTP/1.1
Accept-Encoding: identity
Host: tom-jdvm:8080
Connection: close
Authorization: Basic [password, encoded]
User-Agent: Python-urllib/2.6
---
HTTP/1.1 200 OK
Server: Winstone Servlet Engine v0.9.10
Content-Type: application/javascript;charset=UTF-8
Content-Length: 3114
Connection: Close
Date: Fri, 15 Jul 2011 14:55:05 GMT
X-Powered-By: Servlet/2.5 (Winstone/0.9.10)
[Load of JSON removed]
---
POST /jenkins/job/poetry_writer/buildWithParameters?[URL-encoded parameter string] HTTP/1.1
Accept-Encoding: identity
Content-Length: 0
Host: tom-jdvm:8080
User-Agent: Python-urllib/2.6
Connection: close
Content-Type: application/x-www-form-urlencoded
Authorization: Basic [password, encoded]
---
HTTP/1.1 403 Forbidden
Server: Winstone Servlet Engine v0.9.10
Content-Length: 305
Connection: Close
Content-Type: text/html;charset=UTF-8
Date: Fri, 15 Jul 2011 14:55:05 GMT
X-Powered-By: Servlet/2.5 (Winstone/0.9.10)
Set-Cookie: JSESSIONID=83cc6a68eea0fc3031b92df6dcb9b2eb; Path=/jenkins
With the change I noted in the bug report the last request is a GET and the response is 302 FOUND with a redirect, and most importantly the job gets triggered.
--
You received this bug notification because you are a member of Python
Jenkins Developers, which is the registrant for Python Jenkins.
https://bugs.launchpad.net/bugs/811044
Title:
With authorization, build job doesn't work using POST request
Status in Python API for Jenkins:
Incomplete
Bug description:
I've just stumbled into this project and am trying to use your latest
version from source control along with Jenkins version 1.420 (the
Ubuntu package version).
Using authorization, I get a 403 response to the request in build_job:
return
self.jenkins_open(urllib2.Request(self.build_job_url(name, parameters,
token), ''))
If I remove the empty data string (which I understand means the
request is GET rather than POST), everything works fine.
return
self.jenkins_open(urllib2.Request(self.build_job_url(name, parameters,
token)))
Not really sure if the cause for this is a bug in Jenkins or a problem with your script?
To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/811044/+subscriptions
References