Changeset 5087
- Timestamp:
- Feb 21, 2008, 2:38:01 PM (14 years ago)
- Location:
- trunk/third-party/miniupnp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/third-party/miniupnp/minisoap.c
r4251 r5087 1 /* $Id: minisoap.c,v 1.1 2 2007/12/13 17:09:03nanard Exp $ */1 /* $Id: minisoap.c,v 1.14 2008/02/16 23:46:11 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * Author : Thomas Bernard … … 24 24 #include <stdlib.h> 25 25 26 #ifdef WIN32 27 #define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError()); 28 #else 29 #define PRINT_SOCKET_ERROR(x) perror(x) 30 #endif 31 26 32 /* httpWrite sends the headers and the body to the socket 27 33 * and returns the number of bytes sent */ … … 37 43 * soap request that are sent into only one packet */ 38 44 char * p; 45 /* TODO: AVOID MALLOC */ 39 46 p = malloc(headerssize+bodysize); 40 47 memcpy(p, headers, headerssize); … … 42 49 /*n = write(fd, p, headerssize+bodysize);*/ 43 50 n = send(fd, p, headerssize+bodysize, 0); 51 if(n<0) { 52 PRINT_SOCKET_ERROR("send"); 53 } 54 /* disable send on the socket */ 55 /* draytek routers dont seems to like that... */ 56 #if 0 44 57 #ifdef WIN32 45 shutdown(fd, SD_SEND);58 if(shutdown(fd, SD_SEND)<0) { 46 59 #else 47 shutdown(fd, SHUT_WR); /*SD_SEND*/ 60 if(shutdown(fd, SHUT_WR)<0) { /*SD_SEND*/ 61 #endif 62 PRINT_SOCKET_ERROR("shutdown"); 63 } 48 64 #endif 49 65 free(p); … … 66 82 * HTTP/1.1 needs the header Connection: close to do that. 67 83 * This is the default with HTTP/1.0 */ 84 /* Connection: Close is normally there only in HTTP/1.1 but who knows */ 68 85 headerssize = snprintf(headerbuf, sizeof(headerbuf), 69 86 /* "POST %s HTTP/1.1\r\n"*/ … … 74 91 "Content-Type: text/xml\r\n" 75 92 "SOAPAction: \"%s\"\r\n" 76 /* "Connection: Close\r\n" */ 93 "Connection: Close\r\n" 77 94 "\r\n", 78 95 url, host, port, bodysize, action); -
trunk/third-party/miniupnp/miniupnpc.c
r4251 r5087 1 /* $Id: miniupnpc.c,v 1. 49 2007/12/19 14:58:54nanard Exp $ */1 /* $Id: miniupnpc.c,v 1.50 2008/02/03 22:19:45 nanard Exp $ */ 2 2 /* Project : miniupnp 3 3 * Author : Thomas BERNARD … … 666 666 /* we should choose an internet gateway device. 667 667 * with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */ 668 if((state >= 3) || strstr(dev->st, "InternetGatewayDevice")) 668 descXML = miniwget_getaddr(dev->descURL, &descXMLsize, 669 lanaddr, lanaddrlen); 670 if(descXML) 669 671 { 670 descXML = miniwget_getaddr(dev->descURL, &descXMLsize, 671 lanaddr, lanaddrlen); 672 if(descXML) 672 ndev++; 673 memset(data, 0, sizeof(struct IGDdatas)); 674 memset(urls, 0, sizeof(struct UPNPUrls)); 675 parserootdesc(descXML, descXMLsize, data); 676 free(descXML); 677 descXML = NULL; 678 if(0==strcmp(data->servicetype_CIF, 679 "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1") 680 || state >= 3 ) 673 681 { 674 ndev++; 675 memset(data, 0, sizeof(struct IGDdatas)); 676 memset(urls, 0, sizeof(struct UPNPUrls)); 677 parserootdesc(descXML, descXMLsize, data); 678 free(descXML); 679 descXML = NULL; 680 GetUPNPUrls(urls, data, dev->descURL); 682 GetUPNPUrls(urls, data, dev->descURL); 681 683 682 684 #ifdef DEBUG 683 printf("UPNPIGD_IsConnected(%s) = %d\n", 684 urls->controlURL, 685 UPNPIGD_IsConnected(urls, data)); 686 #endif 687 if((state >= 2) || UPNPIGD_IsConnected(urls, data)) 688 return state; 689 FreeUPNPUrls(urls); 690 memset(data, 0, sizeof(struct IGDdatas)); 685 printf("UPNPIGD_IsConnected(%s) = %d\n", 686 urls->controlURL, 687 UPNPIGD_IsConnected(urls, data)); 688 #endif 689 if((state >= 2) || UPNPIGD_IsConnected(urls, data)) 690 return state; 691 FreeUPNPUrls(urls); 691 692 } 693 memset(data, 0, sizeof(struct IGDdatas)); 694 } 692 695 #ifdef DEBUG 693 else 694 { 695 printf("error getting XML description %s\n", dev->descURL); 696 } 697 #endif 696 else 697 { 698 printf("error getting XML description %s\n", dev->descURL); 698 699 } 700 #endif 699 701 } 700 702 }
Note: See TracChangeset
for help on using the changeset viewer.