pianod: Sync patches with upstream. Fix SNI support
authorTed Hess <thess@kitschensync.net>
Tue, 24 Mar 2015 13:10:35 +0000 (09:10 -0400)
committerTed Hess <thess@kitschensync.net>
Tue, 24 Mar 2015 20:11:50 +0000 (16:11 -0400)
Signed-off-by: Ted Hess <thess@kitschensync.net>
sound/pianod/Makefile
sound/pianod/patches/005-Fix_IPV6_socket_handling.patch
sound/pianod/patches/020-Use_package_config_h_for_all_modules.patch
sound/pianod/patches/030-Waitress_add_polarssl_variant.patch

index 758805c708bfa315ff05153f78e4c95b49cdd1b8..bb2d5092823b9a527c4d0c6b48bc0da15eca8432 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pianod
 PKG_VERSION:=173
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://deviousfish.com/Downloads/pianod/
@@ -63,7 +63,7 @@ CONFIGURE_ARGS+= --with-polarssl
 PIANOD_CLIENT:=pianod-client-compiled-51.tar.gz
 
 define Download/pianod-client
-  URL:=$(PKG_SOURCE_URL)/Devel
+  URL:=$(PKG_SOURCE_URL)
   FILE:=$(PIANOD_CLIENT)
   MD5SUM:=abbdee5627bcee6a00c8304da8b4e2e7
 endef
index 68f7c365da1fd5bc98a335f008c75698d5a55de0..883495a1a4318da918c7baaa03495041248aa0f0 100644 (file)
@@ -1,21 +1,67 @@
 --- a/src/libwaitress/waitress.c
 +++ b/src/libwaitress/waitress.c
-@@ -813,7 +813,14 @@ static WaitressReturn_t WaitressConnect
-                                       sizeof (sockopt));
+@@ -805,34 +805,37 @@ static WaitressReturn_t WaitressConnect
+                       int pollres;
  
-                       /* non-blocking connect will return immediately */
--                      connect (sock, gacurr->ai_addr, gacurr->ai_addrlen);
-+                      if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) == -1) {
-+                              // Error if not in-progress or immediate success
-+                              if (errno != EINPROGRESS) {
-+                                      // Close socket and try alternatives
-+                                      close (sock);
-+                                      continue;
-+                              }
-+                      }
+                       /* we need shorter timeouts for connect() */
+-                      fcntl (sock, F_SETFL, O_NONBLOCK);
++                      pollres = fcntl (sock, F_SETFL, O_NONBLOCK);
++                      assert (pollres != -1);
  
