/[jscoverage]/trunk/tests/http-client-close-after-request.c
ViewVC logotype

Diff of /trunk/tests/http-client-close-after-request.c

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

revision 609 by siliconforks, Sat Jan 2 04:55:54 2010 UTC revision 610 by siliconforks, Fri Sep 24 20:35:36 2010 UTC
# Line 25  Line 25 
25    
26  #include "http-server.h"  #include "http-server.h"
27    
28  int main(void) {  int main(int argc, const char ** argv) {
29  #ifdef __MINGW32__  #ifdef __MINGW32__
30    WSADATA data;    WSADATA data;
31    if (WSAStartup(MAKEWORD(1, 1), &data) != 0) {    if (WSAStartup(MAKEWORD(1, 1), &data) != 0) {
# Line 33  Line 33 
33    }    }
34  #endif  #endif
35    
36      assert(argc == 2);
37      uint16_t port = (uint16_t) atoi(argv[1]);
38    
39    int result;    int result;
40    
41    struct sockaddr_in a;    struct sockaddr_in a;
42    a.sin_family = AF_INET;    a.sin_family = AF_INET;
43    a.sin_port = htons(8000);    a.sin_port = htons(port);
44    a.sin_addr.s_addr = htonl(INADDR_LOOPBACK);    a.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
45    
46    SOCKET s = socket(PF_INET, SOCK_STREAM, 0);    SOCKET s = socket(PF_INET, SOCK_STREAM, 0);
# Line 47  Line 50 
50    assert(result == 0);    assert(result == 0);
51    
52    /* send request */    /* send request */
53    char * message = "GET http://127.0.0.1:8000/ HTTP/1.1\r\nConnection: close\r\nHost: 127.0.0.1:8000\r\n\r\n";    char * message = "GET / HTTP/1.0\r\nConnection: close\r\n\r\n";
54    size_t message_length = strlen(message);    size_t message_length = strlen(message);
55    ssize_t bytes_sent = send(s, message, message_length, 0);    ssize_t bytes_sent = send(s, message, message_length, 0);
56    assert(bytes_sent == (ssize_t) message_length);    assert(bytes_sent == (ssize_t) message_length);

Legend:
Removed from v.609  
changed lines
  Added in v.610

  ViewVC Help
Powered by ViewVC 1.1.24