Esempio n. 1
0
//Main method
int main(void) {

    //Execute Get Request
    TestHttpGet();
    //Execute Port Request    
    TestHttpPost();
    
    //Return    
    return 0;
}
Esempio n. 2
0
/*----------------------------------------------------------------------
|       main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
    // setup debugging
#if defined(WIN32) && defined(_DEBUG)
    int flags = _crtDbgFlag       | 
        _CRTDBG_ALLOC_MEM_DF      |
        _CRTDBG_DELAY_FREE_MEM_DF |
        _CRTDBG_CHECK_ALWAYS_DF;

    _CrtSetDbgFlag(flags);
    //AllocConsole();
    //freopen("CONOUT$", "w", stdout);
#endif 

    // check args
#if 1
    if (argc != 2) {
        NPT_Debug("HttpClient: missing URL argument\n");
        return -1;
    }
#endif

#if defined(TEST_URL)
    // test URL parsing
    TestUrlParser(NULL);
    TestUrlParser("");
    TestUrlParser("http");
    TestUrlParser("http:/");
    TestUrlParser("http://");
    TestUrlParser("http://foo");
    TestUrlParser("http://foo.bar");
    TestUrlParser("http://foo.bar:");
    TestUrlParser("http://foo.bar:1");
    TestUrlParser("http://foo.bar:176");
    TestUrlParser("http://foo.bar:176a");
    TestUrlParser("http://foo.bar:176/");
    TestUrlParser("http://foo.bar:176/blabla");
    TestUrlParser("http://foo.bar:176/blabla/blibli");
    TestUrlParser("http://foo.bar:176/blabla/blibli/");
    TestUrlParser("http://foo.bar/");
    TestUrlParser("http://foo.bar/blabla");
#endif

#if defined(TEST_CHUNKED) 
    TestHttpChunked("http://www.bok.net/cgi-bin/test/test-chunked.cgi");
#endif

#if defined(TEST_PROXY)
    TestHttpGetWithProxy(argv[1]);
#else
    TestHttpGet(argv[1], SHOW_MODE_LOAD);
    TestHttpGet(argv[1], SHOW_MODE_STREAM_BLOCKING);
#endif

#if defined(TEST_POST)
    TestHttpPost(argv[1]);
#endif

#if defined(TEST_TIMEOUTS)
    TestHttpTimeouts(argv[1]);
#endif

#if defined(WIN32) && defined(_DEBUG)
    _CrtDumpMemoryLeaks();
#endif

    return 0;
}