gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch stable updated (105555b4 -> 6096c13


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch stable updated (105555b4 -> 6096c138)
Date: Fri, 24 May 2019 18:18:02 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a change to branch stable
in repository exchange.

    from 105555b4 Merge branch 'master' of git.taler.net:exchange
     add 39263a48 fix #5716
     add 3f9aafdc doc fixes in format and typos.
     add b8a718f8 Remove non-working curl config
     add 081280a8 Create async scopes.
     add 335f82d0 replace if with AS_IF (#5709, wip)
     add 5740f5b6 replace if with AS_IF (#5709, wip)
     add bc29ca40 replace if with AS_IF (#5709, wip)
     add 652659a8 replace if with AS_IF (#5709, wip)
     add 4b36b6c9 replace if with AS_IF (fixes #5709 for exchange)
     add 7fa67030 hack in bank-lib compression
     add 3709cded gitignore
     add 88689527 bank-lib: fix context
     add e6c1d262 Never set HTTP headers before invoking libgnunetcurl.
     add 8d34b22a Content-encoding -> Content-Encoding.
     add 95933156 Fix compression.
     add 69f1863d Compression.
     add 5f6d7064 Export compressing routine.
     add 67dd3171 using legal lib names
     add 6096c138 teah_common.h -> taler_curl_lib.h

No new revisions were added by this update.

Summary of changes:
 .gitignore                                         |   1 +
 configure.ac                                       |  49 ++++----
 doc/taler-exchange-dbinit.1                        |  78 +++++++-----
 doc/taler-exchange-httpd.1                         | 140 +++++++++++++--------
 doc/taler-exchange-keycheck.1                      |  64 ++++++----
 doc/taler-exchange-keyup.1                         |  88 +++++++------
 doc/taler-exchange-wire.1                          |  58 +++++----
 doc/taler-exchange-wirewatch.1                     |  68 +++++-----
 src/bank-lib/Makefile.am                           |   3 +-
 src/bank-lib/bank_api_admin.c                      |  63 ++++------
 src/bank-lib/bank_api_history.c                    |  14 +--
 src/bank-lib/bank_api_reject.c                     |  14 +--
 src/exchange/taler-exchange-httpd.c                | 112 ++++++++++++++---
 src/exchange/taler-exchange-httpd_parsing.c        |  18 +--
 src/exchangedb/plugin_exchangedb_postgres.c        |  12 +-
 src/include/Makefile.am                            |   3 +-
 .../teah_common.h => include/taler_curl_lib.h}     |  12 +-
 src/lib/Makefile.am                                |   4 +-
 src/lib/auditor_api_curl_defaults.c                |  27 +---
 src/lib/auditor_api_deposit_confirmation.c         |   4 +-
 src/lib/auditor_api_handle.c                       |   6 -
 src/lib/auditor_api_handle.h                       |   2 +-
 src/lib/exchange_api_curl_defaults.c               |   5 -
 src/lib/exchange_api_deposit.c                     |  14 +--
 src/lib/exchange_api_handle.c                      |   8 +-
 src/lib/exchange_api_handle.h                      |   2 +-
 src/lib/exchange_api_payback.c                     |  14 +--
 src/lib/exchange_api_refresh.c                     |  28 ++---
 src/lib/exchange_api_refund.c                      |  14 +--
 src/lib/exchange_api_reserve.c                     |  14 +--
 src/lib/exchange_api_track_transaction.c           |  14 +--
 src/lib/teah_common.c                              |  16 ++-
 src/lib/testing_api_loop.c                         |   1 +
 33 files changed, 545 insertions(+), 425 deletions(-)
 rename src/{lib/teah_common.h => include/taler_curl_lib.h} (87%)

diff --git a/.gitignore b/.gitignore
index 6f7a0258..ac8018a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
 *app.info
 *.gcno
 *.gcda
+.dirstamp
 doc/coverage/
 doc/taler-exchange.cps
 aclocal.m4
diff --git a/configure.ac b/configure.ac
index 3c1d9dd3..263e2655 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,11 +31,11 @@ AC_CONFIG_MACRO_DIR([m4])
 LT_INIT
 
 DX_INIT_DOXYGEN([taler-exchange],,,
-DX_PS_FEATURE(OFF),
-DX_PDF_FEATURE(OFF),
-DX_RTF_FEATURE(OFF),
-DX_CHI_FEATURE(OFF),
-DX_XML_FEATURE(OFF))
+ DX_PS_FEATURE(OFF),
+ DX_PDF_FEATURE(OFF),
+ DX_RTF_FEATURE(OFF),
+ DX_CHI_FEATURE(OFF),
+ DX_XML_FEATURE(OFF))
 
 AC_MSG_CHECKING([whether to compile documentation ONLY])
 AC_ARG_ENABLE([only-doc],
@@ -45,8 +45,9 @@ AC_ARG_ENABLE([only-doc],
 AC_MSG_RESULT($doc_only)
 AM_CONDITIONAL([DOC_ONLY], [test "x$doc_only" = "xyes"])
 
-if test "$doc_only" != yes
-then
+
+# Not indented, as most of the file falls under this one...
+AS_IF([test "x$doc_only" != xyes],[
 
 # Checks for programs.
 
@@ -122,8 +123,7 @@ fd = epoll_create1(EPOLL_CLOEXEC);]])],
     AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 
function.])]))
 
 
-if test "$wallet_only" != yes
-then
+AS_IF([test "x$wallet_only" != xyes],[
 
 
 # Check for GNUnet's libgnunetutil.
@@ -190,15 +190,15 @@ LIBS_SAVE=$LIBS
 LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0)
 LIBCURL_CHECK_CONFIG(,7.34.0,[curl=1],[curl=0])
 
-if test "x$curl" = x1
-then
+AS_IF([test "x$curl" = x1],[
  AC_CHECK_HEADER([curl/curl.h],
   AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=1],[curl=0],[[#include 
<curl/curl.h>]]),
   [curl=0])
  # need libcurl-gnutls.so, everything else is not acceptable
  AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],,[curl=0])
  # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
-fi
+])
+
 
 # libcurl and libgnurl should be mutually exclusive
 AS_IF([test "$gnurl" = 1],
@@ -323,11 +323,12 @@ AS_IF([test $jansson = 0],
 
 # test for postgres
 AX_LIB_POSTGRESQL([9.3])
-if test "$found_postgresql" = "yes"; then
-  postgres=true
-fi
+AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true])
+
 
-else
+# true clause: test wallet-only set to false
+],[
+# false clause: for test wallet-only set to true
 
 # Check for GNUnet's libgnunetutil_taler_wallet.
 
@@ -371,7 +372,7 @@ LIBS=$LIBS_SAVE
 
 
 # end of wallet/no-wallet specific logic
-fi
+])
 
 TALER_LIB_LDFLAGS="-export-dynamic -no-undefined"
 TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
@@ -432,21 +433,18 @@ AC_DEFINE_UNQUOTED([HAVE_DEVELOPER],[$enable_dev],[1 if 
developer logic is enabl
 # -D_FORTIFY_SOURCE=2 -fstack-protector-all
 AC_ARG_ENABLE(gcc-hardening,
    AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
-[if test x$enableval = xyes; then
+[AS_IF([test x$enableval = xyes],[
     CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 
-fstack-protector-all"
     CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
     CFLAGS="$CFLAGS --param ssp-buffer-size=1"
-    LDFLAGS="$LDFLAGS -pie"
-fi])
+    LDFLAGS="$LDFLAGS -pie"])])
 
 
 # Linker hardening options
 # Currently these options are ELF specific - you can't use this with MacOSX
 AC_ARG_ENABLE(linker-hardening,
   AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
-[if test x$enableval = xyes; then
-   LDFLAGS="$LDFLAGS -z relro -z now"
-fi])
+  [AS_IF([test x$enableval = xyes],[LDFLAGS="$LDFLAGS -z relro -z now"])])
 
 
 # logging
@@ -514,7 +512,8 @@ test "x$enable_doc" = "xno" || enable_doc=yes
 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"])
 
 
-else
+],[  # This is the big test "$doc_only" on top of the file!
+
 
 # logic if doc_only is set, make sure conditionals are still defined
 AM_CONDITIONAL([HAVE_EXPENSIVE_TESTS], [false])
@@ -529,7 +528,7 @@ AM_CONDITIONAL([ENABLE_DOC], [true])
 AM_CONDITIONAL([HAVE_TWISTER], [false])
 
 # end of 'doc_only'
-fi
+])
 
 AC_CONFIG_FILES([Makefile
                  doc/Makefile
diff --git a/doc/taler-exchange-dbinit.1 b/doc/taler-exchange-dbinit.1
index a1559959..c534b01e 100644
--- a/doc/taler-exchange-dbinit.1
+++ b/doc/taler-exchange-dbinit.1
@@ -1,35 +1,47 @@
-.TH TALER\-EXCHANGE\-DBINIT 1 "May 31, 2016" "GNU Taler"
-
-.SH NAME
-taler\-exchange\-dbinit \- Initialize Taler exchange database.
-
-.SH SYNOPSIS
-.B taler\-exchange\-dbinit
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-\fBtaler\-exchange\-dbinit\fP is a command line tool to initialize the Taler 
exchange database.  It creates the necessary tables and indices for the Taler 
exchange to operate.
-
-.SH OPTIONS
-.B
-.IP "\-d DIRNAME,  \-\-exchange-dir=DIRNAME"
-Use the configuration and other resources for the exchange to operate from 
DIRNAME.
-.B
-.IP "\-h, \-\-help"
+.Dd May 31, 2016
+.Dt TALER-EXCHANGE-DBINIT 1
+.Os
+.Sh NAME
+.Nm taler-exchange-dbinit
+.Nd Initialize Taler exchange database.
+.Sh SYNOPSIS
+.Nm
+.Op Fl d Ar DIRNAME | Fl -exchange-dir= Ns Ar DIRNAME
+.Op Fl h | -help
+.Op Fl g | -gc
+.Op Fl r | -reset
+.Op Fl v | -version
+.Sh DESCRIPTION
+.Nm
+is a command line tool to initialize the Taler exchange database.
+It creates the necessary tables and indices for the Taler exchange
+to operate.
+.Pp
+Its options are as follows:
+.Bl -tag -width indent
+.It Fl d Ar DIRNAME | Fl -exchange-dir= Ns Ar DIRNAME
+Use the configuration and other resources for the exchange to
+operate from
+.Ar DIRNAME .
+.It Fl h | -help
 Print short help on options.
-.B
-.IP "\-g, \-\-gc"
-Garbage collect database.  Deletes all unnecessary data in the database.
-.B
-.IP "\-r, \-\-reset"
-Drop tables. Dangerous, will delete all existing data in the database before 
creating the tables.
-.B
-.IP "\-v, \-\-version"
+.It Fl g | -gc
+Garbage collect database.
+Deletes all unnecessary data in the database.
+.It Fl r | -reset
+Drop tables.
+Dangerous, will delete all existing data in the database before
+creating the tables.
+.It Fl v | -version
 Print version information.
-
-.SH BUGS
-Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending 
electronic mail to <address@hidden>
-
-.SH "SEE ALSO"
-\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), 
\fBtaler\-exchange\-reservemod\fP(1), \fBtaler.conf\fP(5)
+.El
+.Sh SEE ALSO
+.Xr taler-exchange-httpd 1 ,
+.Xr taler-exchange-keyup 1 ,
+.Xr taler-exchange-reservemod 1 ,
+.Xr taler.conf 5 .
+.Sh BUGS
+Report bugs by using
+.Lk https://bugs.gnunet.org
+or by sending electronic mail to
+.Aq Mt address@hidden .
diff --git a/doc/taler-exchange-httpd.1 b/doc/taler-exchange-httpd.1
index 0db57138..9cb178ab 100644
--- a/doc/taler-exchange-httpd.1
+++ b/doc/taler-exchange-httpd.1
@@ -1,56 +1,92 @@
-.TH TALER\-EXCHANGE\-HTTPD 1 "Apr 22, 2015" "GNU Taler"
-
-.SH NAME
-taler\-exchange\-httpd \- Run Taler exchange (with RESTful API)
-
-.SH SYNOPSIS
-.B taler\-exchange\-httpd
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-\fBtaler\-exchange\-httpd\fP is a command line tool to run the Taler exchange 
(HTTP server).  The required configuration, keys and database must exist before 
running this command.
-
-.SH OPTIONS
-.B
-.IP "\-C,  \-\-connection-close"
-Force each HTTP connection to be closed after each request (useful in 
combination with \-f to avoid having to wait for nc to time out).
-.B
-.IP "\-c FILENAME,  \-\-config=FILENAME"
-Use the configuration and other resources for the merchant to operate from 
FILENAME.
-.B
-.IP "\-h, \-\-help"
+.Dd April 22, 2015
+.Dt TALER-EXCHANGE-HTTPD 1
+.Os
+.Sh NAME
+.Nm taler-exchange-httpd
+.Nd Run Taler exchange (with RESTful API)
+.Sh SYNOPSIS
+.Nm
+.Op Fl C | -connection-close
+.Op Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME
+.Op Fl f Ar FILENAME | Fl -file-input= Ns Ar FILENAME
+.Op Fl h | -help
+.Op Fl i | -init-db
+.Op Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL
+.Op Fl t Ar SECONDS | Fl -timeout= Ns Ar SECONDS
+.Op Fl v | -version
+.Sh DESCRIPTION
+.Nm
+is a command line tool to run the Taler exchange (HTTP server).
+The required configuration, keys and database must exist before
+running this command.
+.Pp
+Its options are as follows:
+.Bl -tag -width indent
+.It Fl C | -connection-close
+Force each HTTP connection to be closed after each request (useful
+in combination with
+.Fl f
+to avoid having to wait for nc to time out).
+.It Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME
+Use the configuration and other resources for the merchant to operate
+from FILENAME.
+.It Fl h | -help
 Print short help on options.
-.B
-.IP "\-i, \-\-init-db"
+.It Fl i | -init-db
 Initialize the database by creating tables and indices if necessary.
-.B
-.IP "\-v, \-\-version"
+.It Fl v | -version
 Print version information.
-.B
-.IP "\-f FILENAME, \-\-file\-input=FILENAME"
-This option is only available if the exchange was compiled with the configure 
option
-\-\-enable\-developer\-mode.  It is used for generating test cases against the 
exchange using AFL.  When this option is present, the HTTP server will (1) 
terminate after the first client's HTTP connection is completed, and (2) 
automatically start such a client using a helper process based on the 'nc' or 
'ncat' binary using FILENAME as the standard input to the helper process.  As a 
result, the process will effectively run with FILENAME as the input from an 
HTTP client and then immediatel [...]
-.B
-.IP "\-t SECONDS, \-\-timeout=SECONDS"
-Specifies the number of SECONDS after which the HTTPD should close (idle) HTTP 
connections.
-.B
-.IP "\-L LOGLEVEL, \-\-loglevel=LOGLEVEL"
-Specifies the log level to use.  Accepted values are: DEBUG, INFO, WARNING, 
ERROR.
-
-.SH SIGNALS
-.B
-.IP SIGUSR1
-Sending a SIGUSR1 to the process will cause it to reload denomination and 
signing keys.
-.B
-.IP SIGTERM
+.It Fl f Ar FILENAME | Fl -file-input= Ns Ar FILENAME
+This option is only available if the exchange was compiled with the
+configure option --enable-developer-mode.
+It is used for generating test cases against the exchange using AFL.
+When this option is present, the HTTP server will
+.Bl -enum -offset indent -compact
+.It
+terminate after the first client's HTTP connection is completed, and
+.It
+automatically start such a client using a helper process based on the
+.Xr nc 1
+or
+.Xr ncat 1
+binary using FILENAME as the standard input to the helper process.
+.El
+As a result, the process will effectively run with
+.Ar FILENAME
+as the input from an HTTP client and then immediately exit.
+This is useful to test taler-exchange-httpd against many different
+possible inputs in a controlled way.
+.It Fl t Ar SECONDS | Fl -timeout= Ns Ar SECONDS
+Specifies the number of SECONDS after which the HTTPD should
+close (idle) HTTP connections.
+.It Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL
+Specifies the log level to use.
+Accepted values are: DEBUG, INFO, WARNING, ERROR.
+.El
+.Sh SIGNALS
+.Nm
+responds to the following signals:
+.Bl -tag -width indent
+.It Dv SIGUSR1
+Sending a SIGUSR1 to the process will cause it to reload denomination
+and signing keys.
+.It Dv SIGTERM
 Sending a SIGTERM to the process will cause it to shutdown cleanly.
-.B
-.IP SIGHUP
-Sending a SIGHUP to the process will cause it to re-execute the 
taler\-exchange\-httpd binary in the PATH, passing it the existing listen 
socket. Then the old server process will automatically exit after it is done 
handling existing client connections; the new server process will accept and 
handle new client connections.
-
-.SH BUGS
-Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending 
electronic mail to <address@hidden>
-
-.SH "SEE ALSO"
-\fBtaler\-exchange\-dbinit\fP(1), \fBtaler\-exchange\-keyup\fP(1), 
\fBtaler\-exchange\-reservemod\fP(1), \fBtaler.conf\fP(5)
+.It Dv SIGHUP
+Sending a SIGHUP to the process will cause it to re-execute the
+taler-exchange-httpd binary in the PATH, passing it the existing
+listen socket.
+Then the old server process will automatically exit after it is done
+handling existing client connections; the new server process will
+accept and handle new client connections.
+.El
+.Sh SEE ALSO
+.Xr taler-exchange-dbinit 1 ,
+.Xr taler-exchange-keyup 1 ,
+.Xr taler-exchange-reservemod 1 ,
+.Xr taler.conf 5 .
+.Sh BUGS
+Report bugs by using
+.Lk https://gnunet.org/bugs
+or by sending electronic mail to
+.Aq Mt address@hidden .
diff --git a/doc/taler-exchange-keycheck.1 b/doc/taler-exchange-keycheck.1
index 3f338233..ca97c3da 100644
--- a/doc/taler-exchange-keycheck.1
+++ b/doc/taler-exchange-keycheck.1
@@ -1,29 +1,39 @@
-.TH TALER\-EXCHANGE\-KEYCHECK 1 "Apr 22, 2015" "GNU Taler"
-
-.SH NAME
-taler\-exchange\-keycheck \- Check validity of Taler signing and denomination 
keys.
-
-.SH SYNOPSIS
-.B taler\-exchange\-keycheck
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-\fBtaler\-exchange\-keycheck\fP can be used to check if the signing and 
denomination keys in the operation directory are well-formed. This can be 
useful after importing fresh keys from the offline system to ensure that the 
files are correct.
-
-.SH OPTIONS
-.B
-.IP "\-d DIRNAME,  \-\-exchange-dir=DIRNAME"
-Use the configuration and other resources for the exchange to operate from 
DIRNAME.
-.B
-.IP "\-h, \-\-help"
+.Dd April 22, 2015
+.Dt TALER-EXCHANGE-KEYCHECK 1
+.Os
+.Sh NAME
+.Nm taler\-exchange\-keycheck
+.Nd check validity of Taler signing and denomination keys
+.Sh SYNOPSIS
+.Nm
+.Op Fl d Ar DIRNAME | Fl -exchange-dir= Ns Ar DIRNAME
+.Op Fl h | -help
+.Op Fl v | -version
+.Sh DESCRIPTION
+.Nm
+can be used to check if the signing and denomination keys in the
+operation directory are well-formed.
+This can be useful after importing fresh keys from the
+offline system to ensure that the files are correct.
+.Pp
+Its options are as follows:
+.Bl -tag -width indent
+.It Fl d Ar DIRNAME | Fl -exchange-dir= Ns Ar DIRNAME
+Use the configuration and other resources for the exchange
+to operate from
+.Ar DIRNAME .
+.It Fl h | -help
 Print short help on options.
-.B
-.IP "\-v, \-\-version"
+.It Fl v | -version
 Print version information.
-
-.SH BUGS
-Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending 
electronic mail to <address@hidden>
-
-.SH "SEE ALSO"
-\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), 
\fBtaler\-exchange\-dbinit\fP(1), \fBtaler.conf\fP(5)
+.El
+.Sh SEE ALSO
+.Xr taler-exchange-httpd 1 ,
+.Xr taler-exchange-keyup 1 ,
+.Xr taler-exchange-dbinit 1 ,
+.Xr taler.conf 5 .
+.Sh BUGS
+Report bugs by using
+.Lk https://gnunet.org/bugs/
+or by sending electronic mail to
+.Aq Mt address@hidden .
diff --git a/doc/taler-exchange-keyup.1 b/doc/taler-exchange-keyup.1
index 7859d8a8..61cca2fe 100644
--- a/doc/taler-exchange-keyup.1
+++ b/doc/taler-exchange-keyup.1
@@ -1,41 +1,55 @@
-.TH TALER\-EXCHANGE\-KEYUP 1 "Apr 7, 2017" "GNU Taler"
-
-.SH NAME
-taler\-exchange\-keyup \- Setup Taler exchange denomination and signing keys.
-
-.SH SYNOPSIS
-.B taler\-exchange\-keyup
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-\fBtaler\-exchange\-keyup\fP is a command line tool to setup Taler 
denomination and signing keys.  This tool requires access to the exchange's 
long-term offline signing key and should be run in a secure (offline) 
environment under strict controls. The resulting keys can then be copied to the 
main online directory where the Taler HTTP server operates.
-
-.SH OPTIONS
-.B
-.IP "\-d DIRNAME,  \-\-exchange-dir=DIRNAME"
-Use the configuration and other resources for the exchange to operate from 
DIRNAME.
-.B
-.IP "\-h, \-\-help"
+.Dd April 7, 2017
+.Dt TALER\-EXCHANGE\-KEYUP 1
+.Os
+.Sh NAME
+.Nm taler\-exchange\-keyup
+.Nd setup Taler exchange denomination and signing keys
+.Sh SYNOPSIS
+.Nm
+.Op Fl d Ar DIRNAME | Fl -exchange-dir= Ns Ar DIRNAME
+.Op Fl h | -help
+.Op Fl m Ar FILE | Fl -master-key= Ns Ar FILE
+.Op Fl o Ar FILE | Fl -output= Ns Ar FILE
+.Op Fl r Ar DKH | Fl -revoke= Ns Ar DKH
+.Op Fl t Ar TIMESTAMP | Fl -time= Ns Ar TIMESTAMP
+.Op Fl v | -version
+.Sh DESCRIPTION
+.Nm
+is a command line tool to setup Taler denomination and signing keys.
+This tool requires access to the exchange's long-term offline signing
+key and should be run in a secure (offline) environment under strict
+controls.
+The resulting keys can then be copied to the main online directory
+where the Taler HTTP server operates.
+.Pp
+Its options are as follows:
+.Bl -tag -width indent
+.It Fl d Ar DIRNAME | Fl -exchange-dir= Ns Ar DIRNAME
+Use the configuration and other resources for the exchange to
+operate from
+.Ar DIRNAME .
+.It Fl h | -help
 Print short help on options.
