]> git.saurik.com Git - apt.git/blobdiff - test/interactive-helper/aptwebserver.cc
warn if apt-key is used in scripts/its output parsed
[apt.git] / test / interactive-helper / aptwebserver.cc
index 849323cc0960ab6ba22956ba2ebf3a5184edecef..3e91406abdbbc98e9f49a2497a662d48294ccb58 100644 (file)
@@ -209,8 +209,8 @@ static bool sendData(int const client, std::list<std::string> const &headers, st
 static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/
               bool const content, std::string const &error, std::list<std::string> &headers)
 {
-   std::string response("<html><head><title>");
-   response.append(httpcodeToStr(httpcode)).append("</title></head>");
+   std::string response("<!doctype html><html><head><title>");
+   response.append(httpcodeToStr(httpcode)).append("</title><meta charset=\"utf-8\" /></head>");
    response.append("<body><h1>").append(httpcodeToStr(httpcode)).append("</h1>");
    if (httpcode != 200)
       response.append("<p><em>Error</em>: ");
@@ -245,8 +245,8 @@ static void sendRedirect(int const client, int const httpcode, std::string const
                  std::string const &request, bool content)
 {
    std::list<std::string> headers;
-   std::string response("<html><head><title>");
-   response.append(httpcodeToStr(httpcode)).append("</title></head>");
+   std::string response("<!doctype html><html><head><title>");
+   response.append(httpcodeToStr(httpcode)).append("</title><meta charset=\"utf-8\" /></head>");
    response.append("<body><h1>").append(httpcodeToStr(httpcode)).append("</h1");
    response.append("<p>You should be redirected to <em>").append(uri).append("</em></p>");
    response.append("This page is a result of the request: <pre>");
@@ -332,7 +332,7 @@ static void sendDirectoryListing(int const client, std::string const &dir,/*{{{*
       return;
    }
 
-   listing << "<html><head><title>Index of " << dir << "</title>"
+   listing << "<!doctype html><html><head><title>Index of " << dir << "</title><meta charset=\"utf-8\" />"
           << "<style type=\"text/css\"><!-- td {padding: 0.02em 0.5em 0.02em 0.5em;}"
           << "tr:nth-child(even){background-color:#dfdfdf;}"
           << "h1, td:nth-child(3){text-align:center;}"
@@ -652,7 +652,7 @@ static void * handleClient(void * voidclient)                               /*{{{*/
               redirect.erase(0,1);
            if (redirect != filename)
            {
-              sendRedirect(client, 301, redirect, *m, sendContent);
+              sendRedirect(client, _config->FindI("aptwebserver::redirect::httpcode", 301), redirect, *m, sendContent);
               continue;
            }
         }
@@ -760,7 +760,7 @@ static void * handleClient(void * voidclient)                               /*{{{*/
                           headers.push_back(contentrange.str());
                        }
                        sendError(client, 416, *m, sendContent, "", headers);
-                       break;
+                       continue;
                     }
                  }
               }