Hello community,

here is the log from the commit of package miniupnpc for openSUSE:Factory 
checked in at 2016-03-01 09:35:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/miniupnpc (Old)
 and      /work/SRC/openSUSE:Factory/.miniupnpc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "miniupnpc"

Changes:
--------
--- /work/SRC/openSUSE:Factory/miniupnpc/miniupnpc.changes      2015-12-03 
13:25:37.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.miniupnpc.new/miniupnpc.changes 2016-03-01 
09:36:06.000000000 +0100
@@ -1,0 +2,9 @@
+Sat Feb 20 13:47:40 UTC 2016 - mplus...@suse.com
+
+- Update to 1.9.20160209
+  * change miniwget to return HTTP status code
+  * increments API_VERSION to 16
+  * Improve UPNPIGD_IsConnected() to check if WAN address is not 
+    private. parse HTTP response status line in miniwget.c
+
+-------------------------------------------------------------------

Old:
----
  miniupnpc-1.9.20151026.tar.gz

New:
----
  miniupnpc-1.9.20160209.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ miniupnpc.spec ++++++
--- /var/tmp/diff_new_pack.lvoghk/_old  2016-03-01 09:36:07.000000000 +0100
+++ /var/tmp/diff_new_pack.lvoghk/_new  2016-03-01 09:36:07.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package miniupnpc
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,9 +16,9 @@
 #
 
 
-%define soname 15
+%define soname 16
 Name:           miniupnpc
-Version:        1.9.20151026
+Version:        1.9.20160209
 Release:        0
 Summary:        Universal Plug'n'Play (UPnP) Client
 License:        BSD-3-Clause

++++++ baselibs.conf ++++++
--- /var/tmp/diff_new_pack.lvoghk/_old  2016-03-01 09:36:07.000000000 +0100
+++ /var/tmp/diff_new_pack.lvoghk/_new  2016-03-01 09:36:07.000000000 +0100
@@ -1 +1 @@
-libminiupnpc15
+libminiupnpc16

++++++ miniupnpc-1.9.20151026.tar.gz -> miniupnpc-1.9.20160209.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/CMakeLists.txt 
new/miniupnpc-1.9.20160209/CMakeLists.txt
--- old/miniupnpc-1.9.20151026/CMakeLists.txt   2015-10-08 18:16:03.000000000 
+0200
+++ new/miniupnpc-1.9.20160209/CMakeLists.txt   2016-02-09 10:38:56.000000000 
+0100
@@ -2,7 +2,7 @@
 
 project (miniupnpc C)
 set (MINIUPNPC_VERSION 1.9)
-set (MINIUPNPC_API_VERSION 15)
+set (MINIUPNPC_API_VERSION 16)
 
 if (NOT CMAKE_BUILD_TYPE)
   if (WIN32)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/Changelog.txt 
new/miniupnpc-1.9.20160209/Changelog.txt
--- old/miniupnpc-1.9.20151026/Changelog.txt    2015-10-26 18:05:52.000000000 
+0100
+++ new/miniupnpc-1.9.20160209/Changelog.txt    2016-02-09 10:38:56.000000000 
+0100
@@ -1,6 +1,14 @@
-$Id: Changelog.txt,v 1.219 2015/10/26 17:05:06 nanard Exp $
+$Id: Changelog.txt,v 1.222 2016/01/24 17:24:35 nanard Exp $
 miniUPnP client Changelog.
 
+2016/01/24:
+  change miniwget to return HTTP status code
+  increments API_VERSION to 16
+
+2016/01/22:
+  Improve UPNPIGD_IsConnected() to check if WAN address is not private.
+  parse HTTP response status line in miniwget.c
+
 2015/10/26:
   snprintf() overflow check. check overflow in simpleUPnPcommand2()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/Makefile 
new/miniupnpc-1.9.20160209/Makefile
--- old/miniupnpc-1.9.20151026/Makefile 2015-10-26 18:05:52.000000000 +0100
+++ new/miniupnpc-1.9.20160209/Makefile 2016-02-09 10:38:56.000000000 +0100
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.132 2015/10/26 16:59:54 nanard Exp $
+# $Id: Makefile,v 1.133 2016/01/24 17:24:35 nanard Exp $
 # MiniUPnP Project
 # http://miniupnp.free.fr/
 # http://miniupnp.tuxfamily.org/
@@ -66,7 +66,7 @@
 endif
 
 # APIVERSION is used to build SONAME
-APIVERSION = 15
+APIVERSION = 16
 
 SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \
        upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/Makefile.mingw 
new/miniupnpc-1.9.20160209/Makefile.mingw
--- old/miniupnpc-1.9.20151026/Makefile.mingw   2015-10-26 18:05:52.000000000 
+0100
+++ new/miniupnpc-1.9.20160209/Makefile.mingw   2016-01-19 11:26:58.000000000 
+0100
@@ -1,4 +1,4 @@
-# $Id: Makefile.mingw,v 1.22 2015/10/26 16:59:54 nanard Exp $
+# $Id: Makefile.mingw,v 1.23 2016/01/19 09:56:03 nanard Exp $
 # Miniupnp project.
 # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
 # (c) 2005-2015 Thomas Bernard
@@ -18,7 +18,8 @@
      upnpdev.o
 OBJSDLL=$(addprefix dll/, $(OBJS))
 
-all:   init upnpc-static upnpc-shared testminixml libminiupnpc.a miniupnpc.dll
+all:   init upnpc-static upnpc-shared testminixml libminiupnpc.a \
+       miniupnpc.dll listdevices
 
 init:
        mkdir dll
@@ -66,6 +67,9 @@
 upnpc-shared:  dll/upnpc.o miniupnpc.lib
        $(CC) -o $@ $^ $(LDLIBS)
 
+listdevices: listdevices.o libminiupnpc.a
+       $(CC) -o $@ $^ $(LDLIBS)
+
 wingenminiupnpcstrings:        wingenminiupnpcstrings.o
 
 wingenminiupnpcstrings.o:      wingenminiupnpcstrings.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/apiversions.txt 
new/miniupnpc-1.9.20160209/apiversions.txt
--- old/miniupnpc-1.9.20151026/apiversions.txt  2015-10-08 18:16:03.000000000 
+0200
+++ new/miniupnpc-1.9.20160209/apiversions.txt  2016-02-09 10:38:56.000000000 
+0100
@@ -1,7 +1,12 @@
-$Id: apiversions.txt,v 1.8 2015/10/08 16:15:47 nanard Exp $
+$Id: apiversions.txt,v 1.9 2016/01/24 17:24:36 nanard Exp $
 
 Differences in API between miniUPnPc versions
 
+API version 16
+  added "status_code" argument to getHTTPResponse(), miniwget() and 
miniwget_getaddr()
+  updated macro :
+    #define MINIUPNPC_API_VERSION 16
+
 API version 15
   changed "sameport" argument of upnpDiscover() upnpDiscoverAll() 
upnpDiscoverDevice()
     to "localport". When 0 or 1, behaviour is not changed, but it can take
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/minihttptestserver.c 
new/miniupnpc-1.9.20160209/minihttptestserver.c
--- old/miniupnpc-1.9.20151026/minihttptestserver.c     2015-07-15 
18:14:01.000000000 +0200
+++ new/miniupnpc-1.9.20160209/minihttptestserver.c     2015-11-18 
09:25:37.000000000 +0100
@@ -1,4 +1,4 @@
-/* $Id: minihttptestserver.c,v 1.18 2015/07/15 12:41:15 nanard Exp $ */
+/* $Id: minihttptestserver.c,v 1.19 2015/11/17 09:07:17 nanard Exp $ */
 /* Project : miniUPnP
  * Author : Thomas Bernard
  * Copyright (c) 2011-2015 Thomas Bernard
@@ -18,6 +18,10 @@
 #include <time.h>
 #include <errno.h>
 
+#ifndef INADDR_LOOPBACK
+#define INADDR_LOOPBACK         0x7f000001
+#endif
+
 #define CRAP_LENGTH (2048)
 
 volatile sig_atomic_t quit = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/minissdpc.c 
new/miniupnpc-1.9.20160209/minissdpc.c
--- old/miniupnpc-1.9.20151026/minissdpc.c      2015-10-26 18:05:52.000000000 
+0100
+++ new/miniupnpc-1.9.20160209/minissdpc.c      2016-01-19 11:26:58.000000000 
+0100
@@ -1,5 +1,6 @@
-/* $Id: minissdpc.c,v 1.30 2015/10/26 17:05:07 nanard Exp $ */
-/* Project : miniupnp
+/* $Id: minissdpc.c,v 1.31 2016/01/19 09:56:46 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
  * Web : http://miniupnp.free.fr/
  * Author : Thomas BERNARD
  * copyright (c) 2005-2015 Thomas Bernard
@@ -67,6 +68,10 @@
 #define HAS_IP_MREQN
 #endif
 
+#if !defined(HAS_IP_MREQN) && !defined(_WIN32)
+#include <sys/ioctl.h>
+#endif
+
 #if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN)
 /* Several versions of glibc don't define this structure,
  * define it here and compile with CFLAGS NEED_STRUCT_IP_MREQN */
