vlc_tls_sys_t *sys;
struct virtual_socket_t sock;
- int (*handshake) (vlc_tls_t *, const char *host);
+ int (*handshake) (vlc_tls_t *, const char *host, const char *service);
};
VLC_API vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *, int fd,
- const char *host);
+ const char *host, const char *service);
vlc_tls_t *vlc_tls_SessionCreate (vlc_tls_creds_t *, int fd, const char *host);
-int vlc_tls_SessionHandshake (vlc_tls_t *, const char *host);
+int vlc_tls_SessionHandshake (vlc_tls_t *, const char *host, const char *serv);
VLC_API void vlc_tls_SessionDelete (vlc_tls_t *);
/* NOTE: It is assumed that a->sock.p_sys = a */
/* TLS/SSL handshake */
p_sys->p_tls = vlc_tls_ClientSessionCreate( p_sys->p_creds, p_sys->fd,
- p_sys->url.psz_host );
+ p_sys->url.psz_host, "https" );
if( p_sys->p_tls == NULL )
{
msg_Err( p_access, "cannot establish HTTP/TLS session" );
* 1 if more would-be blocking recv is needed,
* 2 if more would-be blocking send is required.
*/
-static int gnutls_ContinueHandshake (vlc_tls_t *session, const char *host)
+static int gnutls_ContinueHandshake (vlc_tls_t *session, const char *host,
+ const char *service)
{
vlc_tls_sys_t *sys = session->sys;
int val;
}
sys->handshaked = true;
- (void) host;
+ (void) host; (void) service;
return 0;
}
};
-static int gnutls_HandshakeAndValidate (vlc_tls_t *session, const char *host)
+static int gnutls_HandshakeAndValidate (vlc_tls_t *session, const char *host,
+ const char *service)
{
vlc_tls_sys_t *sys = session->sys;
- int val = gnutls_ContinueHandshake (session, host);
+ int val = gnutls_ContinueHandshake (session, host, service);
if (val)
return val;
{
gnutls_certificate_credentials_t x509_cred;
gnutls_dh_params_t dh_params; /* XXX: used for server only */
- int (*handshake) (vlc_tls_t *, const char *); /* XXX: useful for server only */
+ int (*handshake) (vlc_tls_t *, const char *, const char *);
+ /* ^^ XXX: useful for server only */
};
static void httpd_ClientTlsHandshake( httpd_client_t *cl )
{
- switch( vlc_tls_SessionHandshake( cl->p_tls, NULL ) )
+ switch( vlc_tls_SessionHandshake( cl->p_tls, NULL, NULL ) )
{
case 0:
cl->i_state = HTTPD_CLIENT_RECEIVING;
vlc_object_release (session);
}
-int vlc_tls_SessionHandshake (vlc_tls_t *session, const char *host)
+int vlc_tls_SessionHandshake (vlc_tls_t *session, const char *host,
+ const char *service)
{
- return session->handshake (session, host);
+ return session->handshake (session, host, service);
}
/**
* @return NULL on error.
**/
vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *crd, int fd,
- const char *host)
+ const char *host, const char *service)
{
vlc_tls_t *session = vlc_tls_SessionCreate (crd, fd, host);
if (session == NULL)
int val;
do
- val = vlc_tls_SessionHandshake (session, host);
+ val = vlc_tls_SessionHandshake (session, host, service);
while (val > 0);
if (val != 0)