Doug wrote:
> 
>         Now that things are running the way I want them, I started looking at
> some of the other features. When I enable the logging feature htsearch
> dumps core every time. 

        Ok, Gilles' patch fixed the logging... thanks once again. :) Here is
the complete info on the changes I made for our version of htdig. If
anyone spots something really silly, please don't hesitate to let me
know.

Doug
diff -cr htdig-3.1.0b4-stock/htlib/URL.cc htdig-3.1.0b4/htlib/URL.cc
*** htdig-3.1.0b4-stock/htlib/URL.cc    Thu Dec 24 09:20:20 1998
--- htdig-3.1.0b4/htlib/URL.cc  Thu Jan 21 12:32:17 1999
***************
*** 137,142 ****
--- 137,145 ----
      // Thanks goes to David Filiatrault <[EMAIL PROTECTED]> for suggesting
      // this removal process.
      //
+ 
+     char      *stupid_question_mark = strchr(ref, '?');
+ 
      char      *anchor = strchr(ref, '#');
      char      *params = strchr(ref, '?');
      if (anchor)
***************
*** 155,160 ****
--- 158,171 ----
        }
      }
  
+ 
+     // Well, if that works for anchors will it work for the stinkin' ?'s
+     if (stupid_question_mark)
+     {
+      *stupid_question_mark = '\0';
+     }
+     
+ 
      //
      // If, after the removal of a possible '#' we have nothing left,
      // we just want to use the base URL.
***************
*** 277,285 ****
--- 288,303 ----
      // Ignore any part of the URL that follows the '#' since this is just
      // an index into a document.
      //
+ 
+     char      *stupid_question_mark = strchr(nurl, '?');
      char      *p = strchr(nurl, '#');
      if (p)
        *p = '\0';
+ 
+     if (stupid_question_mark)
+     {
+      *stupid_question_mark = '\0';
+     }
        
      //
      // Extract the service
diff -cr htdig-3.1.0b4-stock/htsearch/Display.cc htdig-3.1.0b4/htsearch/Display.cc
*** htdig-3.1.0b4-stock/htsearch/Display.cc     Tue Dec 22 18:15:39 1998
--- htdig-3.1.0b4/htsearch/Display.cc   Fri Jan 22 15:47:11 1999
***************
*** 114,119 ****
--- 114,120 ----
  #include <ctype.h>
  #include <syslog.h>
  
+  extern char *sn_query_string;
  
  //*****************************************************************************
  //
***************
*** 351,356 ****
--- 352,359 ----
      int               matchesPerPage = config.Value("matches_per_page");
      int               nPages = (nMatches + matchesPerPage - 1) / matchesPerPage;
  
+     vars.Add("SN_QUERY_STRING", new String(sn_query_string));
+ 
      if (nPages < 1)
        nPages = 1;                     // We always have at least one page...
      vars.Add("MATCHES_PER_PAGE", new String(config["matches_per_page"]));
***************
*** 498,503 ****
--- 501,511 ----
        s << "format=" << input->get("format") << '&';
      if (input->exists("matchesperpage"))
        s << "matchesperpage=" << input->get("matchesperpage") << '&';
+ 
+ // Add query string
+     if (sn_query_string)
+         s << "SN_query_string=" << sn_query_string << '&';
+ 
      if (input->exists("words"))
        s << "words=" << input->get("words") << '&';
      s << "page=" << pageNumber;
***************
*** 1023,1037 ****
      int         level = LOG_LEVEL;
      int         facility = LOG_FACILITY;
  
      if (matches)
        nMatches = matches->Count();
  
      openlog("htsearch", LOG_PID, facility);
      syslog(level, "%s [%s] (%s) [%s] [%s] (%d/%s) - %d -- %s\n",
!          getenv("REMOTE_HOST"),
           input->exists("config") ? input->get("config") : "default",
           config["match_method"], input->get("words"), logicalWords.get(),
           nMatches, config["matches_per_page"],
!          page, getenv("HTTP_REFERER")
           );
  }
--- 1031,1056 ----
      int         level = LOG_LEVEL;
      int         facility = LOG_FACILITY;
  
+     char        *host = getenv("REMOTE_HOST");
+     char        *ref = getenv("HTTP_REFERER");
+     
+     if (host == NULL)
+        host = getenv("REMOTE_ADDR");
+     if (host == NULL)
+        host = "-";
+ 
+     if (ref == NULL)
+        ref = "-";
+ 
      if (matches)
        nMatches = matches->Count();
  
      openlog("htsearch", LOG_PID, facility);
      syslog(level, "%s [%s] (%s) [%s] [%s] (%d/%s) - %d -- %s\n",
!          host,
           input->exists("config") ? input->get("config") : "default",
           config["match_method"], input->get("words"), logicalWords.get(),
           nMatches, config["matches_per_page"],
!          page, ref
           );
  }
diff -cr htdig-3.1.0b4-stock/htsearch/htsearch.cc htdig-3.1.0b4/htsearch/htsearch.cc
*** htdig-3.1.0b4-stock/htsearch/htsearch.cc    Tue Dec 22 17:53:16 1998
--- htdig-3.1.0b4/htsearch/htsearch.cc  Fri Jan 22 15:59:15 1999
***************
*** 100,105 ****
--- 100,106 ----
  int                   debug = 0;
  int                   minimum_word_length = 3;
  
+ char *sn_query_string;
  
  //*****************************************************************************
  // int main()
***************
*** 218,223 ****
--- 219,227 ----
      if (input.exists("keywords"))
        requiredWords.Create(input["keywords"], " \t\r\n");
  
+     if (input.exists("SN_query_string"))
+        sn_query_string = input["SN_query_string"];
+ 
      minimum_word_length = config.Value("minimum_word_length", minimum_word_length);
      
      Parser    *parser = new Parser();

Reply via email to