-.B
-.IP "\-m FILE,  \-\-master-key=FILE"
+.It Fl m Ar FILE | Fl -master-key= Ns Ar FILE
 Location of the private EdDSA offline master key of the exchange.
-.B
-.IP "\-o FILE,  \-\-ouptut=FILE"
-Where to write a denomination key signing request file to be given to the 
auditor.
-.B
-.IP "\-r DKH,  \-\-revoke=DKH"
+.It Fl o Ar FILE | Fl -output= Ns Ar FILE
+Where to write a denomination key signing request file to be given
+to the auditor.
+.It Fl r Ar DKH | Fl -revoke= Ns Ar DKH
 Revoke the denomination key where the denomination public key's hash is DKH.
-.B
-.IP "\-t TIMESTAMP,  \-\-time=TIMESTAMP"
-Operate as if the current time was TIMESTAMP.
-.B
-.IP "\-v, \-\-version"
+.It Fl t Ar TIMESTAMP | Fl -time= Ns Ar TIMESTAMP
+Operate as if the current time was
+.Ar TIMESTAMP .
+.It Fl v | -version
 Print version information.
-
-.SH BUGS
-Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending 
electronic mail to <address@hidden>
-
-.SH "SEE ALSO"
-\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), 
\fBtaler\-exchange\-keycheck\fP(1), \fBtaler.conf\fP(5)
+.El
+.Sh SEE ALSO
+.Xr taler-exchange-httpd 1 ,
+.Xr taler-exchange-keyup 1 ,
+.Xr taler-exchange-keycheck 1 ,
+.Xr taler.conf 5 .
+.Sh BUGS
+Report bugs by using
+.Lk https://gnunet.org/bugs/
+or by sending electronic mail to
+.Aq Mt address@hidden .
diff --git a/doc/taler-exchange-wire.1 b/doc/taler-exchange-wire.1
index 256daab7..d4970446 100644
--- a/doc/taler-exchange-wire.1
+++ b/doc/taler-exchange-wire.1
@@ -1,28 +1,34 @@
-.TH TALER\-EXCHANGE\-WIRE 1 "Mar 18, 2018" "GNU Taler"
-
-.SH NAME
-taler\-exchange\-wire \- Create the master-key signed responses to /wire.
-
-.SH SYNOPSIS
-.B taler\-exchange\-wire
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-\fBtaler\-exchange\-wire\fP is used to create the exchange's reply to a /wire 
request.  It converts the bank details into the appropriate signed response.  
This needs to be done using the long-term offline master key.
-
-.SH OPTIONS
-.B
-.IP "\-m MASTERKEYFILE,  \-\-master=MASTERKEYFILE"
-Specifies the name of the file containing the exchange's master key.
-.IP "\-h, \-\-help"
+.Dd March 18, 2018
+.Dt TALER-EXCHANGE-WIRE 1
+.Os
+.Sh NAME
+.Nm taler-exchange-wire
+.Nd create the master-key signed responses to /wire
+.Sh SYNOPSIS
+.Nm
+.Op Fl h | -help
+.Op Fl m Ar MASTERKEYFILE | Fl -master= Ns Ar MASTERKEYFILE
+.Op Fl v | -version
+.Sh DESCRIPTION
+.Nm
+is used to create the exchange's reply to a /wire request.
+It converts the bank details into the appropriate signed response.
+This needs to be done using the long-term offline master key.
+.Pp
+Its options are as follows:
+.Bl -tag -width indent
+.It Fl h | -help
 Print short help on options.
