diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2013-03-31 15:50:32 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2013-03-31 15:50:32 +0200 |
commit | c519d41a5afbb8e2adf98bd3d87c44a202293621 (patch) | |
tree | 6a344cc9059b62d6bca8d44d71f0687c77467a40 | |
parent | 8e662ba273cbc59eff94ad0815bb7136d8890065 (diff) | |
download | pianobar-c519d41a5afbb8e2adf98bd3d87c44a202293621.tar.gz pianobar-c519d41a5afbb8e2adf98bd3d87c44a202293621.tar.bz2 pianobar-c519d41a5afbb8e2adf98bd3d87c44a202293621.zip |
Ignore HTTP status 400
Workaround for #355, fixes commit
2c516503d2cb81dd156afc24677ac4bf3caefceb.
-rw-r--r-- | src/libwaitress/waitress.c | 6 | ||||
-rw-r--r-- | src/libwaitress/waitress.h | 12 | ||||
-rw-r--r-- | src/player.c | 4 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c index efb76a9..3d01198 100644 --- a/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c @@ -1,5 +1,5 @@ /* -Copyright (c) 2009-2012 +Copyright (c) 2009-2013 Lars-Dominik Braun <lars@6xq.net> Permission is hereby granted, free of charge, to any person obtaining a copy @@ -974,6 +974,10 @@ static WaitressReturn_t WaitressReceiveHeaders (WaitressHandle_t *waith, hdrParseMode = HDRM_LINES; break; + case 400: + return WAITRESS_RET_BAD_REQUEST; + break; + case 403: return WAITRESS_RET_FORBIDDEN; break; diff --git a/src/libwaitress/waitress.h b/src/libwaitress/waitress.h index 6a0a66f..9075047 100644 --- a/src/libwaitress/waitress.h +++ b/src/libwaitress/waitress.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2009-2012 +Copyright (c) 2009-2013 Lars-Dominik Braun <lars@6xq.net> Permission is hereby granted, free of charge, to any person obtaining a copy @@ -62,20 +62,24 @@ typedef struct { typedef enum { WAITRESS_RET_ERR = 0, WAITRESS_RET_OK, + WAITRESS_RET_CB_ABORT, + /* http error codes */ WAITRESS_RET_STATUS_UNKNOWN, WAITRESS_RET_NOTFOUND, WAITRESS_RET_FORBIDDEN, + WAITRESS_RET_BAD_REQUEST, + /* socket errors */ WAITRESS_RET_CONNECT_REFUSED, WAITRESS_RET_SOCK_ERR, WAITRESS_RET_GETADDR_ERR, - WAITRESS_RET_CB_ABORT, - WAITRESS_RET_PARTIAL_FILE, WAITRESS_RET_TIMEOUT, WAITRESS_RET_READ_ERR, WAITRESS_RET_CONNECTION_CLOSED, - WAITRESS_RET_DECODING_ERR, WAITRESS_RET_TLS_WRITE_ERR, WAITRESS_RET_TLS_READ_ERR, + /* protocol errors */ + WAITRESS_RET_PARTIAL_FILE, + WAITRESS_RET_DECODING_ERR, WAITRESS_RET_TLS_HANDSHAKE_ERR, WAITRESS_RET_TLS_FINGERPRINT_MISMATCH, } WaitressReturn_t; diff --git a/src/player.c b/src/player.c index 6e97e46..afd6eb4 100644 --- a/src/player.c +++ b/src/player.c @@ -530,7 +530,9 @@ void *BarPlayerThread (void *data) { ret = (void *) PLAYER_RET_ERR; } - if (wRet != WAITRESS_RET_OK && wRet != WAITRESS_RET_CB_ABORT) { + /* Pandora sends broken audio url’s sometimes (“bad request”). ignore them. */ + if (wRet != WAITRESS_RET_OK && wRet != WAITRESS_RET_CB_ABORT && + wRet != WAITRESS_RET_BAD_REQUEST) { BarUiMsg (player->settings, MSG_ERR, "Cannot access audio file: %s\n", WaitressErrorToStr (wRet)); ret = (void *) PLAYER_RET_ERR; |