2 * Static HTML page generators for CNTLM
4 * CNTLM is free software; you can redistribute it and/or modify it under the
5 * terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or (at your option) any later
9 * CNTLM is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
16 * St, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Copyright (c) 2007 David Kubicek
29 char *gen_407_page(const char *http
) {
34 snprintf(tmp
, BUFSIZE
-1,
35 "%s 407 Access denied\r\n"
36 "Proxy-Authenticate: Basic realm=\"Cntlm Proxy\"\r\n"
37 "Content-Type: text/html\r\n\r\n"
38 "<html><body><h1>407 Access denied</h1><p><a href='http://cntlm.sf.net/'>Cntlm</a> requests your credentials for proxy access.</p></body></html>",
43 char *gen_401_page(const char *http
, const char *host
, int port
) {
48 snprintf(tmp
, BUFSIZE
-1,
49 "%s 401 Access denied\r\n"
50 "WWW-Authenticate: Basic realm=\"%s:%d\"\r\n"
51 "Content-Type: text/html\r\n\r\n"
52 "<html><body><h1>401 Access denied</h1><p><a href='http://cntlm.sf.net/'>Cntlm</a> proxy requests your credentials for this URL.</p></body></html>",
57 char *gen_denied_page(const char *ip
) {
62 snprintf(tmp
, BUFSIZE
-1,
63 "HTTP/1.0 407 Access denied\r\n"
64 "Content-Type: text/html\r\n\r\n"
65 "<html><body><h1>Access denied</h1><p>Your request has been declined, %s is not allowed to connect.</p></body></html>",
70 char *gen_502_page(const char *http
, const char *msg
) {
77 snprintf(tmp
, BUFSIZE
-1,
79 "Content-Type: text/html\r\n\r\n"
80 "<html><body><h1>502 %s</h1><p><a href='http://cntlm.sf.net/'>Cntlm</a> proxy failed to complete the request.</p></body></html>",