Changeset 10472
- Timestamp:
- Apr 13, 2010, 12:11:34 AM (13 years ago)
- 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.11 1 2010/04/05 20:36:59nanard Exp $1 $Id: Changelog.txt,v 1.113 2010/04/12 20:39:40 nanard Exp $ 2 2 miniUPnP client Changelog. 3 4 2010/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 8 2010/04/07: 9 avoid returning duplicates in upnpDiscover() 3 10 4 11 2010/04/05: -
trunk/third-party/miniupnp/minisoap.c
r10285 r10472 1 /* $Id: minisoap.c,v 1.1 8 2009/12/04 11:29:18nanard Exp $ */1 /* $Id: minisoap.c,v 1.19 2010/04/12 20:39:41 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * Author : Thomas Bernard … … 76 76 unsigned short port, 77 77 const char * action, 78 const char * body) 78 const char * body, 79 const char * httpversion) 79 80 { 80 81 int bodysize; … … 94 95 snprintf(portstr, sizeof(portstr), ":%hu", port); 95 96 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" 98 98 "Host: %s%s\r\n" 99 99 "User-Agent: " OS_STRING ", UPnP/1.0, MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" … … 105 105 "Pragma: no-cache\r\n" 106 106 "\r\n", 107 url, h ost, portstr, bodysize, action);107 url, httpversion, host, portstr, bodysize, action); 108 108 #ifdef DEBUG 109 109 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:34nanard Exp $ */1 /* $Id: minisoap.h,v 1.4 2010/04/12 20:39:41 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * Author : Thomas Bernard … … 10 10 /*int httpWrite(int, const char *, int, const char *);*/ 11 11 int soapPostSubmit(int, const char *, const char *, unsigned short, 12 12 const char *, const char *, const char *); 13 13 14 14 #endif -
trunk/third-party/miniupnp/miniupnpc.c
r10460 r10472 1 /* $Id: miniupnpc.c,v 1. 78 2010/04/05 20:36:59nanard Exp $ */1 /* $Id: miniupnpc.c,v 1.80 2010/04/12 20:39:41 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * Author : Thomas BERNARD … … 15 15 #define __BSD_VISIBLE 1 16 16 #endif 17 #endif18 19 #ifdef __APPLE__20 #define _DARWIN_C_SOURCE21 17 #endif 22 18 … … 173 169 } 174 170 175 /* simpleUPnPcommand :171 /* simpleUPnPcommand2 : 176 172 * not so simple ! 177 173 * return values : 178 174 * 0 - OK 179 175 * -1 - error */ 180 int simpleUPnPcommand(int s, const char * url, const char * service,181 182 char * buffer, int * bufsize)176 static 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) 183 179 { 184 180 char hostname[MAXHOSTNAMELEN+1]; … … 268 264 } 269 265 270 n = soapPostSubmit(s, path, hostname, port, soapact, soapbody );266 n = soapPostSubmit(s, path, hostname, port, soapact, soapbody, httpversion); 271 267 if(n<=0) { 272 268 #ifdef DEBUG … … 299 295 closesocket(s); 300 296 return 0; 297 } 298 299 /* simpleUPnPcommand : 300 * not so simple ! 301 * return values : 302 * 0 - OK 303 * -1 - error */ 304 int 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; 301 321 } 302 322 … … 590 610 if(st&&descURL) 591 611 { 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; 594 627 tmp = (struct UPNPDev *)malloc(sizeof(struct UPNPDev)+urlsize+stsize); 595 628 tmp->pNext = devlist; -
trunk/third-party/miniupnp/miniwget.c
r10447 r10472 1 /* $Id: miniwget.c,v 1.3 6 2010/04/05 12:34:05nanard Exp $ */1 /* $Id: miniwget.c,v 1.37 2010/04/12 20:39:42 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * Author : Thomas Bernard … … 42 42 #include "connecthostport.h" 43 43 44 /* miniwget 2() :44 /* miniwget3() : 45 45 * do all the work. 46 46 * Return NULL if something failed. */ 47 47 static void * 48 miniwget 2(const char * url, const char * host,48 miniwget3(const char * url, const char * host, 49 49 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) 51 51 { 52 52 char buf[2048]; … … 104 104 105 105 len = snprintf(buf, sizeof(buf), 106 "GET %s HTTP/ 1.0\r\n"106 "GET %s HTTP/%s\r\n" 107 107 "Host: %s:%d\r\n" 108 108 "Connection: Close\r\n" … … 110 110 111 111 "\r\n", 112 path, host, port);112 path, httpversion, host, port); 113 113 sent = 0; 114 114 /* sending the HTTP request */ … … 177 177 } 178 178 179 /* miniwget2() : 180 * Call miniwget3(); retry with HTTP/1.1 if 1.0 fails. */ 181 static void * 182 miniwget2(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 179 203 /* parseURL() 180 204 * arguments :
Note: See TracChangeset
for help on using the changeset viewer.