mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
dirmngr: Allow use of http.c if USE_NPTH is not defined.
* dirmngr/http.c (send_request): Always set the gnutls pull/push functions. (my_npth_read): Rename to ... (my_gnutls_read) .. this. Use system read if !USE_NPTH. (my_npth_write): Rename to ... (my_gnutls_write) .. this. Use system write if !USE_NPTH. -- This is necessary to run t-http because we once switched to a ref counted object with the socket descriptor. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
6fafda979d
commit
b6af3377e1
@ -400,20 +400,28 @@ _my_socket_unref (int lnr, my_socket_t so,
|
|||||||
#define my_socket_unref(a,b,c) _my_socket_unref (__LINE__,(a),(b),(c))
|
#define my_socket_unref(a,b,c) _my_socket_unref (__LINE__,(a),(b),(c))
|
||||||
|
|
||||||
|
|
||||||
#if defined (USE_NPTH) && defined(HTTP_USE_GNUTLS)
|
#ifdef HTTP_USE_GNUTLS
|
||||||
static ssize_t
|
static ssize_t
|
||||||
my_npth_read (gnutls_transport_ptr_t ptr, void *buffer, size_t size)
|
my_gnutls_read (gnutls_transport_ptr_t ptr, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
my_socket_t sock = ptr;
|
my_socket_t sock = ptr;
|
||||||
|
#if USE_NPTH
|
||||||
return npth_read (sock->fd, buffer, size);
|
return npth_read (sock->fd, buffer, size);
|
||||||
|
#else
|
||||||
|
return read (sock->fd, buffer, size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
my_npth_write (gnutls_transport_ptr_t ptr, const void *buffer, size_t size)
|
my_gnutls_write (gnutls_transport_ptr_t ptr, const void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
my_socket_t sock = ptr;
|
my_socket_t sock = ptr;
|
||||||
|
#if USE_NPTH
|
||||||
return npth_write (sock->fd, buffer, size);
|
return npth_write (sock->fd, buffer, size);
|
||||||
|
#else
|
||||||
|
return write (sock->fd, buffer, size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /*USE_NPTH && HTTP_USE_GNUTLS*/
|
#endif /*HTTP_USE_GNUTLS*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1641,12 +1649,10 @@ send_request (http_t hd, const char *httphost, const char *auth,
|
|||||||
|
|
||||||
my_socket_ref (hd->sock);
|
my_socket_ref (hd->sock);
|
||||||
gnutls_transport_set_ptr (hd->session->tls_session, hd->sock);
|
gnutls_transport_set_ptr (hd->session->tls_session, hd->sock);
|
||||||
#ifdef USE_NPTH
|
|
||||||
gnutls_transport_set_pull_function (hd->session->tls_session,
|
gnutls_transport_set_pull_function (hd->session->tls_session,
|
||||||
my_npth_read);
|
my_gnutls_read);
|
||||||
gnutls_transport_set_push_function (hd->session->tls_session,
|
gnutls_transport_set_push_function (hd->session->tls_session,
|
||||||
my_npth_write);
|
my_gnutls_write);
|
||||||
#endif
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user