1 Index: squid/src/cf.data.pre
2 diff -c squid/src/cf.data.pre:1.245.2.42 squid/src/cf.data.pre:1.245.2.43
3 *** squid/src/cf.data.pre:1.245.2.42 Sun May 18 15:49:19 2003
4 --- squid/src/cf.data.pre Wed May 21 08:34:38 2003
10 Usage: deny_info err_page_name acl
11 + or deny_info http://... acl
12 Example: deny_info ERR_CUSTOM_ACCESS_DENIED bad_guys
14 This can be used to return a ERR_ page for requests which
19 You may use ERR_ pages that come with Squid or create your own pages
20 and put them into the configured errors/ directory.
22 + Alternatively you can specify an error URL. The browsers will then
23 + get redirected (302) to the specified URL. %s in the redirection
24 + URL will be replaced by the requested URL.
26 Alternatively you can tell Squid to reset the TCP connection
27 by specifying TCP_RESET.
28 Index: squid/src/errorpage.c
29 diff -c squid/src/errorpage.c:1.167.2.6 squid/src/errorpage.c:1.167.2.7
30 *** squid/src/errorpage.c:1.167.2.6 Fri Sep 20 04:28:53 2002
31 --- squid/src/errorpage.c Wed May 21 08:34:38 2003
35 ErrorDynamicPageInfo *info = ErrorDynamicPages.items[i - ERR_MAX];
36 assert(info && info->id == i && info->page_name);
37 ! error_text[i] = errorLoadText(info->page_name);
39 - assert(error_text[i]);
45 ErrorDynamicPageInfo *info = ErrorDynamicPages.items[i - ERR_MAX];
46 assert(info && info->id == i && info->page_name);
47 ! if (strchr(info->page_name, ':') == NULL) {
48 ! /* Not on redirected errors... */
49 ! error_text[i] = errorLoadText(info->page_name);
61 errorReservePageId(const char *page_name)
63 ! ErrorDynamicPageInfo *info =
64 ! errorDynamicPageInfoCreate(ERR_MAX + ErrorDynamicPages.count, page_name);
65 ! stackPush(&ErrorDynamicPages, info);
75 + errorPageId(const char *page_name)
78 + for (i = 0; i < ERR_MAX; i++) {
79 + if (strcmp(err_type_str[i], page_name) == 0)
82 + for (i = 0; i < ErrorDynamicPages.count; i++) {
83 + if (strcmp(((ErrorDynamicPageInfo *) ErrorDynamicPages.items[i - ERR_MAX])->page_name, page_name) == 0)
90 errorReservePageId(const char *page_name)
92 ! ErrorDynamicPageInfo *info;
93 ! int id = errorPageId(page_name);
94 ! if (id == ERR_NONE) {
95 ! info = errorDynamicPageInfoCreate(ERR_MAX + ErrorDynamicPages.count, page_name);
96 ! stackPush(&ErrorDynamicPages, info);
105 errorBuildReply(ErrorState * err)
107 HttpReply *rep = httpReplyCreate();
108 ! MemBuf content = errorBuildContent(err);
109 http_version_t version;
110 /* no LMT for error pages; error pages expire immediately */
111 httpBuildVersion(&version, 1, 0);
112 ! httpReplySetHeaders(rep, version, err->http_status, NULL, "text/html", content.size, 0, squid_curtime);
114 ! * include some information for downstream caches. Implicit
115 ! * replaceable content. This isn't quite sufficient. xerrno is not
116 ! * necessarily meaningful to another system, so we really should
117 ! * expand it. Additionally, we should identify ourselves. Someone
118 ! * might want to know. Someone _will_ want to know OTOH, the first
119 ! * X-CACHE-MISS entry should tell us who.
121 ! httpHeaderPutStrf(&rep->header, HDR_X_SQUID_ERROR, "%s %d",
122 ! errorPageName(err->page_id), err->xerrno);
123 ! httpBodySet(&rep->body, &content);
124 ! /* do not memBufClean() the content, it was absorbed by httpBody */
129 errorBuildReply(ErrorState * err)
131 HttpReply *rep = httpReplyCreate();
132 ! const char *name = errorPageName(err->page_id);
133 http_version_t version;
134 /* no LMT for error pages; error pages expire immediately */
135 httpBuildVersion(&version, 1, 0);
136 ! if (strchr(name, ':')) {
138 ! char *quoted_url = rfc1738_escape_part(errorConvert('u', err));
139 ! httpReplySetHeaders(rep, version, HTTP_MOVED_TEMPORARILY, NULL, "text/html", 0, 0, squid_curtime);
140 ! httpHeaderPutStrf(&rep->header, HDR_LOCATION, name, quoted_url);
141 ! httpHeaderPutStrf(&rep->header, HDR_X_SQUID_ERROR, "%d %s\n", err->http_status, "Access Denied");
143 ! MemBuf content = errorBuildContent(err);
144 ! httpReplySetHeaders(rep, version, err->http_status, NULL, "text/html", content.size, 0, squid_curtime);
146 ! * include some information for downstream caches. Implicit
147 ! * replaceable content. This isn't quite sufficient. xerrno is not
148 ! * necessarily meaningful to another system, so we really should
149 ! * expand it. Additionally, we should identify ourselves. Someone
150 ! * might want to know. Someone _will_ want to know OTOH, the first
151 ! * X-CACHE-MISS entry should tell us who.
153 ! httpHeaderPutStrf(&rep->header, HDR_X_SQUID_ERROR, "%s %d",
154 ! name, err->xerrno);
155 ! httpBodySet(&rep->body, &content);
156 ! /* do not memBufClean() the content, it was absorbed by httpBody */