Mercurial > hg
view contrib/chg/hgclient.h @ 37558:8a73132214a3
httppeer: support protocol upgrade
With the new handshake defined and in place on the server, we can
now implement it on the client.
The HTTP handshake mechanism has been taught to add headers advertising
its support for the new capabilities response. Response handling
has been adjusted to allow CBOR responses through. And makepeer()
has been taught to instantiate a mutually supported peer.
The HTTPv2 peer class doesn't implement the full peer interface. So
HTTPv2 is not yet usable as a peer.
Like the server side, we support registering handlers for
different API services. This allows extensions to easily implement
API services and peers. A practical use case for this is to
provide a previous implementation of the experimental version 2
wire protocol to a future version of Mercurial. We know there will
be BC breaks after 4.6 ships. But someone could take the peer and
server code from 4.6, drop it in an extension, and allow its use
indefinitely.
Differential Revision: https://phab.mercurial-scm.org/D3243
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 10 Apr 2018 18:16:47 -0700 |
parents | 9724f54923ec |
children |
line wrap: on
line source
/* * A command server client that uses Unix domain socket * * Copyright (c) 2011 Yuya Nishihara <yuya@tcha.org> * * This software may be used and distributed according to the terms of the * GNU General Public License version 2 or any later version. */ #ifndef HGCLIENT_H_ #define HGCLIENT_H_ #include <sys/types.h> struct hgclient_tag_; typedef struct hgclient_tag_ hgclient_t; hgclient_t *hgc_open(const char *sockname); void hgc_close(hgclient_t *hgc); pid_t hgc_peerpgid(const hgclient_t *hgc); pid_t hgc_peerpid(const hgclient_t *hgc); const char **hgc_validate(hgclient_t *hgc, const char *const args[], size_t argsize); int hgc_runcommand(hgclient_t *hgc, const char *const args[], size_t argsize); void hgc_attachio(hgclient_t *hgc); void hgc_setenv(hgclient_t *hgc, const char *const envp[]); #endif /* HGCLIENT_H_ */