diff options
-rw-r--r-- | docs/LINKS | 1 | ||||
-rwxr-xr-x | tests/fetcher/test1.cpp | 11 |
2 files changed, 12 insertions, 0 deletions
@@ -31,6 +31,7 @@ http://www.makeuseof.com/tag/build-basic-web-crawler-pull-information-website/ Streams http://www.mr-edd.co.uk/blog/beginners_guide_streambuf +http://www.codeproject.com/Articles/4457/zipstream-bzip2stream-iostream-wrappers-for-the-zl Lua embedding diff --git a/tests/fetcher/test1.cpp b/tests/fetcher/test1.cpp index 9e5502d..0355500 100755 --- a/tests/fetcher/test1.cpp +++ b/tests/fetcher/test1.cpp @@ -70,6 +70,17 @@ int main( int argc, char *argv[] ) URL url = normalizer.parseUrl( urlString ); RewindInputStream *s = fetcher->fetch( url ); + if( !s->good( ) ) { + cerr << "Failed to fetch '" << url << "': " << s->lastErrMsg( ) << endl; + delete s; +#ifdef USE_MODULELOADER + fetchers.destroy( fetcher ); +#else + delete fetcher; +#endif + return 1; + } + copy_stream( *s, cout ); // s->rewind( ); // copy_stream( *s, cout ); |