*** htdig/htsearch/htsearch.cc Mon Jan 12 07:48:25 2004
--- htdig.jeff/htsearch/htsearch.cc Thu Feb 19 14:30:44 2004
*************** void addRequiredWords(List &, StringList
*** 60,65 ****
--- 60,66 ----
void usage();
int debug = 0;
+ int suppress = 0;
int minimum_word_length = 3;
StringList boolean_keywords;
*************** main(int ac, char **av)
*** 111,117 ****
//
// Parse command line arguments
//
! while ((c = getopt(ac, av, "c:dv")) != -1)
{
switch (c)
{
--- 112,118 ----
//
// Parse command line arguments
//
! while ((c = getopt(ac, av, "c:dvs")) != -1)
{
switch (c)
{
*************** main(int ac, char **av)
*** 131,136 ****
--- 132,140 ----
case 'v':
debug++;
break;
+ case 's':
+ suppress++;
+ break;
case 'd':
debug++;
break;
*************** void
*** 928,934 ****
reportError(char *msg)
{
HtConfiguration* config= HtConfiguration::config();
! cout << "Content-type: text/html\r\n\r\n";
cout << "
htsearch error\n";
cout << "\n";
cout << "ht://Dig error
\n";
--- 932,941 ----
reportError(char *msg)
{
HtConfiguration* config= HtConfiguration::config();
! if(!suppress)
! {
! cout << "Content-type: text/html\r\n\r\n";
! }
cout << "htsearch error\n";
cout << "\n";
cout << "ht://Dig error
\n";
*************** void usage()
*** 957,965 ****
cout << "\t-c configfile\n";
cout << "\t\tUse the specified configuration file instead on the\n";
cout << "\t\tdefault.\n\n";
cout << "\tquery_string\tA CGI-style query string can be given as a single\n";
cout << "\t\targument, and is only used if the REQUEST_METHOD environment\n";
cout << "\t\tvariable is not set. If no query_string is given, and\n";
cout << "\t\tREQUEST_METHOD is not set, htsearch will prompt for the query.\n\n";
exit(0);
! }
--- 964,976 ----
cout << "\t-c configfile\n";
cout << "\t\tUse the specified configuration file instead on the\n";
cout << "\t\tdefault.\n\n";
+ cout << "\t-s\tsuppress the Content-type header.\n";
+ cout << "\t\tThis directive allows you to call htsearch after the\n";
+ cout << "\t\tHTTP headers have already been delivered.\n\n";
cout << "\tquery_string\tA CGI-style query string can be given as a single\n";
cout << "\t\targument, and is only used if the REQUEST_METHOD environment\n";
cout << "\t\tvariable is not set. If no query_string is given, and\n";
cout << "\t\tREQUEST_METHOD is not set, htsearch will prompt for the query.\n\n";
exit(0);
! }
!
*** htdig/htsearch/Display.cc Mon Jan 12 07:48:25 2004
--- htdig.jeff/htsearch/Display.cc Thu Feb 19 14:34:35 2004
*************** Display::displayHTTPheaders()
*** 854,860 ****
String content_type = config->Find("search_results_contenttype");
if (config->Boolean("nph"))
cout << "HTTP/1.0 200 OK\r\n";
! if (content_type.length())
cout << "Content-type: " << content_type << "\r\n\r\n";
}
--- 854,860 ----
String content_type = config->Find("search_results_contenttype");
if (config->Boolean("nph"))
cout << "HTTP/1.0 200 OK\r\n";
! if (content_type.length() && !suppress)
cout << "Content-type: " << content_type << "\r\n\r\n";
}