Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
Escape error page content
Browse files Browse the repository at this point in the history
  • Loading branch information
s4y committed May 2, 2014
1 parent b085818 commit e9bedb6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libahttp/err.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@

#include "resp.h"
#include "ahttp.h"
#include "pescape.h"

strbuf
http_error_t::make_body (int n, const str &si, const str &aux)
{
strbuf b;
str ldesc;
const str sdesc = http_status.get_desc (n, &ldesc);
const str sdesc = xss_escape (http_status.get_desc (n, &ldesc));
b << "<html>\n"
<< " <head>\n"
<< " <title>" << n << " " << sdesc << "</title>\n"
Expand All @@ -40,11 +41,11 @@ http_error_t::make_body (int n, const str &si, const str &aux)
<< " <h1>Error " << n << " " << sdesc << "</h1><br><br>\n"
;
if (n == HTTP_NOT_FOUND && aux) {
b << "The file <tt>" << aux
b << "The file <tt>" << xss_escape (aux)
<< "</tt> was not found on this server.<br><br>\n\n";
}
b << " <hr>\n"
<< " <i>" << si << "</i>\n"
<< " <i>" << xss_escape (si) << "</i>\n"
<< " <br>\n"
<< " </body>\n"
<< "</html>\n"
Expand Down

0 comments on commit e9bedb6

Please sign in to comment.