Change post-commit webhooks to issue PUTs instead of POST requests

and generalize the HTTP header name for the auth digest; introduce
an option to restore the old behaviour and document that; place a
big warning in NEWS.mdtext about this change.

This change has been sponsored by Scilab.
This commit is contained in:
Thomas Keller
2011-09-26 01:36:04 +02:00
parent 7ff298af79
commit 920432025f
6 changed files with 46 additions and 5 deletions

View File

@@ -287,6 +287,12 @@ class IDF_Commit extends Pluf_Model
$url = str_replace(array('%p', '%r'),
array($project->shortname, $this->scm_id),
$conf->getVal('webhook_url', ''));
// trigger a POST instead of the standard PUT if we're asked for
$method = 'PUT';
if (Pluf::f('webhook_processing', '') === 'compat') {
$method = 'POST';
}
$payload = array('to_send' => array(
'project' => $project->shortname,
'rev' => $this->scm_id,
@@ -299,7 +305,7 @@ class IDF_Commit extends Pluf_Model
'project_id' => $project->id,
'authkey' => $project->getWebHookKey(),
'url' => $url,
'method' => 'POST',
'method' => $method,
);
$item = new IDF_Queue();
$item->type = 'new_commit';