WvStreams
wvhttpcomponent.cc
00001 /*
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  * 
00005  * Componentization stuff for wvhttppool.h.  Constitutes cheating.
00006  */
00007 #include "wvhttppool.h"
00008 #include "wvmoniker.h"
00009 #include "wvistreamlist.h"
00010 
00011 static WvHttpPool *pool;
00012 
00013 
00014 static void pool_init()
00015 {
00016     // FIXME: we never free it!
00017     if (!pool)
00018     {
00019         pool = new WvHttpPool;
00020         WvIStreamList::globallist.append(pool, false, "pool_init urlpool");
00021     }
00022 }
00023 
00024 
00025 static IWvStream *creator(WvStringParm s, IObject*)
00026 {
00027     pool_init();
00028     return pool->addurl(WvString("http:%s", s), "GET");
00029 }
00030 
00031 
00032 static IWvStream *screator(WvStringParm s, IObject*)
00033 {
00034     pool_init();
00035     return pool->addurl(WvString("https:%s", s), "GET");
00036 }
00037 
00038 
00039 static WvMoniker<IWvStream> reg("http", creator);
00040 static WvMoniker<IWvStream> regs("https", screator);