/[jscoverage]/trunk/tests/http-server-bad-headers.c
ViewVC logotype

Diff of /trunk/tests/http-server-bad-headers.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 114 by siliconforks, Sat May 31 21:39:39 2008 UTC revision 427 by siliconforks, Wed Feb 18 16:08:33 2009 UTC
# Line 1  Line 1 
1  /*  /*
2      http-server-bad-headers.c - HTTP server that outputs bad headers      http-server-bad-headers.c - HTTP server that outputs bad headers
3      Copyright (C) 2008 siliconforks.com      Copyright (C) 2008, 2009 siliconforks.com
4    
5      This program is free software; you can redistribute it and/or modify      This program is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published by      it under the terms of the GNU General Public License as published by
# Line 17  Line 17 
17      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */  */
19    
20    #include <config.h>
21    
22  #include <assert.h>  #include <assert.h>
23  #include <string.h>  #include <string.h>
24    
25  #include <netinet/in.h>  #include "http-server.h"
 #include <sys/socket.h>  
 #include <unistd.h>  
26    
27  int main(void) {  int main(void) {
28    int s = socket(PF_INET, SOCK_STREAM, 0);  #ifdef __MINGW32__
29    assert(s > 0);    WSADATA data;
30      if (WSAStartup(MAKEWORD(1, 1), &data) != 0) {
31        return 1;
32      }
33    #endif
34    
35      SOCKET s = socket(PF_INET, SOCK_STREAM, 0);
36      assert(s != INVALID_SOCKET);
37    
38    int optval = 1;    int optval = 1;
39    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *) &optval, sizeof(optval));    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *) &optval, sizeof(optval));
# Line 82  Line 89 
89      char * message = "HTTP/1.1 200 OK\r\nHere is some bogosity!\r\nConnection: close\r\nContent-type: text/html\r\n\r\nHello\n";      char * message = "HTTP/1.1 200 OK\r\nHere is some bogosity!\r\nConnection: close\r\nContent-type: text/html\r\n\r\nHello\n";
90      size_t message_length = strlen(message);      size_t message_length = strlen(message);
91      ssize_t bytes_sent = send(client_socket, message, message_length, 0);      ssize_t bytes_sent = send(client_socket, message, message_length, 0);
92      assert(bytes_sent == message_length);      assert(bytes_sent == (ssize_t) message_length);
93    
94      close(client_socket);      closesocket(client_socket);
95    }    }
96    return 0;    return 0;
97  }  }

Legend:
Removed from v.114  
changed lines
  Added in v.427

  ViewVC Help
Powered by ViewVC 1.1.24