Retry only for https protocol
[elinks.git] / src / protocol / about.c
blob94ea1c61d32f481ab1d51a2ade2cc3d1741eb628
1 /* Pseudo about: protocol implementation */
3 #ifdef HAVE_CONFIG_H
4 #include "config.h"
5 #endif
7 #include "elinks.h"
9 #include "cache/cache.h"
10 #include "network/connection.h"
11 #include "protocol/about.h"
12 #include "protocol/protocol.h"
13 #include "protocol/uri.h"
14 #include "util/string.h"
17 #ifndef CONFIG_SMALL
18 struct about_page {
19 unsigned char *name;
20 unsigned char *string;
23 static const struct about_page about_pages[] = {
24 { "bloat",
26 "<html><body>"
27 "<p>Bloat? What bloat?</p>"
28 "</body></html>"
31 { "links",
33 "<html><body><pre>"
34 "/* D~~)w */\n"
35 "/* / | */\n"
36 "/* /'m_O / */\n"
37 "/* /'.\"//~~~~\\ */\n"
38 "/* `\\/`\\`--') , */\n"
39 "/* / `~~~ | */\n"
40 "/* | | */\n"
41 "/* | , */\n"
42 "/* `_'p~~~~~/ */\n"
43 "/* . ||_| */\n"
44 "/* ` . _|| | */\n"
45 "/* `, ((____| */\n"
46 "</pre></body></html>"
49 { "mozilla",
51 "<html><body text=\"white\" bgcolor=\"red\">"
52 "<p align=\"center\">And the <em>beste</em> shall meet "
53 "a <em>being</em> and the being shall wear signs "
54 "of EL and the signs shall have colour of enke. "
55 "And the being shall be of <em>Good Nature</em>. "
56 "From on high the beste hath looked down upon the being "
57 "and the being was <em>smal</em> compared to it. "
58 "Yet <em>faster</em> and <em>leaner</em> it hath been "
59 "and it would come through doors closed to the beste. "
60 "And there was truly great <em>respect</em> "
61 "twix the beste and the <em>smal being</em> "
62 "and they bothe have <em>served</em> to naciouns. "
63 "Yet only the <em>true believers</em> "
64 "would choose betwene them and the followers "
65 "of <em>mammon</em> stayed <em>blinded</em> to bothe.</p>"
66 "<p align=\"right\">from <em>The Book of Mozilla</em> "
67 "(Apocryphon of ELeasar), 12:24</p>"
68 "</body></html>"
71 { "fear",
73 "<html><body text=\"yellow\">"
74 "<p>I must not fear. Fear is the mind-killer. "
75 "Fear is the little-death that brings total obliteration. "
76 "I will face my fear. "
77 "I will permit it to pass over me and through me. "
78 "And when it has gone past I will turn the inner eye "
79 "to see its path. "
80 "Where the fear has gone there will be nothing. "
81 "Only I will remain.</p>"
82 "</body></html>"
86 { NULL, NULL }
88 #endif
90 void
91 about_protocol_handler(struct connection *conn)
93 struct cache_entry *cached = get_cache_entry(conn->uri);
95 /* Only do this the first time */
96 if (cached && !cached->content_type) {
97 #ifndef CONFIG_SMALL
99 const struct about_page *page = about_pages;
101 for (; page->name; page++) {
102 int len;
103 unsigned char *str;
105 if (strcmp(conn->uri->data, page->name))
106 continue;
108 str = page->string;
109 len = strlen(str);
110 add_fragment(cached, 0, str, len);
111 conn->from = len;
112 break;
115 #endif
117 /* Set content to known type */
118 mem_free_set(&cached->content_type, stracpy("text/html"));
121 conn->cached = cached;
122 abort_connection(conn, connection_state(S_OK));