Changeset 5087 for trunk/third-party/miniupnp/minisoap.c
- Timestamp:
- Feb 21, 2008, 2:38:01 PM (14 years ago)
- File:
-
- 1 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);
Note: See TracChangeset
for help on using the changeset viewer.