ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Search/HttpHandler.cpp
(Generate patch)

Comparing trunk/Search/HttpHandler.cpp (file contents):
Revision 213 by douglas, 2003-07-19T21:07:54-07:00 vs.
Revision 348 by Douglas Thrift, 2004-05-26T17:44:17-07:00

# Line 1 | Line 1
1   /* ============================================================================
2   * Douglas Thrift's Search Engine License
3   *
4 < * Copyright (C) 2002-2003, Douglas Thrift. All Rights Reserved.
4 > * Copyright (C) 2002-2004, Douglas Thrift. All Rights Reserved.
5   * Redistribution and use in source and binary forms, with or without
6   * modification, are permitted provided that the following conditions are met:
7   *
# Line 46 | Line 46
46   //
47   // Douglas Thrift
48   //
49 < // $Id: HttpHandler.cpp,v 1.24 2003/07/20 04:07:54 douglas Exp $
49 > // $Id$
50  
51 < #include "HttpHandler.h"
51 > #include "HttpHandler.hpp"
52  
53   // Lovely C Sockets!
54   #ifndef _WIN32
# Line 283 | Line 283 | bool HttpHandler::handle(URL &url, const
283  
284   void HttpHandler::clear()
285   {
286 + #ifdef _OpenSSL_
287          if (tls)
288          {
289                  SSL_shutdown(ssl);
290                  SSL_free(ssl);
291                  SSL_CTX_free(ctx);
292          }
293 + #endif
294  
295          closesocket(http);
296  
# Line 771 | Line 773 | bool HttpHandler::starttls()
773          SSL_library_init();
774  
775   #ifndef _urandomdev_
776 <        int pid = getpid();
777 <        int now = time(NULL);
776 <
777 <        unsigned seed = now > pid ? now - pid : pid - now;
778 <
776 >        int pid(getpid()), now(time(NULL));
777 >        unsigned seed(now > pid ? now - pid : pid - now);
778          char* junk = new char[seed % 30 + 2];
779 +
780          junk[0] = pid;
781          junk[seed % 30 + 1] = now;
782  
783          srand(seed);
784  
785 <        for (int index = 1; index < seed % 30 + 1; index++)
785 >        for (size_t index = 1; index < seed % 30 + 1; index++)
786          {
787                  junk[index] = rand();
788          }
# Line 791 | Line 791 | bool HttpHandler::starttls()
791          {
792                  cerr << "junk = {\n";
793  
794 <                for (int index = 1; index < seed % 30 + 2; index++)
794 >                for (size_t index = 1; index < seed % 30 + 2; index++)
795                  {
796 <                        cerr << "   [" << index << "] = " << int(junk[index]) << "\n";
796 >                        cerr << "   [" << index << "] = " << unsigned(junk[index]) << "\n";
797                  }
798  
799                  cerr << "}\n";
# Line 802 | Line 802 | bool HttpHandler::starttls()
802          RAND_seed(junk, seed % 30 + 2);
803  
804          delete junk;
805 + #else
806 +        if (debug) cerr << "junk = /dev/urandom\n";
807   #endif
808  
809          ctx = SSL_CTX_new(TLSv1_client_method());

Comparing trunk/Search/HttpHandler.cpp (property svn:eol-style):
Revision 213 by douglas, 2003-07-19T21:07:54-07:00 vs.
Revision 348 by Douglas Thrift, 2004-05-26T17:44:17-07:00

# Line 0 | Line 1
1 + native

Comparing trunk/Search/HttpHandler.cpp (property svn:keywords):
Revision 213 by douglas, 2003-07-19T21:07:54-07:00 vs.
Revision 348 by Douglas Thrift, 2004-05-26T17:44:17-07:00

# Line 0 | Line 1
1 + Id

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines