KGB-PROTOCOL(7p) | User Contributed Perl Documentation | KGB-PROTOCOL(7p) |
KGB_protocol - specification of the client-server communication protocol
The protocol used by the KGB collaboration service is based on JSON-RPC (<http://json-rpc.org/>).
KGB service helps collaboration by relaying notifications about commits in a version control system to IRC. It consists of client, hooked to the version control system which sends information about changes to the server, and a server, listening for client's notifications and relaying them on configured IRC channels.
Message content is authenticated by using two HTTP headers. The X-KGB-Project header must contain the project ID, as defined in server's configuration. The X-KGB-Auth header must contain a SHA1 hash (in hexadecimal notation) calculated over the shared secret, the project ID and the JSON-encoded message.
Upon receiving the HTTP request the server calculates the hash using the supplied project ID, the server copy of the shared secret for that project and the content of the HTTP request. If the hash matches the one provided in the X-KGB-Auth header, the authentication succeeds and the request is processed. Otherwise an error is returned.
This method takes information about a single commit and relays it to IRC. arguments is a map with the members described below. Any additional members are ignored.
This method takes only one string argument which is the message to relay to IRC. There are no restrictions or requirements to the message content, which is relayed verbatim to project's IRC channels.
Errors reported on HTTP level
Authentication errors use HTTP code 401, while other errors -- bad or missing headers and problems with the JSON data use HTTP code 400.
The error text is in the reason phrase of the HTTP status line (see RFC 2616, section 6.1).
Errors reported on JSON-RPC level
After successful authentication and decoding of the JSON request, all the errors are reported as mandated by the JSON-RPC specification.
Copyright (C) 2012 Damyan Ivanov
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2022-10-15 | perl v5.34.0 |