Changeset 10472


Ignore:
Timestamp:
Apr 13, 2010, 12:11:34 AM (13 years ago)
Author:
livings124
Message:

update miniupnp to 20100412

Location:
trunk/third-party/miniupnp
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/miniupnp/Changelog.txt

    r10460 r10472  
    1 $Id: Changelog.txt,v 1.111 2010/04/05 20:36:59 nanard Exp $
     1$Id: Changelog.txt,v 1.113 2010/04/12 20:39:40 nanard Exp $
    22miniUPnP client Changelog.
     3
     42010/04/12:
     5  Retrying with HTTP/1.1 if HTTP/1.0 failed. see
     6  http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=1703
     7
     82010/04/07:
     9  avoid returning duplicates in upnpDiscover()
    310
    4112010/04/05:
  • trunk/third-party/miniupnp/minisoap.c

    r10285 r10472  
    1 /* $Id: minisoap.c,v 1.18 2009/12/04 11:29:18 nanard Exp $ */
     1/* $Id: minisoap.c,v 1.19 2010/04/12 20:39:41 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas Bernard
     
    7676                                   unsigned short port,
    7777                                   const char * action,
    78                                    const char * body)
     78                                   const char * body,
     79                                   const char * httpversion)
    7980{
    8081        int bodysize;
     
    9495                snprintf(portstr, sizeof(portstr), ":%hu", port);
    9596        headerssize = snprintf(headerbuf, sizeof(headerbuf),
    96 /*                       "POST %s HTTP/1.1\r\n" */
    97                        "POST %s HTTP/1.0\r\n"
     97                       "POST %s HTTP/%s\r\n"
    9898                           "Host: %s%s\r\n"
    9999                                           "User-Agent: " OS_STRING ", UPnP/1.0, MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
     
    105105                                           "Pragma: no-cache\r\n"
    106106                                           "\r\n",
    107                                            url, host, portstr, bodysize, action);
     107                                           url, httpversion, host, portstr, bodysize, action);
    108108#ifdef DEBUG
    109109        printf("SOAP request : headersize=%d bodysize=%d\n",
  • trunk/third-party/miniupnp/minisoap.h

    r3731 r10472  
    1 /* $Id: minisoap.h,v 1.3 2006/11/19 22:32:34 nanard Exp $ */
     1/* $Id: minisoap.h,v 1.4 2010/04/12 20:39:41 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas Bernard
     
    1010/*int httpWrite(int, const char *, int, const char *);*/
    1111int soapPostSubmit(int, const char *, const char *, unsigned short,
    12                                   const char *, const char *);
     12                   const char *, const char *, const char *);
    1313
    1414#endif
  • trunk/third-party/miniupnp/miniupnpc.c

    r10460 r10472  
    1 /* $Id: miniupnpc.c,v 1.78 2010/04/05 20:36:59 nanard Exp $ */
     1/* $Id: miniupnpc.c,v 1.80 2010/04/12 20:39:41 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas BERNARD
     
    1515#define __BSD_VISIBLE 1
    1616#endif
    17 #endif
    18 
    19 #ifdef __APPLE__
    20 #define _DARWIN_C_SOURCE
    2117#endif
    2218
     
    173169}
    174170
    175 /* simpleUPnPcommand :
     171/* simpleUPnPcommand2 :
    176172 * not so simple !
    177173 * return values :
    178174 *   0 - OK
    179175 *  -1 - error */
    180 int simpleUPnPcommand(int s, const char * url, const char * service,
    181                       const char * action, struct UPNParg * args,
    182                       char * buffer, int * bufsize)
     176static int simpleUPnPcommand2(int s, const char * url, const char * service,
     177                       const char * action, struct UPNParg * args,
     178                       char * buffer, int * bufsize, const char * httpversion)
    183179{
    184180        char hostname[MAXHOSTNAMELEN+1];
     
    268264        }
    269265
    270         n = soapPostSubmit(s, path, hostname, port, soapact, soapbody);
     266        n = soapPostSubmit(s, path, hostname, port, soapact, soapbody, httpversion);
    271267        if(n<=0) {
    272268#ifdef DEBUG
     
    299295        closesocket(s);
    300296        return 0;
     297}
     298
     299/* simpleUPnPcommand :
     300 * not so simple !
     301 * return values :
     302 *   0 - OK
     303 *  -1 - error */
     304int simpleUPnPcommand(int s, const char * url, const char * service,
     305                       const char * action, struct UPNParg * args,
     306                       char * buffer, int * bufsize)
     307{
     308        int result;
     309        int origbufsize = *bufsize;
     310
     311        result = simpleUPnPcommand2(s, url, service, action, args, buffer, bufsize, "1.0");
     312        if (result < 0 || *bufsize == 0)
     313        {
     314#if DEBUG
     315            printf("Error or no result from SOAP request; retrying with HTTP/1.1\n");
     316#endif
     317                *bufsize = origbufsize;
     318                result = simpleUPnPcommand2(s, url, service, action, args, buffer, bufsize, "1.1");
     319        }
     320        return result;
    301321}
    302322
     
    590610                if(st&&descURL)
    591611                {
    592                         /*printf("M-SEARCH Reply:\nST: %.*s\nLocation: %.*s\n",
    593                                stsize, st, urlsize, descURL); */
     612#ifdef DEBUG
     613                        printf("M-SEARCH Reply:\nST: %.*s\nLocation: %.*s\n",
     614                               stsize, st, urlsize, descURL);
     615#endif
     616                        for(tmp=devlist; tmp; tmp = tmp->pNext) {
     617                                if(memcmp(tmp->descURL, descURL, urlsize) == 0 &&
     618                                   tmp->descURL[urlsize] == '\0' &&
     619                                   memcmp(tmp->st, st, stsize) == 0 &&
     620                                   tmp->st[stsize] == '\0')
     621                                        break;
     622                        }
     623                        /* at the exit of the loop above, tmp is null if
     624                         * no duplicate device was found */
     625                        if(tmp)
     626                                continue;
    594627                        tmp = (struct UPNPDev *)malloc(sizeof(struct UPNPDev)+urlsize+stsize);
    595628                        tmp->pNext = devlist;
  • trunk/third-party/miniupnp/miniwget.c

    r10447 r10472  
    1 /* $Id: miniwget.c,v 1.36 2010/04/05 12:34:05 nanard Exp $ */
     1/* $Id: miniwget.c,v 1.37 2010/04/12 20:39:42 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas Bernard
     
    4242#include "connecthostport.h"
    4343
    44 /* miniwget2() :
     44/* miniwget3() :
    4545 * do all the work.
    4646 * Return NULL if something failed. */
    4747static void *
    48 miniwget2(const char * url, const char * host,
     48miniwget3(const char * url, const char * host,
    4949                  unsigned short port, const char * path,
    50                   int * size, char * addr_str, int addr_str_len)
     50                  int * size, char * addr_str, int addr_str_len, const char * httpversion)
    5151{
    5252        char buf[2048];
     
    104104
    105105        len = snprintf(buf, sizeof(buf),
    106                  "GET %s HTTP/1.0\r\n"
     106                 "GET %s HTTP/%s\r\n"
    107107                             "Host: %s:%d\r\n"
    108108                                 "Connection: Close\r\n"
     
    110110
    111111                                 "\r\n",
    112                     path, host, port);
     112                           path, httpversion, host, port);
    113113        sent = 0;
    114114        /* sending the HTTP request */
     
    177177}
    178178
     179/* miniwget2() :
     180 * Call miniwget3(); retry with HTTP/1.1 if 1.0 fails. */
     181static void *
     182miniwget2(const char * url, const char * host,
     183                  unsigned short port, const char * path,
     184                  int * size, char * addr_str, int addr_str_len)
     185{
     186        char * respbuffer;
     187
     188        respbuffer = miniwget3(url, host, port, path, size, addr_str, addr_str_len, "1.0");
     189        if (*size == 0)
     190        {
     191#ifdef DEBUG
     192                printf("Retrying with HTTP/1.1\n");
     193#endif
     194                free(respbuffer);
     195                respbuffer = miniwget3(url, host, port, path, size, addr_str, addr_str_len, "1.1");
     196        }
     197        return respbuffer;
     198}
     199
     200
     201
     202
    179203/* parseURL()
    180204 * arguments :
Note: See TracChangeset for help on using the changeset viewer.