Ignore:
Timestamp:
Feb 21, 2008, 2:38:01 PM (14 years ago)
Author:
charles
Message:

update to miniupnp-20080217

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/miniupnp/minisoap.c

    r4251 r5087  
    1 /* $Id: minisoap.c,v 1.12 2007/12/13 17:09:03 nanard Exp $ */
     1/* $Id: minisoap.c,v 1.14 2008/02/16 23:46:11 nanard Exp $ */
    22/* Project : miniupnp
    33 * Author : Thomas Bernard
     
    2424#include <stdlib.h>
    2525
     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
    2632/* httpWrite sends the headers and the body to the socket
    2733 * and returns the number of bytes sent */
     
    3743         * soap request that are sent into only one packet */
    3844        char * p;
     45        /* TODO: AVOID MALLOC */
    3946        p = malloc(headerssize+bodysize);
    4047        memcpy(p, headers, headerssize);
     
    4249        /*n = write(fd, p, headerssize+bodysize);*/
    4350        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
    4457#ifdef WIN32
    45         shutdown(fd, SD_SEND);
     58        if(shutdown(fd, SD_SEND)<0) {
    4659#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        }
    4864#endif
    4965        free(p);
     
    6682         * HTTP/1.1 needs the header Connection: close to do that.
    6783         * This is the default with HTTP/1.0 */
     84    /* Connection: Close is normally there only in HTTP/1.1 but who knows */
    6885        headerssize = snprintf(headerbuf, sizeof(headerbuf),
    6986/*                       "POST %s HTTP/1.1\r\n"*/
     
    7491                                           "Content-Type: text/xml\r\n"
    7592                                           "SOAPAction: \"%s\"\r\n"
    76 /*                                         "Connection: Close\r\n" */
     93                                           "Connection: Close\r\n"
    7794                                           "\r\n",
    7895                                           url, host, port, bodysize, action);
Note: See TracChangeset for help on using the changeset viewer.