-.B
-.IP "\-v, \-\-version"
+.It Fl m Ar MASTERKEYFILE | Fl -master= Ns Ar MASTERKEYFILE
+Specifies the name of the file containing the exchange's master key.
+.It Fl v | -version
 Print version information.
-
-.SH BUGS
-Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending 
electronic mail to <address@hidden>
-
-.SH "SEE ALSO"
-\fBtaler\-exchange\-httpd\fP(1), \fBtaler.conf\fP(5)
+.El
+.Sh SEE ALSO
+.Xr taler-exchange-httpd 1 ,
+.Xr taler.conf 5 .
+.Sh BUGS
+Report bugs by using
+.Lk https://gnunet.org/bugs/
+or by sending electronic mail to
+.Aq Mt address@hidden .
diff --git a/doc/taler-exchange-wirewatch.1 b/doc/taler-exchange-wirewatch.1
index 9b030ab3..447e1217 100644
--- a/doc/taler-exchange-wirewatch.1
+++ b/doc/taler-exchange-wirewatch.1
@@ -1,35 +1,41 @@
-.TH TALER\-EXCHANGE\-WIREWATCH 1 "May 5, 2017" "GNU Taler"
-
-.SH NAME
-taler\-exchange\-wirewatch \- Watch for incoming wire transfers
-
-.SH SYNOPSIS
-.B taler\-exchange\-wirewatch
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-\fBtaler\-exchange\-wirewatch\fP is a command line tool to import wire 
transactions into the Taler exchange database.
-
-.SH OPTIONS
-.B
-.IP "\-t PLUGINNAME,  \-\-type=PLUGINNAME"
+.Dd May 5, 2017
+.Dt TALER-EXCHANGE-WIREWATCH 1
+.Os
+.Sh NAME
+.Nm taler-exchange-wirewatch
+.Nd watch for incoming wire transfers
+.Sh SYNOPSIS
+.Nm
+.Op Fl t Ar PLUGINNAME | Fl -type= Ns Ar PLUGINNAME
+.Op Fl h | -help
+.Op Fl T | -test
+.Op Fl r | -reset
+.Op Fl v | -version
+.Sh DESCRIPTION
+.Nm
+is a command line tool to import wire transactions into the
+Taler exchange database.
+.Pp
+Its options are as follows:
+.Bl -tag -width indent
+.It Fl t Ar PLUGINNAME | Fl -type= Ns Ar PLUGINNAME
 Use the specified wire plugin and its configuration to talk to the bank.
-.B
-.IP "\-h, \-\-help"
+.It Fl h | -help
 Print short help on options.
-.B
-.IP "\-T,  \-\-test"
+.It Fl T | -test
 Run in test mode and exit when idle.
-.B
-.IP "\-r,  \-\-reset"
-Ignore our own database and start with transactions from the beginning of time.
-.B
-.IP "\-v, \-\-version"
+.It Fl r | -reset
+Ignore our own database and start with transactions
+from the beginning of time.
+.It Fl v | -version
 Print version information.
-.B
-.SH BUGS
-Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending 
electronic mail to <address@hidden>
-
-.SH "SEE ALSO"
-\fBtaler\-exchange\-aggregator\fP(1), \fBtaler\-exchange\-httpd\fP(1), 
\fBtaler.conf\fP(5)
+.El
+.Sh SEE ALSO
+.Xr taler-exchange-aggregator 1 ,
+.Xr taler-exchange-httpd 1 ,
+.Xr taler.conf 5 .
+.Sh BUGS
+Report bugs by using
+.Lk https://gnunet.org/bugs/
+or by sending electronic mail to
+.Aq Mt address@hidden .
diff --git a/src/bank-lib/Makefile.am b/src/bank-lib/Makefile.am
index 0858efb3..2678884b 100644
--- a/src/bank-lib/Makefile.am
+++ b/src/bank-lib/Makefile.am
@@ -42,7 +42,8 @@ libtalerbank_la_SOURCES = \
   bank_api_common.c bank_api_common.h \
   bank_api_history.c \
   bank_api_reject.c \
-  bank_api_parse.c
+  bank_api_parse.c \
+  ../lib/teah_common.c # FIXME: ugly hack!!
 
 libtalerbank_la_LIBADD = \
   $(top_builddir)/src/json/libtalerjson.la \
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index 8eff229f..a70eb0ea 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -23,6 +23,8 @@
 #include "bank_api_common.h"
 #include <microhttpd.h> /* just for HTTP status codes */
 #include "taler_signatures.h"
+// FIXME(dold): temporary hack
+#include "taler_curl_lib.h"
 
 
 /**
@@ -37,9 +39,9 @@ struct TALER_BANK_AdminAddIncomingHandle
   char *request_url;
 
   /**
-   * JSON encoding of the request to POST.
+   * POST context.
    */
-  char *json_enc;
+  struct TEAH_PostContext post_ctx;
 
   /**
    * Handle for the request.
@@ -47,11 +49,6 @@ struct TALER_BANK_AdminAddIncomingHandle
   struct GNUNET_CURL_Job *job;
 
   /**
-   * HTTP authentication-related headers for the request.
-   */
-  struct curl_slist *authh;
-
-  /**
    * Function to call with the result.
    */
   TALER_BANK_AdminAddIncomingResultCallback cb;
@@ -215,45 +212,30 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context 
*ctx,
   aai->cb_cls = res_cb_cls;
   aai->request_url = TALER_BANK_path_to_url_ (bank_base_url,
                                               "/admin/add/incoming");
-  aai->authh = TALER_BANK_make_auth_header_ (auth);
-  /* Append content type header here, can't do it in GNUNET_CURL_job_add
-     as that would override the CURLOPT_HTTPHEADER instead of appending. */
-  {
-    struct curl_slist *ext;
+  aai->post_ctx.headers = TALER_BANK_make_auth_header_ (auth);
+
+  GNUNET_assert
+    (NULL != (aai->post_ctx.headers = curl_slist_append
+      (aai->post_ctx.headers,
+       "Content-Type: application/json")));
 
-    ext = curl_slist_append (aai->authh,
-                             "Content-Type: application/json");
-    if (NULL == ext)
-      GNUNET_break (0);
-    else
-      aai->authh = ext;
-  }
   eh = curl_easy_init ();
