Commit 417c8fb6 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

16 tests OK

parent 85efa64c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -145,11 +145,18 @@ sub runhttpserver {

    if ( $data =~ /WE ROOLZ(: |)(\d*)/ ) {
        $pid = 0+$2;

        if(!$pid) {
            print "Test server already running with unkown pid! Use it...\n";
            return;
        }

        if($verbose) {
            print "Test server already running with pid $pid, killing it...\n";
        }
    }
    elsif($data ne "") {
        print "GOT: $data\n";
        print "An alien HTTP server is running on port $HOSTPORT\n",
        "Edit runtests.pl to use another port and rerun the test script\n";
        exit;
+15 −5
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ char *spitout(FILE *stream, char *main, char *sub, int *size);

#define TEST_DATA_PATH "data/test%d"

static char *docfriends = "WE ROOLZ\r\n";
static char *docfriends = "HTTP/1.1 200 Mighty fine indeed\r\n\r\nWE ROOLZ\r\n";
static char *doc404 = "HTTP/1.1 404 Not Found\n"
    "Server: " VERSION "\n"
    "Connection: close\n"
@@ -125,7 +125,7 @@ void storerequest(char *reqbuf)
{
  FILE *dump;

  dump = fopen(REQUEST_DUMP, "wb"); /* b is for windows-preparing */
  dump = fopen(REQUEST_DUMP, "ab"); /* b is for windows-preparing */
  if(dump) {
    fwrite(reqbuf, 1, strlen(reqbuf), dump);

@@ -144,6 +144,7 @@ static int get_request(int sock, int *part)
  char request[REQUEST_KEYWORD_SIZE];
  unsigned int offset = 0;
  int prot_major, prot_minor;
  char logbuf[256];

  *part = 0; /* part zero equals none */

@@ -189,7 +190,12 @@ static int get_request(int sock, int *part)

    /* get the number after it */
    if(ptr) {
      if(!strcmp("/verifiedserver", ptr)) {

      sprintf(logbuf, "Got request: %s %s HTTP/%d.%d",
              request, doc, prot_major, prot_minor);
      logmsg(logbuf);

      if(!strncmp("/verifiedserver", ptr, 15)) {
        logmsg("Are-we-friendly question received");
        return -2;
      }
@@ -203,7 +209,8 @@ static int get_request(int sock, int *part)
        test_no /= 10000;
      }

      logmsg("Found test number in PATH");
      sprintf(logbuf, "Found test number %d in path", test_no);
      logmsg(logbuf);
    }
    else {

@@ -238,6 +245,8 @@ static int send_doc(int sock, int doc, int part_no)
      buffer = doc404;
    ptr = NULL;
    stream=NULL;

    count = strlen(buffer);
  }
  else {
    sprintf(filename, TEST_DATA_PATH, doc);
@@ -258,6 +267,7 @@ static int send_doc(int sock, int doc, int part_no)
  do {
    written = send(sock, buffer, count, 0);
    if (written < 0) {
      if(stream)
        fclose(stream);
      return -1;
    }