@@ -647,11 +652,25 @@
                                {
                                        PRINT_SOCKET_ERROR("setsockopt");
                                }
-#else
+#elif !defined(_WIN32)
+                               struct ifreq ifr;
+                               int ifrlen = sizeof(ifr);
+                               strncpy(ifr.ifr_name, multicastif, IFNAMSIZ);
+                               ifr.ifr_name[IFNAMSIZ-1] = '\0';
+                               if(ioctl(sudp, SIOCGIFADDR, &ifr, &ifrlen) < 0)
+                               {
+                                       
PRINT_SOCKET_ERROR("ioctl(...SIOCGIFADDR...)");
+                               }
+                               mc_if.s_addr = ((struct sockaddr_in 
*)&ifr.ifr_addr)->sin_addr.s_addr;
+                               if(setsockopt(sudp, IPPROTO_IP, 
IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
+                               {
+                                       PRINT_SOCKET_ERROR("setsockopt");
+                               }
+#else /* _WIN32 */
 #ifdef DEBUG
                                printf("Setting of multicast interface not 
supported with interface name.\n");
 #endif
-#endif
+#endif /* #ifdef HAS_IP_MREQN / !defined(_WIN32) */
                        }
                }
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/miniupnpc.c 
new/miniupnpc-1.9.20160209/miniupnpc.c
--- old/miniupnpc-1.9.20151026/miniupnpc.c      2015-10-26 18:05:52.000000000 
+0100
+++ new/miniupnpc-1.9.20160209/miniupnpc.c      2016-02-09 10:38:56.000000000 
+0100
@@ -1,9 +1,9 @@
-/* $Id: miniupnpc.c,v 1.141 2015/10/26 17:05:07 nanard Exp $ */
-/* vim: tabstop=4 shiftwidth=4 noexpandtab */
-/* Project : miniupnp
+/* $Id: miniupnpc.c,v 1.148 2016/01/24 17:24:36 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
  * Web : http://miniupnp.free.fr/
  * Author : Thomas BERNARD
- * copyright (c) 2005-2015 Thomas Bernard
+ * copyright (c) 2005-2016 Thomas Bernard
  * This software is subjet to the conditions detailed in the
  * provided LICENSE file. */
 #include <stdlib.h>
@@ -72,6 +72,25 @@
 #define SERVICEPREFIX "u"
 #define SERVICEPREFIX2 'u'
 
+/* check if an ip address is a private (LAN) address
+ * see https://tools.ietf.org/html/rfc1918 */
+static int is_rfc1918addr(const char * addr)
+{
+       /* 192.168.0.0     -   192.168.255.255 (192.168/16 prefix) */
+       if(COMPARE(addr, "192.168."))
+               return 1;
+       /* 10.0.0.0        -   10.255.255.255  (10/8 prefix) */
+       if(COMPARE(addr, "10."))
+               return 1;
+       /* 172.16.0.0      -   172.31.255.255  (172.16/12 prefix) */
+       if(COMPARE(addr, "172.")) {
+               int i = atoi(addr + 4);
+               if((16 <= i) && (i <= 31))
+                       return 1;
+       }
+       return 0;
+}
+
 /* root description parsing */
 MINIUPNP_LIBSPEC void parserootdesc(const char * buffer, int bufsize, struct 
IGDdatas * data)
 {
@@ -107,6 +126,7 @@
        int soapbodylen;
        char * buf;
        int n;
+       int status_code;
 
        *bufsize = 0;
        snprintf(soapact, sizeof(soapact), "%s#%s", service, action);
@@ -210,11 +230,15 @@
                return NULL;
        }
 
-       buf = getHTTPResponse(s, bufsize);
+       buf = getHTTPResponse(s, bufsize, &status_code);
 #ifdef DEBUG
        if(*bufsize > 0 && buf)
        {
-               printf("SOAP Response :\n%.*s\n", *bufsize, buf);
+               printf("HTTP %d SOAP Response :\n%.*s\n", status_code, 
*bufsize, buf);
+       }
+       else
+       {
+               printf("HTTP %d, empty SOAP response. size=%d\n", status_code, 
*bufsize);
        }
 #endif
        closesocket(s);
@@ -526,7 +550,7 @@
  *     3 = an UPnP device has been found but was not recognized as an IGD
  *
  * In any positive non zero return case, the urls and data structures
- * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
+ * passed as parameters are set. Dont forget to call FreeUPNPUrls(urls) to
  * free allocated memory.
  */
 MINIUPNP_LIBSPEC int
@@ -546,6 +570,9 @@
        int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : 
anything */
        int n_igd = 0;
        char extIpAddr[16];
+       char myLanAddr[40];
+       int status_code = -1;
+
        if(!devlist)
        {
 #ifdef DEBUG
@@ -568,8 +595,8 @@
                /* we should choose an internet gateway device.
                 * with st == 
urn:schemas-upnp-org:device:InternetGatewayDevice:1 */
                desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size),
-                                              lanaddr, lanaddrlen,
-                                              dev->scope_id);
+                                              myLanAddr, sizeof(myLanAddr),
+                                              dev->scope_id, &status_code);
 #ifdef DEBUG
                if(!desc[i].xml)
                {
@@ -586,6 +613,8 @@
                        {
                                desc[i].is_igd = 1;
                                n_igd++;
+                               if(lanaddr)
+                                       strncpy(lanaddr, myLanAddr, lanaddrlen);
                        }
                }
        }
