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

Diff of /trunk/tests/http-server-bad-body.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 126 by siliconforks, Mon Jun 2 17:53:43 2008 UTC
# 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\nConnection: close\r\nContent-type: text/html\r\nTransfer-Encoding: chunked\r\n\r\nHello\n";      char * message = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-type: text/html\r\nTransfer-Encoding: chunked\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.126

  ViewVC Help
Powered by ViewVC 1.1.24