[BACK]Return to cgi.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/cgi.c between version 1.86 and 1.89

version 1.86, 2014/07/25 17:34:06 version 1.89, 2014/07/25 19:37:34
Line 148  static void
Line 148  static void
 http_printquery(const struct req *req)  http_printquery(const struct req *req)
 {  {
   
         if (NULL != req->q.manpath) {          if (NULL != req->q.query) {
                 printf("&manpath=");                  printf("query=");
                 http_print(req->q.manpath);                  http_print(req->q.query);
         }          }
           if (0 == req->q.equal)
                   printf("&apropos=1");
         if (NULL != req->q.sec) {          if (NULL != req->q.sec) {
                 printf("&sec=");                  printf("&sec=");
                 http_print(req->q.sec);                  http_print(req->q.sec);
Line 160  http_printquery(const struct req *req)
Line 162  http_printquery(const struct req *req)
                 printf("&arch=");                  printf("&arch=");
                 http_print(req->q.arch);                  http_print(req->q.arch);
         }          }
         if (NULL != req->q.query) {          if (NULL != req->q.manpath &&
                 printf("&query=");              strcmp(req->q.manpath, req->p[0])) {
                 http_print(req->q.query);                  printf("&manpath=");
                   http_print(req->q.manpath);
         }          }
         if (0 == req->q.equal)  
                 printf("&apropos=1");  
 }  }
   
 static void  static void
 html_printquery(const struct req *req)  html_printquery(const struct req *req)
 {  {
   
         if (NULL != req->q.manpath) {          if (NULL != req->q.query) {
                 printf("&manpath=");                  printf("query=");
                 html_print(req->q.manpath);                  html_print(req->q.query);
         }          }
           if (0 == req->q.equal)
                   printf("&apropos=1");
         if (NULL != req->q.sec) {          if (NULL != req->q.sec) {
                 printf("&sec=");                  printf("&sec=");
                 html_print(req->q.sec);                  html_print(req->q.sec);
Line 184  html_printquery(const struct req *req)
Line 187  html_printquery(const struct req *req)
                 printf("&arch=");                  printf("&arch=");
                 html_print(req->q.arch);                  html_print(req->q.arch);
         }          }
         if (NULL != req->q.query) {          if (NULL != req->q.manpath &&
                 printf("&query=");              strcmp(req->q.manpath, req->p[0])) {
                 html_print(req->q.query);                  printf("&manpath=");
                   html_print(req->q.manpath);
         }          }
         if (0 == req->q.equal)  
                 printf("&apropos=1");  
 }  }
   
 static void  static void
Line 874  format(const struct req *req, const char *file)
Line 876  format(const struct req *req, const char *file)
         }          }
   
         snprintf(opts, sizeof(opts), "fragment,man=%s?"          snprintf(opts, sizeof(opts), "fragment,man=%s?"
             "manpath=%s&query=%%N&sec=%%S&arch=%s",              "manpath=%s&query=%%N&sec=%%S%s%s",
             scriptname, req->q.manpath,              scriptname, req->q.manpath,
               req->q.arch ? "&arch=" : "",
             req->q.arch ? req->q.arch : "");              req->q.arch ? req->q.arch : "");
   
         mparse_result(mp, &mdoc, &man, NULL);          mparse_result(mp, &mdoc, &man, NULL);
Line 1083  main(void)
Line 1086  main(void)
         if (NULL != (querystring = getenv("QUERY_STRING")))          if (NULL != (querystring = getenv("QUERY_STRING")))
                 http_parse(&req, querystring);                  http_parse(&req, querystring);
   
         if ( ! validate_manpath(&req, req.q.manpath)) {          if ( ! (NULL == req.q.manpath ||
               validate_manpath(&req, req.q.manpath))) {
                 pg_error_badrequest(                  pg_error_badrequest(
                     "You specified an invalid manpath.");                      "You specified an invalid manpath.");
                 return(EXIT_FAILURE);                  return(EXIT_FAILURE);

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.89

CVSweb