@@ -601,20 +630,25 @@
                                parserootdesc(desc[i].xml, desc[i].size, data);
                                if(desc[i].is_igd || state >= 3 )
                                {
+                                 int is_connected;
+
                                  GetUPNPUrls(urls, data, dev->descURL, 
dev->scope_id);
 
                                  /* in state 2 and 3 we dont test if device is 
connected ! */
                                  if(state >= 2)
                                    goto free_and_return;
+                                 is_connected = UPNPIGD_IsConnected(urls, 
data);
 #ifdef DEBUG
                                  printf("UPNPIGD_IsConnected(%s) = %d\n",
-                                    urls->controlURL,
-                                UPNPIGD_IsConnected(urls, data));
+                                    urls->controlURL, is_connected);
 #endif
                                  /* checks that status is connected AND there 
is a external IP address assigned */
-                                 if(UPNPIGD_IsConnected(urls, data)
-                                    && 
(UPNP_GetExternalIPAddress(urls->controlURL,  data->first.servicetype, 
extIpAddr) == 0))
-                                       goto free_and_return;
+                                 if(is_connected &&
+                                    
(UPNP_GetExternalIPAddress(urls->controlURL,  data->first.servicetype, 
extIpAddr) == 0)) {
+                                       if(!is_rfc1918addr(extIpAddr) && 
(extIpAddr[0] != '\0')
+                                          && (0 != strcmp(extIpAddr, 
"0.0.0.0")))
+                                         goto free_and_return;
+                                 }
                                  FreeUPNPUrls(urls);
                                  if(data->second.servicetype[0] != '\0') {
 #ifdef DEBUG
@@ -626,14 +660,17 @@
                                    memcpy(&data->first, &data->second, 
sizeof(struct IGDdatas_service));
                                    memcpy(&data->second, &data->tmp, 
sizeof(struct IGDdatas_service));
                                    GetUPNPUrls(urls, data, dev->descURL, 
dev->scope_id);
+                                   is_connected = UPNPIGD_IsConnected(urls, 
data);
 #ifdef DEBUG
                                    printf("UPNPIGD_IsConnected(%s) = %d\n",
-                                      urls->controlURL,
-                                  UPNPIGD_IsConnected(urls, data));
+                                      urls->controlURL, is_connected);
 #endif
