mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
http: Add reference counting to the session object.
* common/http.c (http_session_t): Add field "refcount". (_my_socket_new, _my_socket_ref, _my_socket_unref): Add debug code. (send_request, my_npth_read, my_npth_write): Use SOCK object for the transport ptr. (http_session_release): Factor all code out to ... (session_unref): here. Deref SOCK. (http_session_new): Init refcount and transport ptr. (http_session_ref): New. Ref and unref all assignments. -- Having the reference counted session objects makes it easier for the application to pass around only an estream. Without that the application would need to implement an es_onclose machinery for the session object.
This commit is contained in:
parent
0e59195642
commit
ea0f5481f0
3 changed files with 100 additions and 47 deletions
|
@ -144,6 +144,7 @@ main (int argc, char **argv)
|
|||
int c;
|
||||
unsigned int my_http_flags = 0;
|
||||
int no_out = 0;
|
||||
int tls_dbg = 0;
|
||||
const char *cafile = NULL;
|
||||
http_session_t session = NULL;
|
||||
|
||||
|
@ -163,12 +164,13 @@ main (int argc, char **argv)
|
|||
{
|
||||
fputs ("usage: " PGM " URL\n"
|
||||
"Options:\n"
|
||||
" --verbose print timings etc.\n"
|
||||
" --debug flyswatter\n"
|
||||
" --cacert FNAME expect CA certificate in file FNAME\n"
|
||||
" --no-verify do not verify the certificate\n"
|
||||
" --force-tls use HTTP_FLAG_FORCE_TLS\n"
|
||||
" --no-out do not print the content\n",
|
||||
" --verbose print timings etc.\n"
|
||||
" --debug flyswatter\n"
|
||||
" --gnutls-debug N use GNUTLS debug level N\n"
|
||||
" --cacert FNAME expect CA certificate in file FNAME\n"
|
||||
" --no-verify do not verify the certificate\n"
|
||||
" --force-tls use HTTP_FLAG_FORCE_TLS\n"
|
||||
" --no-out do not print the content\n",
|
||||
stdout);
|
||||
exit (0);
|
||||
}
|
||||
|
@ -183,6 +185,15 @@ main (int argc, char **argv)
|
|||
debug++;
|
||||
argc--; argv++;
|
||||
}
|
||||
else if (!strcmp (*argv, "--gnutls-debug"))
|
||||
{
|
||||
argc--; argv++;
|
||||
if (argc)
|
||||
{
|
||||
tls_dbg = atoi (*argv);
|
||||
argc--; argv++;
|
||||
}
|
||||
}
|
||||
else if (!strcmp (*argv, "--cacert"))
|
||||
{
|
||||
argc--; argv++;
|
||||
|
@ -248,7 +259,8 @@ main (int argc, char **argv)
|
|||
/* gnutls_certificate_set_dh_params (certcred, dh_params); */
|
||||
|
||||
gnutls_global_set_log_function (my_gnutls_log);
|
||||
/* gnutls_global_set_log_level (2); */
|
||||
if (tls_dbg)
|
||||
gnutls_global_set_log_level (tls_dbg);
|
||||
|
||||
#endif /*HTTP_USE_GNUTLS*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue