diff options
author | Pierre Zurek <pierrezurek@gmail.com> | 2012-11-02 13:58:39 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2012-11-04 12:21:33 +0100 |
commit | cdb3ba3b567099236ebc1998b84ec0d7035d8cc8 (patch) | |
tree | 96b6c20d6d7c063b580dd4c75ac3fd1992b05094 | |
parent | dd6c620b53272e2eb4b091a835cd250309f04cad (diff) | |
download | pianobar-cdb3ba3b567099236ebc1998b84ec0d7035d8cc8.tar.gz pianobar-cdb3ba3b567099236ebc1998b84ec0d7035d8cc8.tar.bz2 pianobar-cdb3ba3b567099236ebc1998b84ec0d7035d8cc8.zip |
New setting: Read RPC TLS port
Useful for tuner-beta.savagebeast.com:8443. Closes #319.
-rw-r--r-- | contrib/pianobar.1 | 3 | ||||
-rw-r--r-- | src/libwaitress/waitress.c | 6 | ||||
-rw-r--r-- | src/libwaitress/waitress.h | 1 | ||||
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/settings.c | 5 | ||||
-rw-r--r-- | src/settings.h | 2 |
6 files changed, 16 insertions, 2 deletions
diff --git a/contrib/pianobar.1 b/contrib/pianobar.1 index 53bb301..86f1138 100644 --- a/contrib/pianobar.1 +++ b/contrib/pianobar.1 @@ -311,6 +311,9 @@ variable. Only "Basic" http authentication is supported. .B rpc_host = tuner.pandora.com .TP +.B rpc_tls_port = 443 + +.TP .B sort = {name_az, name_za, quickmix_01_name_az, quickmix_01_name_za, quickmix_10_name_az, quickmix_10_name_za} Sort station list by name or type (is quickmix) and name. name_az for example sorts by name from a to z, quickmix_01_name_za by type (quickmix at the diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c index ee2926b..ce2a254 100644 --- a/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c @@ -577,7 +577,11 @@ static bool WaitressFormatAuthorization (WaitressHandle_t *waith, static const char *WaitressDefaultPort (const WaitressUrl_t * const url) { assert (url != NULL); - return url->port == NULL ? (url->tls ? "443" : "80") : url->port; + if (url->tls) { + return url->tlsPort == NULL ? "443" : url->tlsPort; + } else { + return url->port == NULL ? "80" : url->port; + } } /* get line from string diff --git a/src/libwaitress/waitress.h b/src/libwaitress/waitress.h index f91985d..0d69f0e 100644 --- a/src/libwaitress/waitress.h +++ b/src/libwaitress/waitress.h @@ -55,6 +55,7 @@ typedef struct { const char *password; const char *host; const char *port; + const char *tlsPort; const char *path; /* without leading '/' */ } WaitressUrl_t; @@ -430,6 +430,7 @@ int main (int argc, char **argv) { WaitressInit (&app.waith); app.waith.url.host = app.settings.rpcHost; + app.waith.url.tlsPort = app.settings.rpcTlsPort; app.waith.tlsFingerprint = app.settings.tlsFingerprint; /* init fds */ diff --git a/src/settings.c b/src/settings.c index 014c561..68d2ef9 100644 --- a/src/settings.c +++ b/src/settings.c @@ -97,6 +97,7 @@ void BarSettingsDestroy (BarSettings_t *settings) { free (settings->listSongFormat); free (settings->fifo); free (settings->rpcHost); + free (settings->rpcTlsPort); free (settings->partnerUser); free (settings->partnerPassword); free (settings->device); @@ -132,6 +133,7 @@ void BarSettingsRead (BarSettings_t *settings) { settings->npStationFormat = strdup ("Station \"%n\" (%i)"); settings->listSongFormat = strdup ("%i) %a - %t%r"); settings->rpcHost = strdup (PIANO_RPC_HOST); + settings->rpcTlsPort = NULL; settings->partnerUser = strdup ("android"); settings->partnerPassword = strdup ("AC7IBG09A3DTSYM4R41UJWL07VLN8JI7"); settings->device = strdup ("android-generic"); @@ -195,6 +197,9 @@ void BarSettingsRead (BarSettings_t *settings) { } else if (streq ("rpc_host", key)) { free (settings->rpcHost); settings->rpcHost = strdup (val); + } else if (streq ("rpc_tls_port", key)) { + free (settings->rpcTlsPort); + settings->rpcTlsPort = strdup (val); } else if (streq ("partner_user", key)) { free (settings->partnerUser); settings->partnerUser = strdup (val); diff --git a/src/settings.h b/src/settings.h index 30915c2..6ccad5d 100644 --- a/src/settings.h +++ b/src/settings.h @@ -99,7 +99,7 @@ typedef struct { char *npStationFormat; char *listSongFormat; char *fifo; - char *rpcHost, *partnerUser, *partnerPassword, *device, *inkey, *outkey; + char *rpcHost, *rpcTlsPort, *partnerUser, *partnerPassword, *device, *inkey, *outkey; char tlsFingerprint[20]; char keys[BAR_KS_COUNT]; BarMsgFormatStr_t msgFormat[MSG_COUNT]; |