-                       pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
-                       if (pollres == 0) {
+-                      /* increase socket receive buffer */
+-                      const int sockopt = 256*1024;
+-                      setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &sockopt,
+-                                      sizeof (sockopt));
+-
+-                      /* non-blocking connect will return immediately */
+-                      connect (sock, gacurr->ai_addr, gacurr->ai_addrlen);
+-
+-                      pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
+-                      if (pollres == 0) {
+-                              ret = WAITRESS_RET_TIMEOUT;
+-                      } else if (pollres == -1) {
+-                              ret = WAITRESS_RET_ERR;
+-                      } else {
+-                              /* check connect () return value */
+-                              socklen_t pollresSize = sizeof (pollres);
+-                              getsockopt (sock, SOL_SOCKET, SO_ERROR, &pollres,
+-                                              &pollresSize);
+-                              if (pollres != 0) {
+-                                      ret = WAITRESS_RET_CONNECT_REFUSED;
++                      if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) != -1) {
++                              /* working */
++                              waith->request.sockfd = sock;
++                              break;
++                      } else if (errno == EINPROGRESS) {
++                              /* wait for connect to succeed */
++                              pollres = WaitressPollLoop (sock, POLLOUT, waith->timeout);
++                              if (pollres == 0) {
++                                      ret = WAITRESS_RET_TIMEOUT;
++                              } else if (pollres == -1) {
++                                      ret = WAITRESS_RET_ERR;
+                               } else {
+-                                      /* this one is working */
+-                                      waith->request.sockfd = sock;
+-                                      break;
++                                      /* check connect () return value */
++                                      socklen_t pollresSize = sizeof (pollres);
++                                      getsockopt (sock, SOL_SOCKET, SO_ERROR, &pollres,
++                                                      &pollresSize);
++                                      if (pollres != 0) {
++                                              ret = WAITRESS_RET_CONNECT_REFUSED;
++                                      } else {
++                                              /* this one is working */
++                                              waith->request.sockfd = sock;
++                                              break;
++                                      }
+                               }
++                      } else {
++                              ret = WAITRESS_RET_ERR;
+                       }
++
+                       close (sock);
+               }
+       }
 --- a/src/libfootball/fb_service.c
 +++ b/src/libfootball/fb_service.c
 @@ -111,6 +111,8 @@ static bool fb_setup_socket (FB_SERVICE
index 25569ccc229d13568c1ac9553168d1ec2df8b646..228710b05637ced1f85eeee552aa59b085769f02 100644 (file)
@@ -19,7 +19,7 @@
  
 --- a/src/libwaitress/waitress.c
 +++ b/src/libwaitress/waitress.c
-@@ -922,14 +922,14 @@ static WaitressReturn_t WaitressSendRequ
+@@ -918,14 +918,14 @@ static WaitressReturn_t WaitressSendRequ
        if (WaitressProxyEnabled (waith) && !waith->url.tls) {
                snprintf (buf, WAITRESS_BUFFER_SIZE,
                        "%s http://%s:%s/%s HTTP/" WAITRESS_HTTP_VERSION "\r\n"
index de40b35c967360afe71b56e33f2fa0e58482bab2..b2a657645b0b06a57c85d5c32eb3c39c9ac7e2ec 100644 (file)
        return WAITRESS_RET_OK;
  }
  
-@@ -807,11 +878,6 @@ static WaitressReturn_t WaitressConnect
-                       /* we need shorter timeouts for connect() */
-                       fcntl (sock, F_SETFL, O_NONBLOCK);
--                      /* increase socket receive buffer */
--                      const int sockopt = 256*1024;
--                      setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &sockopt,
--                                      sizeof (sockopt));
--
-                       /* non-blocking connect will return immediately */
-                       if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) == -1) {
-                               // Error if not in-progress or immediate success
-@@ -880,6 +946,11 @@ static WaitressReturn_t WaitressConnect
+@@ -876,6 +947,12 @@ static WaitressReturn_t WaitressConnect
                        }
                }
  
 +#if defined(USE_POLARSSL)
++              ssl_set_hostname (&waith->request.sslCtx->ssl, waith->url.host);
 +              if (ssl_handshake (&waith->request.sslCtx->ssl) != 0) {
 +                      return WAITRESS_RET_TLS_HANDSHAKE_ERR;
 +              }
                /* Ignore return code as connection will likely still succeed */
                gnutls_server_name_set (waith->request.tlsSession, GNUTLS_NAME_DNS,
                                waith->url.host, strlen (waith->url.host));
-@@ -887,14 +958,15 @@ static WaitressReturn_t WaitressConnect
+@@ -883,14 +960,15 @@ static WaitressReturn_t WaitressConnect
                if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) {
                        return WAITRESS_RET_TLS_HANDSHAKE_ERR;
                }
        }
  
        return WAITRESS_RET_OK;
-@@ -1120,6 +1192,21 @@ WaitressReturn_t WaitressFetchCall (Wait
+@@ -1116,6 +1194,21 @@ WaitressReturn_t WaitressFetchCall (Wait
        waith->request.contentLengthKnown = false;
  
        if (waith->url.tls) {
                gnutls_init (&waith->request.tlsSession, GNUTLS_CLIENT);
                gnutls_set_default_priority (waith->request.tlsSession);
  
-@@ -1137,6 +1224,7 @@ WaitressReturn_t WaitressFetchCall (Wait
+@@ -1133,6 +1226,7 @@ WaitressReturn_t WaitressFetchCall (Wait
                                WaitressPollRead);
                gnutls_transport_set_push_function (waith->request.tlsSession,
                                WaitressPollWrite);
        }
  
        /* buffer is required for connect already */
-@@ -1148,15 +1236,22 @@ WaitressReturn_t WaitressFetchCall (Wait
+@@ -1144,15 +1238,22 @@ WaitressReturn_t WaitressFetchCall (Wait
                if ((wRet = WaitressSendRequest (waith)) == WAITRESS_RET_OK) {
                        wRet = WaitressReceiveResponse (waith);
                }