-  GNUNET_assert (NULL != (aai->json_enc =
-                          json_dumps (admin_obj,
-                                      JSON_COMPACT)));
+
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_curl_easy_post (&aai->post_ctx, eh, admin_obj));
+
   json_decref (admin_obj);
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_HTTPHEADER,
-                                   aai->authh));
+
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
                                    CURLOPT_URL,
                                    aai->request_url));
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_POSTFIELDS,
-                                   aai->json_enc));
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
-                                   CURLOPT_POSTFIELDSIZE,
-                                   strlen (aai->json_enc)));
-  aai->job = GNUNET_CURL_job_add (ctx,
-                                  eh,
-                                  GNUNET_NO,
-                                  &handle_admin_add_incoming_finished,
-                                  aai);
+
+  aai->job = GNUNET_CURL_job_add2 (ctx,
+                                   eh,
+                                   aai->post_ctx.headers,
+                                   &handle_admin_add_incoming_finished,
+                                   aai);
   return aai;
 }
 
@@ -272,9 +254,8 @@ TALER_BANK_admin_add_incoming_cancel (struct 
TALER_BANK_AdminAddIncomingHandle *
     GNUNET_CURL_job_cancel (aai->job);
     aai->job = NULL;
   }
-  curl_slist_free_all (aai->authh);
+  TALER_curl_easy_post_finished (&aai->post_ctx);
   GNUNET_free (aai->request_url);
-  GNUNET_free (aai->json_enc);
   GNUNET_free (aai);
 }
 
diff --git a/src/bank-lib/bank_api_history.c b/src/bank-lib/bank_api_history.c
index 5cdac917..53c381f6 100644
--- a/src/bank-lib/bank_api_history.c
+++ b/src/bank-lib/bank_api_history.c
@@ -305,17 +305,13 @@ put_history_job (struct GNUNET_CURL_Context *ctx,
   eh = curl_easy_init ();
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
-                                   CURLOPT_HTTPHEADER,
-                                   hh->authh));
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
                                    CURLOPT_URL,
                                    hh->request_url));
-  hh->job = GNUNET_CURL_job_add (ctx,
-                                 eh,
-                                 GNUNET_NO,
-                                 &handle_history_finished,
-                                 hh);
+  hh->job = GNUNET_CURL_job_add2 (ctx,
+                                  eh,
+                                  hh->authh,
+                                  &handle_history_finished,
+                                  hh);
   return hh;
 }
 
diff --git a/src/bank-lib/bank_api_reject.c b/src/bank-lib/bank_api_reject.c
index 5e7a1ac2..cfedec4c 100644
--- a/src/bank-lib/bank_api_reject.c
+++ b/src/bank-lib/bank_api_reject.c
@@ -199,10 +199,6 @@ TALER_BANK_reject (struct GNUNET_CURL_Context *ctx,
   json_decref (reject_obj);
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
-                                   CURLOPT_HTTPHEADER,
-                                   rh->authh));
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
                                    CURLOPT_URL,
                                    rh->request_url));
   GNUNET_assert (CURLE_OK ==
@@ -213,11 +209,11 @@ TALER_BANK_reject (struct GNUNET_CURL_Context *ctx,
                  curl_easy_setopt (eh,
                                    CURLOPT_POSTFIELDSIZE,
                                    strlen (rh->json_enc)));
-  rh->job = GNUNET_CURL_job_add (ctx,
-                                 eh,
-                                 GNUNET_NO,
-                                 &handle_reject_finished,
-                                 rh);
+  rh->job = GNUNET_CURL_job_add2 (ctx,
+                                  eh,
+                                  rh->authh,
+                                  &handle_reject_finished,
+                                  rh);
   return rh;
 }
 
diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index 8f86bf79..b24feef6 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -54,6 +54,24 @@
  */
 #define UNIX_BACKLOG 500
 
+
+/**
+ * Type of the closure associated with each HTTP request to the exchange.
+ */
+struct ExchangeHttpRequestClosure
+{
+  /**
+   * Async Scope ID associated with this request.
+   */
+  struct GNUNET_AsyncScopeId async_scope_id;
+
+  /**
+   * Opaque parsing context.
+   */
+  void *opaque_post_parsing_context;
+};
+
+
 /**
  * Which currency is used by this exchange?
  */
@@ -142,16 +160,38 @@ handle_mhd_completion_callback (void *cls,
                                 void **con_cls,
                                 enum MHD_RequestTerminationCode toe)
 {
-  if (NULL == *con_cls)
+  struct ExchangeHttpRequestClosure *ecls = *con_cls;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Request completed\n");
+
+  if (NULL == ecls)
     return;
-  TEH_PARSE_post_cleanup_callback (*con_cls);
+  TEH_PARSE_post_cleanup_callback (ecls->opaque_post_parsing_context);
+  GNUNET_free (ecls);
   *con_cls = NULL;
   /* check that we didn't leave any transactions hanging */
   /* NOTE: In high-performance production, we might want to
      remove this. */
   TEH_plugin->preflight (TEH_plugin->cls,
                          TEH_plugin->get_session (TEH_plugin->cls));
+}
 
+
+/**
+ * Return GNUNET_YES if given a valid correlation ID and
+ * GNUNET_NO otherwise.
+ *
+ * @returns GNUNET_YES iff given a valid correlation ID
+ */
+static int
+is_valid_correlation_id (const char *correlation_id)
+{
+  if (strlen (correlation_id) >= 64)
+    return GNUNET_NO;
+  for (int i = 0; i < strlen (correlation_id); i++)
+    if (!(isalnum (correlation_id[i]) || correlation_id[i] == '-'))
+      return GNUNET_NO;
+  return GNUNET_YES;
 }
 
 
@@ -367,10 +407,45 @@ handle_mhd_request (void *cls,
       &TEH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
     };
   struct TEH_RequestHandler *rh;
+  struct ExchangeHttpRequestClosure *ecls = *con_cls;
+  int ret;
+  void **inner_cls;
+  struct GNUNET_AsyncScopeSave old_scope;
+  const char *correlation_id = NULL;
+
+  if (NULL == ecls) {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Handling new request\n");
+    /* We're in a new async scope! */
+    ecls = *con_cls = GNUNET_new (struct ExchangeHttpRequestClosure);
+    GNUNET_async_scope_fresh (&ecls->async_scope_id);
+    /* We only read the correlation ID on the first callback for every client 
*/
+    correlation_id = MHD_lookup_connection_value (connection,
+                                                  MHD_HEADER_KIND,
+                                                  "Taler-Correlation-Id");
+    if ((NULL != correlation_id) &&
+        (GNUNET_YES != is_valid_correlation_id (correlation_id)))
+    {
+        GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "illegal incoming correlation 
ID\n");
+        correlation_id = NULL;
+    }
+  }
+
+  inner_cls = &ecls->opaque_post_parsing_context;
+
+  GNUNET_async_scope_enter (&ecls->async_scope_id, &old_scope);
+
+  if (NULL != correlation_id)
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Handling request (%s) for URL '%s', correlation_id=%s\n",
+                method,
+                url,
+                correlation_id);
+  else
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Handling request (%s) for URL '%s'\n",
+                method,
+                url);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Handling request for URL '%s'\n",
-              url);
   if (0 == strcasecmp (method,
                        MHD_HTTP_METHOD_HEAD))
     method = MHD_HTTP_METHOD_GET; /* treat HEAD as GET here, MHD will do the 
rest */
@@ -382,17 +457,24 @@ handle_mhd_request (void *cls,
          ( (NULL == rh->method) ||
            (0 == strcasecmp (method,
                              rh->method)) ) )
-      return rh->handler (rh,
-                          connection,
-                          con_cls,
-                          upload_data,
-                          upload_data_size);
+    {
+      ret = rh->handler (rh,
+                         connection,
+                         inner_cls,
+                         upload_data,
+                         upload_data_size);
+      GNUNET_async_scope_restore (&old_scope);
+      return ret;
+    }
   }
-  return TEH_MHD_handler_static_response (&h404,
-                                          connection,
-                                          con_cls,
-                                          upload_data,
-                                          upload_data_size);
+  ret = TEH_MHD_handler_static_response (&h404,
+                                         connection,
+                                         inner_cls,
+                                         upload_data,
+                                         upload_data_size);
+  GNUNET_async_scope_restore (&old_scope);
+
+  return ret;
 }
 
 
diff --git a/src/exchange/taler-exchange-httpd_parsing.c 
b/src/exchange/taler-exchange-httpd_parsing.c
index 2a9f7a5a..d1a1e9df 100644
--- a/src/exchange/taler-exchange-httpd_parsing.c
+++ b/src/exchange/taler-exchange-httpd_parsing.c
@@ -77,18 +77,20 @@ TEH_PARSE_post_json (struct MHD_Connection *connection,
                                 json);
   switch (pr)
   {
+
   case GNUNET_JSON_PR_OUT_OF_MEMORY:
-    return (MHD_NO ==
-            TEH_RESPONSE_reply_internal_error (connection,
-                                              TALER_EC_PARSER_OUT_OF_MEMORY,
-                                               "out of memory"))
-      ? GNUNET_SYSERR : GNUNET_NO;
+    return (MHD_NO == TEH_RESPONSE_reply_internal_error
+      (connection,
+       TALER_EC_PARSER_OUT_OF_MEMORY,
+       "out of memory")) ? GNUNET_SYSERR : GNUNET_NO;
+
   case GNUNET_JSON_PR_CONTINUE:
     return GNUNET_YES;
+
   case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
-    return (MHD_NO ==
-            TEH_RESPONSE_reply_request_too_large (connection))
-      ? GNUNET_SYSERR : GNUNET_NO;
+    return (MHD_NO == TEH_RESPONSE_reply_request_too_large
+      (connection)) ? GNUNET_SYSERR : GNUNET_NO;
+
   case GNUNET_JSON_PR_JSON_INVALID:
     return (MHD_YES ==
             TEH_RESPONSE_reply_invalid_json (connection))
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 9dc8eb2f..35b9aa57 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1732,12 +1732,12 @@ postgres_get_session (void *cls)
      properly use indices */
   {
     struct GNUNET_PQ_ExecuteStatement es[] = {
-      GNUNET_PQ_make_execute ("LOAD 'auto_explain';"),
-      GNUNET_PQ_make_execute ("SET auto_explain.log_min_duration=50;"),
-      GNUNET_PQ_make_execute ("SET auto_explain.log_timing=TRUE;"),
-      GNUNET_PQ_make_execute ("SET auto_explain.log_analyze=TRUE;"),
-      GNUNET_PQ_make_execute ("SET enable_sort=OFF;"),
-      GNUNET_PQ_make_execute ("SET enable_seqscan=OFF;"),
+      GNUNET_PQ_make_try_execute ("LOAD 'auto_explain';"),
+      GNUNET_PQ_make_try_execute ("SET auto_explain.log_min_duration=50;"),
+      GNUNET_PQ_make_try_execute ("SET auto_explain.log_timing=TRUE;"),
+      GNUNET_PQ_make_try_execute ("SET auto_explain.log_analyze=TRUE;"),
+      GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"),
+      GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"),
       GNUNET_PQ_EXECUTE_STATEMENT_END
     };
 
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index d06d0064..49f2b5a4 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -30,7 +30,8 @@ talerinclude_HEADERS = \
   taler_signatures.h \
   taler_wire_lib.h \
   taler_wire_plugin.h \
-  taler_testing_bank_lib.h
+  taler_testing_bank_lib.h \
+  taler_curl_lib.h
 
 endif
 
diff --git a/src/lib/teah_common.h b/src/include/taler_curl_lib.h
similarity index 87%
rename from src/lib/teah_common.h
rename to src/include/taler_curl_lib.h
index 66937a26..2d69768c 100644
--- a/src/lib/teah_common.h
+++ b/src/include/taler_curl_lib.h
@@ -17,7 +17,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/teah_common.h
+ * @file lib/taler_curl_lib.h
  * @brief Helper routines shared by libtalerexchange and libtalerauditor
  * @author Christian Grothoff
  */
@@ -30,7 +30,7 @@
 /**
  * Should we compress PUT/POST bodies with 'deflate' encoding?
  */
-#define COMPRESS_BODIES 0
+#define COMPRESS_BODIES 1
 
 /**
  * State used for #TEAL_curl_easy_post() and
@@ -43,6 +43,10 @@ struct TEAH_PostContext
    */
   char *json_enc;
 
+  /**
+   * Custom headers.
+   */
+  struct curl_slist *headers;
 };
 
 
@@ -56,7 +60,7 @@ struct TEAH_PostContext
  * @return #GNUNET_OK on success #GNUNET_SYSERR on failure
  */
 int
-TEAH_curl_easy_post (struct TEAH_PostContext *ctx,
+TALER_curl_easy_post (struct TEAH_PostContext *ctx,
                      CURL *eh,
                      const json_t *body);
 
@@ -67,7 +71,7 @@ TEAH_curl_easy_post (struct TEAH_PostContext *ctx,
  * @param ctx[in] a request context (updated)
  */
 void
-TEAH_curl_easy_post_finished (struct TEAH_PostContext *ctx);
+TALER_curl_easy_post_finished (struct TEAH_PostContext *ctx);
 
 
 
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 0aa78d7b..33d4f327 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -28,7 +28,7 @@ libtalerexchange_la_SOURCES = \
   exchange_api_track_transaction.c \
   exchange_api_track_transfer.c \
   exchange_api_wire.c \
-  teah_common.c teah_common.h
+  teah_common.c
 libtalerexchange_la_LIBADD = \
   libtalerauditor.la \
   $(top_builddir)/src/json/libtalerjson.la \
@@ -48,7 +48,7 @@ libtalerauditor_la_SOURCES = \
   auditor_api_handle.c auditor_api_handle.h \
   auditor_api_deposit_confirmation.c \
   auditor_api_exchanges.c \
-  teah_common.c teah_common.h
+  teah_common.c
 libtalerauditor_la_LIBADD = \
   $(top_builddir)/src/json/libtalerjson.la \
   $(top_builddir)/src/util/libtalerutil.la \
diff --git a/src/lib/auditor_api_curl_defaults.c 
b/src/lib/auditor_api_curl_defaults.c
index 507ae0e5..f3286ca9 100644
--- a/src/lib/auditor_api_curl_defaults.c
+++ b/src/lib/auditor_api_curl_defaults.c
@@ -33,6 +33,9 @@ CURL *
 TAL_curl_easy_get (const char *url)
 {
   CURL *eh;
+  struct GNUNET_AsyncScopeSave scope;
+
+  GNUNET_async_scope_get (&scope);
 
   eh = curl_easy_init ();
 
@@ -42,32 +45,8 @@ TAL_curl_easy_get (const char *url)
                                    url));
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
-                                   CURLOPT_ENCODING,
-                                   "deflate"));
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
                                    CURLOPT_TCP_FASTOPEN,
                                    1L));
-  {
-    /* Unfortunately libcurl needs chunk to be alive until after
-    curl_easy_perform.  To avoid manual cleanup, we keep
-    one static list here.  */
-    static struct curl_slist *chunk = NULL;
-    if (NULL == chunk)
-    {
-      /* With POST requests, we do not want to wait for the
-      "100 Continue" response, as our request bodies are usually
-      small and directy sending them saves us a round trip.
-
-      Clearing the expect header like this disables libcurl's
-      default processing of the header.
-
-      Disabling this header is safe for other HTTP methods, thus
-      we don't distinguish further before setting it.  */
-      chunk = curl_slist_append (chunk, "Expect:");
-    }
-    GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, CURLOPT_HTTPHEADER, 
chunk));
-  }
 
   return eh;
 }
diff --git a/src/lib/auditor_api_deposit_confirmation.c 
b/src/lib/auditor_api_deposit_confirmation.c
index bb637797..f26339a6 100644
--- a/src/lib/auditor_api_deposit_confirmation.c
+++ b/src/lib/auditor_api_deposit_confirmation.c
@@ -344,7 +344,7 @@ TALER_AUDITOR_deposit_confirmation (struct 
TALER_AUDITOR_Handle *auditor,
                                    CURLOPT_CUSTOMREQUEST,
                                    "PUT"));
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&dh->ctx,
+      TALER_curl_easy_post (&dh->ctx,
                            eh,
                            deposit_confirmation_obj))
   {
@@ -384,7 +384,7 @@ TALER_AUDITOR_deposit_confirmation_cancel (struct 
TALER_AUDITOR_DepositConfirmat
     deposit_confirmation->job = NULL;
   }
   GNUNET_free (deposit_confirmation->url);
-  TEAH_curl_easy_post_finished (&deposit_confirmation->ctx);
+  TALER_curl_easy_post_finished (&deposit_confirmation->ctx);
   GNUNET_free (deposit_confirmation);
 }
 
diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c
index 870eed83..8077b80c 100644
--- a/src/lib/auditor_api_handle.c
+++ b/src/lib/auditor_api_handle.c
@@ -466,12 +466,6 @@ TALER_AUDITOR_connect (struct GNUNET_CURL_Context *ctx,
   GNUNET_break (GNUNET_OK ==
                 GNUNET_CURL_append_header (ctx,
                                            "Expect:"));
-#if COMPRESS_BODIES
-  /* Tell auditor we compress bodies */
-  GNUNET_break (GNUNET_OK ==
-                GNUNET_CURL_append_header (ctx,
-                                           "Content-encoding: deflate"));
-#endif
   auditor = GNUNET_new (struct TALER_AUDITOR_Handle);
   auditor->ctx = ctx;
   auditor->url = GNUNET_strdup (url);
diff --git a/src/lib/auditor_api_handle.h b/src/lib/auditor_api_handle.h
index c053cbbc..eac007c4 100644
--- a/src/lib/auditor_api_handle.h
+++ b/src/lib/auditor_api_handle.h
@@ -22,7 +22,7 @@
 #include "platform.h"
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_auditor_service.h"
-#include "teah_common.h"
+#include "taler_curl_lib.h"
 
 /**
  * Get the context of a auditor.
diff --git a/src/lib/exchange_api_curl_defaults.c 
b/src/lib/exchange_api_curl_defaults.c
index 57fae166..36d1edf7 100644
--- a/src/lib/exchange_api_curl_defaults.c
+++ b/src/lib/exchange_api_curl_defaults.c
@@ -42,11 +42,6 @@ TEL_curl_easy_get (const char *url)
                                    url));
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
-                                   CURLOPT_ENCODING,
-                                   "deflate"));
-
-  GNUNET_assert (CURLE_OK ==
-                 curl_easy_setopt (eh,
                                    CURLOPT_FOLLOWLOCATION,
                                    1L));
   GNUNET_assert (CURLE_OK ==
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index b99c7a93..06cb0d14 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -583,7 +583,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle 
*exchange,
 
   eh = TEL_curl_easy_get (dh->url);
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&dh->ctx,
+      TALER_curl_easy_post (&dh->ctx,
                            eh,
                            deposit_obj))
   {
@@ -599,11 +599,11 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle 
*exchange,
               "URL for deposit: `%s'\n",
               dh->url);
   ctx = TEAH_handle_to_context (exchange);
-  dh->job = GNUNET_CURL_job_add (ctx,
-                                eh,
-                                GNUNET_YES,
-                                &handle_deposit_finished,
-                                dh);
+  dh->job = GNUNET_CURL_job_add2 (ctx,
+                                 eh,
+                                 dh->ctx.headers,
+                                 &handle_deposit_finished,
+                                 dh);
   return dh;
 }
 
@@ -623,7 +623,7 @@ TALER_EXCHANGE_deposit_cancel (struct 
TALER_EXCHANGE_DepositHandle *deposit)
     deposit->job = NULL;
   }
   GNUNET_free (deposit->url);
-  TEAH_curl_easy_post_finished (&deposit->ctx);
+  TALER_curl_easy_post_finished (&deposit->ctx);
   GNUNET_free (deposit);
 }
 
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 0f3cfe0a..659301d4 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -33,7 +33,7 @@
 #include "exchange_api_handle.h"
 #include "exchange_api_curl_defaults.h"
 #include "backoff.h"
-#include "teah_common.h"
+#include "taler_curl_lib.h"
 
 /**
  * Which revision of the Taler protocol is implemented
@@ -1784,12 +1784,6 @@ TALER_EXCHANGE_connect
   GNUNET_break (GNUNET_OK ==
                GNUNET_CURL_append_header (ctx,
                                           "Expect:"));
-#if COMPRESS_BODIES
-  /* Tell exchange we compress bodies */
-  GNUNET_break (GNUNET_OK ==
-               GNUNET_CURL_append_header (ctx,
-                                   "Content-encoding: deflate"));
-#endif
   exchange = GNUNET_new (struct TALER_EXCHANGE_Handle);
   exchange->ctx = ctx;
   exchange->url = GNUNET_strdup (url);
diff --git a/src/lib/exchange_api_handle.h b/src/lib/exchange_api_handle.h
index 6bb3fff2..81e6d7c5 100644
--- a/src/lib/exchange_api_handle.h
+++ b/src/lib/exchange_api_handle.h
@@ -24,7 +24,7 @@
 #include "taler_auditor_service.h"
 #include "taler_exchange_service.h"
 #include "taler_crypto_lib.h"
-#include "teah_common.h"
+#include "taler_curl_lib.h"
 
 /**
  * Entry in DLL of auditors used by an exchange.
diff --git a/src/lib/exchange_api_payback.c b/src/lib/exchange_api_payback.c
index 325263d7..99b390b1 100644
--- a/src/lib/exchange_api_payback.c
+++ b/src/lib/exchange_api_payback.c
@@ -324,7 +324,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle 
*exchange,
   ph->url = TEAH_path_to_url (exchange, "/payback");
   eh = TEL_curl_easy_get (ph->url);
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&ph->ctx,
+      TALER_curl_easy_post (&ph->ctx,
                            eh,
                            payback_obj))
   {
@@ -340,11 +340,11 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle 
*exchange,
               "URL for payback: `%s'\n",
               ph->url);
   ctx = TEAH_handle_to_context (exchange);
-  ph->job = GNUNET_CURL_job_add (ctx,
-                                eh,
-                                GNUNET_YES,
-                                &handle_payback_finished,
-                                ph);
+  ph->job = GNUNET_CURL_job_add2 (ctx,
+                                 eh,
+                                 ph->ctx.headers,
+                                 &handle_payback_finished,
+                                 ph);
   return ph;
 }
 
@@ -364,7 +364,7 @@ TALER_EXCHANGE_payback_cancel (struct 
TALER_EXCHANGE_PaybackHandle *ph)
     ph->job = NULL;
   }
   GNUNET_free (ph->url);
-  TEAH_curl_easy_post_finished (&ph->ctx);
+  TALER_curl_easy_post_finished (&ph->ctx);
   GNUNET_free (ph);
 }
 
diff --git a/src/lib/exchange_api_refresh.c b/src/lib/exchange_api_refresh.c
index 30025d77..ec9c1d99 100644
--- a/src/lib/exchange_api_refresh.c
+++ b/src/lib/exchange_api_refresh.c
@@ -1208,7 +1208,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle 
*exchange,
                               "/refresh/melt");
   eh = TEL_curl_easy_get (rmh->url);
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&rmh->ctx,
+      TALER_curl_easy_post (&rmh->ctx,
                            eh,
                            melt_obj))
   {
@@ -1221,11 +1221,11 @@ TALER_EXCHANGE_refresh_melt (struct 
TALER_EXCHANGE_Handle *exchange,
   }
   json_decref (melt_obj);
   ctx = TEAH_handle_to_context (exchange);
-  rmh->job = GNUNET_CURL_job_add (ctx,
-                          eh,
-                          GNUNET_YES,
-                          &handle_refresh_melt_finished,
-                          rmh);
+  rmh->job = GNUNET_CURL_job_add2 (ctx,
+                                   eh,
+                                   rmh->ctx.headers,
+                                   &handle_refresh_melt_finished,
+                                   rmh);
   return rmh;
 }
 
@@ -1247,7 +1247,7 @@ TALER_EXCHANGE_refresh_melt_cancel (struct 
TALER_EXCHANGE_RefreshMeltHandle *rmh
   free_melt_data (rmh->md); /* does not free 'md' itself */
   GNUNET_free (rmh->md);
   GNUNET_free (rmh->url);
-  TEAH_curl_easy_post_finished (&rmh->ctx);
+  TALER_curl_easy_post_finished (&rmh->ctx);
   GNUNET_free (rmh);
 }
 