-                                   if(UPNPIGD_IsConnected(urls, data)
-                                      && 
(UPNP_GetExternalIPAddress(urls->controlURL,  data->first.servicetype, 
extIpAddr) == 0))
-                                         goto free_and_return;
+                                   if(is_connected &&
+                                      
(UPNP_GetExternalIPAddress(urls->controlURL,  data->first.servicetype, 
extIpAddr) == 0)) {
+                                         if(!is_rfc1918addr(extIpAddr) && 
(extIpAddr[0] != '\0')
+                                            && (0 != strcmp(extIpAddr, 
"0.0.0.0")))
+                                           goto free_and_return;
+                                   }
                                    FreeUPNPUrls(urls);
                                  }
                                }
@@ -667,8 +704,9 @@
 {
        char * descXML;
        int descXMLsize = 0;
+
        descXML = miniwget_getaddr(rootdescurl, &descXMLsize,
-                                      lanaddr, lanaddrlen, 0);
+                                      lanaddr, lanaddrlen, 0, NULL);
        if(descXML) {
                memset(data, 0, sizeof(struct IGDdatas));
                memset(urls, 0, sizeof(struct UPNPUrls));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/miniupnpc.h 
new/miniupnpc-1.9.20160209/miniupnpc.h
--- old/miniupnpc-1.9.20151026/miniupnpc.h      2015-10-26 18:07:21.000000000 
+0100
+++ new/miniupnpc-1.9.20160209/miniupnpc.h      2016-02-09 10:44:39.000000000 
+0100
@@ -1,8 +1,8 @@
-/* $Id: miniupnpc.h,v 1.48 2015/10/08 16:19:40 nanard Exp $ */
+/* $Id: miniupnpc.h,v 1.49 2016/01/24 17:24:36 nanard Exp $ */
 /* Project: miniupnp
  * http://miniupnp.free.fr/
  * Author: Thomas Bernard
- * Copyright (c) 2005-2015 Thomas Bernard
+ * Copyright (c) 2005-2016 Thomas Bernard
  * This software is subjects to the conditions detailed
  * in the LICENCE file provided within this distribution */
 #ifndef MINIUPNPC_H_INCLUDED
@@ -19,8 +19,8 @@
 #define UPNPDISCOVER_MEMORY_ERROR (-102)
 
 /* versions : */
-#define MINIUPNPC_VERSION      "1.9.20151026"
-#define MINIUPNPC_API_VERSION  15
+#define MINIUPNPC_VERSION      "1.9.20160209"
+#define MINIUPNPC_API_VERSION  16
 
 /* Source port:
    Using "1" as an alias for 1900 for backwards compatability
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/miniwget.c 
new/miniupnpc-1.9.20160209/miniwget.c
--- old/miniupnpc-1.9.20151026/miniwget.c       2015-10-26 18:05:52.000000000 
+0100
+++ new/miniupnpc-1.9.20160209/miniwget.c       2016-02-09 10:38:58.000000000 
+0100
@@ -1,8 +1,8 @@
-/* $Id: miniwget.c,v 1.72 2015/10/26 17:05:08 nanard Exp $ */
+/* $Id: miniwget.c,v 1.75 2016/01/24 17:24:36 nanard Exp $ */
 /* Project : miniupnp
  * Website : http://miniupnp.free.fr/
  * Author : Thomas Bernard
- * Copyright (c) 2005-2015 Thomas Bernard
+ * Copyright (c) 2005-2016 Thomas Bernard
  * This software is subject to the conditions detailed in the
  * LICENCE file provided in this distribution. */
 
@@ -65,7 +65,7 @@
  * to the length parameter.
  */
 void *
-getHTTPResponse(int s, int * size)
+getHTTPResponse(int s, int * size, int * status_code)
 {
        char buf[2048];
        int n;
@@ -83,7 +83,10 @@
        unsigned int content_buf_used = 0;
        char chunksize_buf[32];
        unsigned int chunksize_buf_index;
+       char * reason_phrase = NULL;
+       int reason_phrase_len = 0;
 
+       if(status_code) *status_code = -1;
        header_buf = malloc(header_buf_len);
        if(header_buf == NULL)
        {
@@ -155,7 +158,7 @@
                                continue;
                        /* parse header lines */
                        for(i = 0; i < endofheaders - 1; i++) {
-                               if(colon <= linestart && header_buf[i]==':')
+                               if(linestart > 0 && colon <= linestart && 
header_buf[i]==':')
                                {
                                        colon = i;
                                        while(i < (endofheaders-1)
@@ -166,7 +169,29 @@
                                /* detecting end of line */
                                else if(header_buf[i]=='\r' || 
header_buf[i]=='\n')
                                {
-                                       if(colon > linestart && valuestart > 
colon)
+                                       if(linestart == 0 && status_code)
+                                       {
+                                               /* Status line
+                                                * HTTP-Version SP Status-Code 
SP Reason-Phrase CRLF */
+                                               int sp;
+                                               for(sp = 0; sp < i; sp++)
+                                                       if(header_buf[sp] == ' 
')
+                                                       {
+                                                               if(*status_code 
< 0)
+                                                                       
*status_code = atoi(header_buf + sp + 1);
+                                                               else
+                                                               {
+                                                                       
reason_phrase = header_buf + sp + 1;
+                                                                       
reason_phrase_len = i - sp - 1;
+                                                                       break;
+                                                               }
+                                                       }
+#ifdef DEBUG
+                                               printf("HTTP status code = %d, 
Reason phrase = %.*s\n",
+                                                      *status_code, 
reason_phrase_len, reason_phrase);
+#endif
+                                       }
+                                       else if(colon > linestart && valuestart 
> colon)
                                        {
 #ifdef DEBUG
                                                printf("header='%.*s', 
value='%.*s'\n",
@@ -337,7 +362,8 @@
 miniwget3(const char * host,
           unsigned short port, const char * path,
           int * size, char * addr_str, int addr_str_len,
-          const char * httpversion, unsigned int scope_id)
+          const char * httpversion, unsigned int scope_id,
+          int * status_code)
 {
        char buf[2048];
     int s;
@@ -435,7 +461,7 @@
                        sent += n;
                }
        }
-       content = getHTTPResponse(s, size);
+       content = getHTTPResponse(s, size, status_code);
        closesocket(s);
        return content;
 }
@@ -444,18 +470,20 @@
  * Call miniwget3(); retry with HTTP/1.1 if 1.0 fails. */
 static void *
 miniwget2(const char * host,
-                 unsigned short port, const char * path,
-                 int * size, char * addr_str, int addr_str_len,
-          unsigned int scope_id)
+          unsigned short port, const char * path,
+          int * size, char * addr_str, int addr_str_len,
+          unsigned int scope_id, int * status_code)
 {
        char * respbuffer;
 
 #if 1
        respbuffer = miniwget3(host, port, path, size,
-                              addr_str, addr_str_len, "1.1", scope_id);
+                              addr_str, addr_str_len, "1.1",
+                              scope_id, status_code);
 #else
        respbuffer = miniwget3(host, port, path, size,
-                              addr_str, addr_str_len, "1.0", scope_id);
+                              addr_str, addr_str_len, "1.0",
+                              scope_id, status_code);
        if (*size == 0)
        {
 #ifdef DEBUG
@@ -463,7 +491,8 @@
 #endif
                free(respbuffer);
                respbuffer = miniwget3(host, port, path, size,
-                                      addr_str, addr_str_len, "1.1", scope_id);
+                                      addr_str, addr_str_len, "1.1",
+                                      scope_id, status_code);
        }
 #endif
        return respbuffer;
@@ -588,7 +617,8 @@
 }
 
 void *
-miniwget(const char * url, int * size, unsigned int scope_id)
+miniwget(const char * url, int * size,
+         unsigned int scope_id, int * status_code)
 {
        unsigned short port;
        char * path;
@@ -601,12 +631,13 @@
        printf("parsed url : hostname='%s' port=%hu path='%s' scope_id=%u\n",
               hostname, port, path, scope_id);
 #endif
-       return miniwget2(hostname, port, path, size, 0, 0, scope_id);
+       return miniwget2(hostname, port, path, size, 0, 0, scope_id, 
status_code);
 }
 
 void *
 miniwget_getaddr(const char * url, int * size,
-                 char * addr, int addrlen, unsigned int scope_id)
+                 char * addr, int addrlen, unsigned int scope_id,
+                 int * status_code)
 {
        unsigned short port;
        char * path;
@@ -621,6 +652,6 @@
        printf("parsed url : hostname='%s' port=%hu path='%s' scope_id=%u\n",
               hostname, port, path, scope_id);
 #endif
-       return miniwget2(hostname, port, path, size, addr, addrlen, scope_id);
+       return miniwget2(hostname, port, path, size, addr, addrlen, scope_id, 
status_code);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/miniwget.h 
new/miniupnpc-1.9.20160209/miniwget.h
--- old/miniupnpc-1.9.20151026/miniwget.h       2015-07-21 15:24:16.000000000 
+0200
+++ new/miniupnpc-1.9.20160209/miniwget.h       2016-02-09 10:38:58.000000000 
+0100
@@ -1,7 +1,7 @@
-/* $Id: miniwget.h,v 1.10 2015/07/21 13:16:55 nanard Exp $ */
+/* $Id: miniwget.h,v 1.12 2016/01/24 17:24:36 nanard Exp $ */
 /* Project : miniupnp
  * Author : Thomas Bernard
- * Copyright (c) 2005-2015 Thomas Bernard
+ * Copyright (c) 2005-2016 Thomas Bernard
  * This software is subject to the conditions detailed in the
  * LICENCE file provided in this distribution.
  * */
@@ -14,11 +14,11 @@
 extern "C" {
 #endif
 
-MINIUPNP_LIBSPEC void * getHTTPResponse(int s, int * size);
+MINIUPNP_LIBSPEC void * getHTTPResponse(int s, int * size, int * status_code);
 
-MINIUPNP_LIBSPEC void * miniwget(const char *, int *, unsigned int);
+MINIUPNP_LIBSPEC void * miniwget(const char *, int *, unsigned int, int *);
 
-MINIUPNP_LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, 
unsigned int);
+MINIUPNP_LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, 
unsigned int, int *);
 
 int parseURL(const char *, char *, unsigned short *, char * *, unsigned int *);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/receivedata.c 
new/miniupnpc-1.9.20160209/receivedata.c
--- old/miniupnpc-1.9.20151026/receivedata.c    2014-11-17 10:42:42.000000000 
+0100
+++ new/miniupnpc-1.9.20160209/receivedata.c    2015-11-16 20:20:49.000000000 
+0100
@@ -1,4 +1,4 @@
-/* $Id: receivedata.c,v 1.6 2014/11/13 13:51:52 nanard Exp $ */
+/* $Id: receivedata.c,v 1.7 2015/11/09 21:51:41 nanard Exp $ */
 /* Project : miniupnp
  * Website : http://miniupnp.free.fr/
  * Author : Thomas Bernard
@@ -40,7 +40,7 @@
             char * data, int length,
             int timeout, unsigned int * scope_id)
 {
-#if MINIUPNPC_GET_SRC_ADDR
+#ifdef MINIUPNPC_GET_SRC_ADDR
        struct sockaddr_storage src_addr;
        socklen_t src_addr_len = sizeof(src_addr);
 #endif /* MINIUPNPC_GET_SRC_ADDR */
@@ -80,7 +80,7 @@
         return 0;
     }
 #endif /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) 
*/
-#if MINIUPNPC_GET_SRC_ADDR
+#ifdef MINIUPNPC_GET_SRC_ADDR
        memset(&src_addr, 0, sizeof(src_addr));
        n = recvfrom(socket, data, length, 0,
                     (struct sockaddr *)&src_addr, &src_addr_len);
@@ -90,7 +90,7 @@
        if(n<0) {
                PRINT_SOCKET_ERROR("recv");
        }
-#if MINIUPNPC_GET_SRC_ADDR
+#ifdef MINIUPNPC_GET_SRC_ADDR
        if (src_addr.ss_family == AF_INET6) {
                const struct sockaddr_in6 * src_addr6 = (struct sockaddr_in6 
*)&src_addr;
 #ifdef DEBUG
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/testminiwget.c 
new/miniupnpc-1.9.20160209/testminiwget.c
--- old/miniupnpc-1.9.20151026/testminiwget.c   2012-06-26 01:48:58.000000000 
+0200
+++ new/miniupnpc-1.9.20160209/testminiwget.c   2016-02-09 10:38:59.000000000 
+0100
@@ -1,7 +1,7 @@
-/* $Id: testminiwget.c,v 1.4 2012/06/23 22:35:59 nanard Exp $ */
+/* $Id: testminiwget.c,v 1.5 2016/01/24 17:24:36 nanard Exp $ */
 /* Project : miniupnp
  * Author : Thomas Bernard
- * Copyright (c) 2005-2012 Thomas Bernard
+ * Copyright (c) 2005-2016 Thomas Bernard
  * This software is subject to the conditions detailed in the
  * LICENCE file provided in this distribution.
  * */
@@ -20,15 +20,17 @@
        int size, writtensize;
        FILE *f;
        char addr[64];
+       int status_code = -1;
 
        if(argc < 3) {
                fprintf(stderr, "Usage:\t%s url file\n", argv[0]);
                fprintf(stderr, "Example:\t%s http://www.google.com/ 
out.html\n", argv[0]);
                return 1;
        }
-       data = miniwget_getaddr(argv[1], &size, addr, sizeof(addr), 0);
-       if(!data) {
-               fprintf(stderr, "Error fetching %s\n", argv[1]);
+       data = miniwget_getaddr(argv[1], &size, addr, sizeof(addr), 0, 
&status_code);
+       if(!data || (status_code != 200)) {
+               if(data) free(data);
+               fprintf(stderr, "Error %d fetching %s\n", status_code, argv[1]);
                return 1;
        }
        printf("local address : %s\n", addr);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/miniupnpc-1.9.20151026/upnpc.c 
new/miniupnpc-1.9.20160209/upnpc.c
--- old/miniupnpc-1.9.20151026/upnpc.c  2015-10-08 18:16:06.000000000 +0200
+++ new/miniupnpc-1.9.20160209/upnpc.c  2016-02-09 10:38:59.000000000 +0100
@@ -1,7 +1,7 @@
-/* $Id: upnpc.c,v 1.112 2015/10/08 16:15:48 nanard Exp $ */
+/* $Id: upnpc.c,v 1.114 2016/01/22 15:04:23 nanard Exp $ */
 /* Project : miniupnp
  * Author : Thomas Bernard
- * Copyright (c) 2005-2015 Thomas Bernard
+ * Copyright (c) 2005-2016 Thomas Bernard
  * This software is subject to the conditions detailed in the
  * LICENCE file provided in this distribution. */
 
@@ -66,7 +66,7 @@
        char connectionType[64];
        char status[64];
        char lastconnerr[64];
-       unsigned int uptime;
+       unsigned int uptime = 0;
        unsigned int brUp, brDown;
        time_t timenow, timestarted;
        int r;
@@ -82,9 +82,11 @@
        else
                printf("Status : %s, uptime=%us, LastConnectionError : %s\n",
                       status, uptime, lastconnerr);
-       timenow = time(NULL);
-       timestarted = timenow - uptime;
-       printf("  Time started : %s", ctime(&timestarted));
+       if(uptime > 0) {
+               timenow = time(NULL);
+               timestarted = timenow - uptime;
+               printf("  Time started : %s", ctime(&timestarted));
+       }
        if(UPNP_GetLinkLayerMaxBitRates(urls->controlURL_CIF, 
data->CIF.servicetype,
                                        &brDown, &brUp) != UPNPCOMMAND_SUCCESS) 
{
                printf("GetLinkLayerMaxBitRates failed.\n");
@@ -538,7 +540,7 @@
        char ** commandargv = 0;
        int commandargc = 0;
        struct UPNPDev * devlist = 0;
-       char lanaddr[64];       /* my ip address on the LAN */
+       char lanaddr[64] = "unset";     /* my ip address on the LAN */
        int i;
        const char * rootdescurl = 0;
        const char * multicastif = 0;
@@ -560,7 +562,7 @@
        }
 #endif
     printf("upnpc : miniupnpc library test client, version %s.\n", 
MINIUPNPC_VERSION_STRING);
-       printf(" (c) 2005-2015 Thomas Bernard.\n");
+       printf(" (c) 2005-2016 Thomas Bernard.\n");
     printf("Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/\n";
               "for more information.\n");
        /* command line processing */


Reply via email to