From: Gabriele B. <an...@us...> - 2001-12-16 19:28:57
|
Ciao guys, After ages, I can swear I was missing you! :-) Anyway, this week-end I could finally work again on both ht://Check and ht://Dig (a bit). I was concerned about looking at the changes done on the htnet library on ht://Dig and port them on ht://Check. I found a few changes were done so I looked at them and compared with ht://Check code, in order to make it the same. I came up with a few ideas regarding especially the management of this *holy* connection dynamic object. After this class on C++ I attended in Melbourne, I feel much stronger on the subject and also on OO. Anyway, I noticed that the connection object is not always needed (because for instance not all of the Transport derived object use it - i.e.HtFile) and the pointer that manages it is hold by the Transport class. Also now we have 2 different types of connections, the 'basic' and the 'SSL' one. I reasonably think that, in order to avoid double deletes, we *must* give responsability of this to one particular class: the one I find the most adapt, is the Transport one. Let me clearify that this can also *not happen* (HtFile again). As far as the Transport class is concerned, I decided to change the default constructor: Transport::Transport() becomes now Transport::Transport(Connection* connection = 0). This *trick* I think is very useful later on. Let me explain. HTTP needs a connection, right? so I forced the constructor to be: HtHTTP::HtHTTP(Connection&) and the HtHTTP::HtHTTP() to be private and empty, which avoids any possible default creation by a compiler. As long as I wrote the destructor to be virtual and pure, HtHTTP is now an abstract class (which is what we want). The derived classes are HtHTTPBasic and HtHTTPSecure, which *must* create a Connection object (SSLConnection in the latter one, but it is derived from Connection - so no problem). The default constructor of HtHTTPBasic is now very short, because it has to call the HtHTTP constructor by passing a new allocated Connection object: HtHTTPBasic::HtHTTPBasic() : HtHTTP(*(new Connection)) [...] and the Secure version is very similar. I also tried to clean a bit the constructors (paying attention to the initialization list). As far as the Connection class is concerned, I decided to remove one constructor, which -I think- can give us only maintanance troubles: I am talking about the default one, which now is: Connection::Connection(int socket = -1) I hope everything is fine and I have not made any mistake. So guys, pllease give me the *welcome back*, I need encouragements! :-) Ciao ciao -Gabriele -- Gabriele Bartolini - Web Programmer Current Location: Prato, Tuscany, Italy an...@us... | http://www.prato.linux.it/~gbartolini | ICQ#129221447 > find bin/laden -name osama -exec rm {} \; |