@@ -1638,7 +1638,7 @@ TALER_EXCHANGE_refresh_reveal (struct 
TALER_EXCHANGE_Handle *exchange,
 
   eh = TEL_curl_easy_get (rrh->url);
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&rrh->ctx,
+      TALER_curl_easy_post (&rrh->ctx,
                            eh,
                            reveal_obj))
   {
@@ -1651,11 +1651,11 @@ TALER_EXCHANGE_refresh_reveal (struct 
TALER_EXCHANGE_Handle *exchange,
   }
   json_decref (reveal_obj);
   ctx = TEAH_handle_to_context (rrh->exchange);
-  rrh->job = GNUNET_CURL_job_add (ctx,
-                                  eh,
-                                  GNUNET_YES,
-                                  &handle_refresh_reveal_finished,
-                                  rrh);
+  rrh->job = GNUNET_CURL_job_add2 (ctx,
+                                   eh,
+                                   rrh->ctx.headers,
+                                   &handle_refresh_reveal_finished,
+                                   rrh);
   return rrh;
 }
 
@@ -1675,7 +1675,7 @@ TALER_EXCHANGE_refresh_reveal_cancel (struct 
TALER_EXCHANGE_RefreshRevealHandle
     rrh->job = NULL;
   }
   GNUNET_free (rrh->url);
-  TEAH_curl_easy_post_finished (&rrh->ctx);
+  TALER_curl_easy_post_finished (&rrh->ctx);
   free_melt_data (rrh->md); /* does not free 'md' itself */
   GNUNET_free (rrh->md);
   GNUNET_free (rrh);
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index 14221317..2b8585f9 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -370,7 +370,7 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */
 
   eh = TEL_curl_easy_get (rh->url);
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&rh->ctx,
+      TALER_curl_easy_post (&rh->ctx,
                            eh,
                            refund_obj))
   {
@@ -386,11 +386,11 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */
               "URL for refund: `%s'\n",
               rh->url);
   ctx = TEAH_handle_to_context (exchange);
-  rh->job = GNUNET_CURL_job_add (ctx,
-                                eh,
-                                GNUNET_YES,
-                                &handle_refund_finished,
-                                rh);
+  rh->job = GNUNET_CURL_job_add2 (ctx,
+                                 eh,
+                                 rh->ctx.headers,
+                                 &handle_refund_finished,
+                                 rh);
   return rh;
 }
 
@@ -410,7 +410,7 @@ TALER_EXCHANGE_refund_cancel (struct 
TALER_EXCHANGE_RefundHandle *refund)
     refund->job = NULL;
   }
   GNUNET_free (refund->url);
-  TEAH_curl_easy_post_finished (&refund->ctx);
+  TALER_curl_easy_post_finished (&refund->ctx);
   GNUNET_free (refund);
 }
 
diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c
index ae0bd01d..9a4679d2 100644
--- a/src/lib/exchange_api_reserve.c
+++ b/src/lib/exchange_api_reserve.c
@@ -1031,7 +1031,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle 
*exchange,
   wsh->url = TEAH_path_to_url (exchange, "/reserve/withdraw");
   eh = TEL_curl_easy_get (wsh->url);
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&wsh->ctx,
+      TALER_curl_easy_post (&wsh->ctx,
                            eh,
                            withdraw_obj))
   {
@@ -1044,11 +1044,11 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle 
*exchange,
   }
   json_decref (withdraw_obj);
   ctx = TEAH_handle_to_context (exchange);
-  wsh->job = GNUNET_CURL_job_add (ctx,
-                          eh,
-                          GNUNET_YES,
-                          &handle_reserve_withdraw_finished,
-                          wsh);
+  wsh->job = GNUNET_CURL_job_add2 (ctx,
+                                   eh,
+                                   wsh->ctx.headers,
+                                   &handle_reserve_withdraw_finished,
+                                   wsh);
   return wsh;
 }
 
@@ -1201,7 +1201,7 @@ TALER_EXCHANGE_reserve_withdraw_cancel (struct 
TALER_EXCHANGE_ReserveWithdrawHan
     sign->job = NULL;
   }
   GNUNET_free (sign->url);
-  TEAH_curl_easy_post_finished (&sign->ctx);
+  TALER_curl_easy_post_finished (&sign->ctx);
   GNUNET_free (sign);
 }
 
diff --git a/src/lib/exchange_api_track_transaction.c 
b/src/lib/exchange_api_track_transaction.c
index 67efd77a..1cc99dbb 100644
--- a/src/lib/exchange_api_track_transaction.c
+++ b/src/lib/exchange_api_track_transaction.c
@@ -324,7 +324,7 @@ TALER_EXCHANGE_track_transaction (struct 
TALER_EXCHANGE_Handle *exchange,
 
   eh = TEL_curl_easy_get (dwh->url);
   if (GNUNET_OK !=
-      TEAH_curl_easy_post (&dwh->ctx,
+      TALER_curl_easy_post (&dwh->ctx,
                            eh,
                            deposit_wtid_obj))
   {
@@ -337,11 +337,11 @@ TALER_EXCHANGE_track_transaction (struct 
TALER_EXCHANGE_Handle *exchange,
   }
   json_decref (deposit_wtid_obj);
   ctx = TEAH_handle_to_context (exchange);
-  dwh->job = GNUNET_CURL_job_add (ctx,
-                          eh,
-                          GNUNET_YES,
-                          &handle_deposit_wtid_finished,
-                          dwh);
+  dwh->job = GNUNET_CURL_job_add2 (ctx,
+                                   eh,
+                                   dwh->ctx.headers,
+                                   &handle_deposit_wtid_finished,
+                                   dwh);
   return dwh;
 }
 
@@ -361,7 +361,7 @@ TALER_EXCHANGE_track_transaction_cancel (struct 
TALER_EXCHANGE_TrackTransactionH
     dwh->job = NULL;
   }
   GNUNET_free (dwh->url);
-  TEAH_curl_easy_post_finished (&dwh->ctx);
+  TALER_curl_easy_post_finished (&dwh->ctx);
   GNUNET_free (dwh);
 }
 
diff --git a/src/lib/teah_common.c b/src/lib/teah_common.c
index 8f994ef3..8377c478 100644
--- a/src/lib/teah_common.c
+++ b/src/lib/teah_common.c
@@ -23,7 +23,7 @@
  * @author Christian Grothoff
  */
 #include "platform.h"
-#include "teah_common.h"
+#include "taler_curl_lib.h"
 
 #if COMPRESS_BODIES
 #include <zlib.h>
@@ -40,7 +40,7 @@
  * @return #GNUNET_OK on success #GNUNET_SYSERR on failure
  */
 int
-TEAH_curl_easy_post (struct TEAH_PostContext *ctx,
+TALER_curl_easy_post (struct TEAH_PostContext *ctx,
                      CURL *eh,
                      const json_t *body)
 {
@@ -78,9 +78,19 @@ TEAH_curl_easy_post (struct TEAH_PostContext *ctx,
     slen = (size_t) cbuf_size;
     ctx->json_enc = (char *) cbuf;
   }
+  GNUNET_assert
+  (NULL != (ctx->headers = curl_slist_append
+    (ctx->headers,
+     "Content-Encoding: deflate")));
 #else
   ctx->json_enc = str;
 #endif
+
+  GNUNET_assert
+  (NULL != (ctx->headers = curl_slist_append
+    (ctx->headers,
+     "Content-Type: application/json")));
+
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
                                    CURLOPT_POSTFIELDS,
@@ -99,7 +109,7 @@ TEAH_curl_easy_post (struct TEAH_PostContext *ctx,
  * @param ctx[in] a request context (updated)
  */
 void
-TEAH_curl_easy_post_finished (struct TEAH_PostContext *ctx)
+TALER_curl_easy_post_finished (struct TEAH_PostContext *ctx)
 {
   GNUNET_free_non_null (ctx->json_enc);
 }
diff --git a/src/lib/testing_api_loop.c b/src/lib/testing_api_loop.c
index 071388f2..bebd159d 100644
--- a/src/lib/testing_api_loop.c
+++ b/src/lib/testing_api_loop.c
@@ -807,6 +807,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
   is.ctx = GNUNET_CURL_init
     (&GNUNET_CURL_gnunet_scheduler_reschedule,
      &is.rc);
+  GNUNET_CURL_enable_async_scope_header (is.ctx, "Taler-Correlation-Id");
   GNUNET_assert (NULL != is.ctx);
   is.rc = GNUNET_CURL_gnunet_rc_create (is.ctx);
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]