[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#139710: first version of https support available



On Thu, 4 Apr 2002, Tomas Pospisek wrote:

> Yes it would be nice if it was that easy. The problem is this:
> If I subclass CircleBuf (say CircleBufSSL), then everbody who has a
> CircleBuf member has to replace it by the CircleBuffSSL version along with

Er.

That is not really how subclassing is ment to work at all, the entire
point is that everyone will just keep using a normal CircleBuf and
magically get redirected to a SSL verison.

This does mean changing all CircleBuf instances to a pointer and using new
to allocate the correct varient.

So you would probably simply write this:

class CircleBufSSL : public CircleBuf
{
   SSL *ctx;
   public:

   virtual bool Read(int Fd);
   virtual bool Write(int Fd);

   CircleBufSSL(SSL *ctx);
}

[..]
   if (https)
   {
       In = new CircleBufSSL(ssl);
       Out = new CircleBufSSL(ssl);
   }
   else
   {
       In = new CircleBuf();
       Out = new CircleBuf();
   }

Templates are not a solution to this problem, the code above is by no
means correct or complete. There are several other little details, like
the Read(int fd) stuff is kind of a misnomer since the class is no longer
symetric, but that's an easy change..

> > Making 'ProxyStr' a string is silly, it is never assigned to anything but
> > a constant.

> Well, I have tried out the alternatives: char * and just replacing http
> everywhere by:

Why would you do that? ProxyStr is only used as an argument to getenv,
if you make it a 'const char *' and take out the .c_str() then you have
done all I asked.

Jason



-- 
To UNSUBSCRIBE, email to deity-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: