~ubuntu-branches/ubuntu/oneiric/curl/oneiric

« back to all changes in this revision

Viewing changes to tests/server/sws.c

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2011-01-26 02:50:18 UTC
  • mfrom: (3.4.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110126025018-dzgm2m2t5d1vc9y4
Tags: 7.21.3-1ubuntu1
* Merge from debian unstable.  Remaining changes: (LP: #707756)
  - debian/control:
    + Build-Depends: Replace libssh2-1-dev with openssh-server.
      Drop stunnel since it's in universe, as well.
    + Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.
    Above changes are necessary to be independent from the universe.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
#include "curlx.h" /* from the private lib dir */
60
60
#include "getpart.h"
61
61
#include "util.h"
 
62
#include "server_sockaddr.h"
62
63
 
63
64
/* include memdebug.h last */
64
65
#include "memdebug.h"
162
163
  DOCNUMBER_404     = -1
163
164
};
164
165
 
165
 
const char *end_of_headers = END_OF_HEADERS;
 
166
static const char *end_of_headers = END_OF_HEADERS;
166
167
 
167
168
/* sent as reply to a QUIT */
168
169
static const char *docquit =
466
467
          /* if the host name starts with test, the port number used in the
467
468
             CONNECT line will be used as test number! */
468
469
          char *portp = strchr(doc, ':');
469
 
          if(portp)
470
 
            req->testno = atoi(portp+1);
 
470
          if(portp && (*(portp+1) != '\0') && ISDIGIT(*(portp+1)))
 
471
            req->testno = strtol(portp+1, NULL, 10);
471
472
          else
472
473
            req->testno = DOCNUMBER_CONNECT;
473
474
        }
761
762
  while(!done_processing && (req->offset < REQBUFSIZ-1)) {
762
763
    if(pipereq_length && pipereq) {
763
764
      memmove(reqbuf, pipereq, pipereq_length);
764
 
      got = pipereq_length;
 
765
      got = curlx_uztosz(pipereq_length);
765
766
      pipereq_length = 0;
766
767
    }
767
768
    else {
1116
1117
 
1117
1118
int main(int argc, char *argv[])
1118
1119
{
1119
 
  struct sockaddr_in me;
1120
 
#ifdef ENABLE_IPV6
1121
 
  struct sockaddr_in6 me6;
1122
 
#endif /* ENABLE_IPV6 */
 
1120
  srvr_sockaddr_union_t me;
1123
1121
  curl_socket_t sock = CURL_SOCKET_BAD;
1124
1122
  curl_socket_t msgsock = CURL_SOCKET_BAD;
1125
1123
  int wrotepidfile = 0;
1260
1258
#ifdef ENABLE_IPV6
1261
1259
  if(!use_ipv6) {
1262
1260
#endif
1263
 
    memset(&me, 0, sizeof(me));
1264
 
    me.sin_family = AF_INET;
1265
 
    me.sin_addr.s_addr = INADDR_ANY;
1266
 
    me.sin_port = htons(port);
1267
 
    rc = bind(sock, (struct sockaddr *) &me, sizeof(me));
 
1261
    memset(&me.sa4, 0, sizeof(me.sa4));
 
1262
    me.sa4.sin_family = AF_INET;
 
1263
    me.sa4.sin_addr.s_addr = INADDR_ANY;
 
1264
    me.sa4.sin_port = htons(port);
 
1265
    rc = bind(sock, &me.sa, sizeof(me.sa4));
1268
1266
#ifdef ENABLE_IPV6
1269
1267
  }
1270
1268
  else {
1271
 
    memset(&me6, 0, sizeof(me6));
1272
 
    me6.sin6_family = AF_INET6;
1273
 
    me6.sin6_addr = in6addr_any;
1274
 
    me6.sin6_port = htons(port);
1275
 
    rc = bind(sock, (struct sockaddr *) &me6, sizeof(me6));
 
1269
    memset(&me.sa6, 0, sizeof(me.sa6));
 
1270
    me.sa6.sin6_family = AF_INET6;
 
1271
    me.sa6.sin6_addr = in6addr_any;
 
1272
    me.sa6.sin6_port = htons(port);
 
1273
    rc = bind(sock, &me.sa, sizeof(me.sa6));
1276
1274
  }
1277
1275
#endif /* ENABLE_IPV6 */
1278
1276
  if(0 != rc) {