Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2026-06-19 0cfc87bd32822e5ba22d8c2b1a26fa60f63ad7fa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
select htp_enable_test_mode(1);
 
select htp_appletopen('my_app=let.class&я', 100, 200, 'f');
select htp_appletclose();
select htp_blockquoteopen('1', '2', '3');
select htp_blockquoteclose();
select htp_blockquoteopen('s', '12.,3_-_321 Россия!', 'id="my_quote" !@#$%^&*( .');
select htp_blockquoteclose();
select htp_bodyopen('/images/background.gif.Стиль', 'Вася BGPROPERTIES="fixed"');
select htp_bodyclose();
select htp_dlistopen('hjv', 'class="my-definition-list"');
select htp_dlistclose();
select htp_formopen('/cgi-bin/&search.pl', 'G/ET-я', 'Яr/esults_frame', 'Яr/e', 'name="search_form" class="search-form"');
select htp_formclose();
select htp_fontopen('BL/UE', 'Verd/ana', '3/4', 'name="search_form" class="search-form"');
select htp_fontclose();
select htp_formselectopen('"hobby_list', 'Ва"ши хобби: ', 8.7, 'multiple style="width: 200px;"');
select htp_formselectclose();
select htp_framesetopen('', '25%, 75%', 'border="1"');
select htp_framesetclose();
select htp_mapopen(NULL, NULL);
select htp_mapclose();
select htp_olistopen('both"', 'soft"', NULL);
select htp_olistclose();
select htp_preopen('both"', '80"', 'class="source-code" style="font-size:12px;"');
select htp_preclose();
select htp_tableopen(' ', ' ', ' ', ' ', ' ');
select htp_tableclose();
select htp_tablerowopen('CENTER"', 'MIDDLE"', '1"', 'yes"', 'style="background-color: #E0E0E0;"');
select htp_tablerowclose();
select htp_ulistopen('a"', 'HORIZ"', '⚡', 'd"', 'class="energy-list" id="main"');
select htp_ulistclose();
select htp_centeropen();
select htp_centerclose();
select htp_dirlistopen();
select htp_dirlistclose();
select htp_headopen();
select htp_headclose();
select htp_htmlopen();
select htp_htmlclose();
select htp_listingopen();
select htp_listingclose();
select htp_menulistopen();
select htp_menulistclose();
select htp_noframesopen();
select htp_noframesclose();
select htp_escape_sc('Россия qwerasdf1234" & . @ '' ');
select htp_escape_sc('Visit <our site> & enjoy! !@#$%^&*()_+|/');
select htp_formcheckbox('"interests', '"travel', '9', 'style="color: blue;"');
select htp_formfile('"interests', '"travel', 'style="color: blue;"');
select htp_formhidden('"i', '"t', 'style="c"');
select htp_formimage('"i', '"t', '"','style="c"');
select htp_formpassword('"i', '"t', '"','"w"', 'style="c"');
select htp_formradio('"i', '"t', '"', 'style="c"');
select htp_formreset('"i', 'style="c"');
select htp_formselectoption('"i', '"','style="c"');
select htp_formsubmit('"i', '"','style="c"');
select htp_formtext('"i', '"','"9"', '"2"', 'style="c"');
select htp_formtextarea('"i', 2, 9, '"2"', 'style="c"');
select htp_formtextarea2('"i', 2.9, 9, '"2"', ' ', 'style="c"');
select htp_address(NULL, '', 'Б"al l*', 'style="font-style: italic;"');
select htp_anchor(NULL, 'NEW* сайт', 'x"в', 'class="external"');
select htp_area('x"в','x"в','x"в','x"в','x"в', 'b"Я');
 
-- htp_em tests
select htp_em('NICE');
select htp_em('найс'); -- converts russian symbols in html unicode codes
select htp_em('🙂'); -- emoji is converted to html unicode too
select htp_em('<script>alert(1)</script>');
select htp_em('Test ''Single Quotes''');
select htp_em('A < B > C & D');
select htp_em('Tab  s Here');
select htp_em('Line
Break');
select htp_em('');              -- Empty string
select htp_em(NULL);            -- NULL value
select htp_em(' ');             -- Single space
select htp_em('Emphasized', 'class="highlight"');
select htp_em('Text', 'style="font-weight: bold;"');
select htp_em('Link', 'id="my-id"');
select htp_em('Mixed', 'class="test" id="x" style="color:red"');
select htp_em('<script>', 'onclick="alert(1)"');
select htp_em('Text', 'data-value="<script>"');
select htp_em('Emphasized');
select htp_em(NULL, 'class="test"');
select htp_em('Text', NULL);
select htp_em('Text', '');
select htp_em(NULL, NULL);
 
-- htp_frame tests
select htp_frame('https://awww.ru');
select htp_frame('найс'); -- outputs unicode
select htp_frame('<script>alert(1)</script>');
select htp_frame('A < B > C & D');
select htp_frame('Line
Break');
select htp_frame(''); -- Empty string
select htp_frame(NULL); -- NULL value
select htp_frame(' ');
select htp_frame('Col1  Col2    Col3'); -- Tab handling
select htp_frame(chr(9) || 'Test' || chr(9));
select htp_frame('https://awww.ru', 'art site', '100', '100', 'yes', '555', 'index_rate=100'); -- name escapes space!
select htp_frame('https://awww.ru', 'space_test', '1 00', '10 0', 'ye s', '555', 'index_rate=10 0'); -- all attrs are escaping space but not cattr
select htp_frame('https://awww.ru', '555', 'abc', 'zyx', '444', 'canresize', 'index_rate=100'); -- attrs are messed up logically
select htp_frame('https://awww.ru', 'абв', 'где', 'ёжз', 'ийк', 'лмн', 'index_rate=опр'); -- attrs are escaping unicode, noresize is ok, cattrs is not escaped
select htp_frame('https://awww.ru', 'symbols_linebreaks_test', 'F < G > H & I', 
                               'J < K > 
                               L & M', 'E < O > P & N', 
                               'Q < R > S & T', 'U < V > W & X');
select htp_frame('https://spaces.nul0', '', '', '', '', '', '');
select htp_frame('https://spaces.nul1', ' ', ' ', ' ', ' ', ' ', ' ');
select htp_frame('https://symbols.esc', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is escaped as html unicode for attrs
 
-- htp_header tests
select htp_header(NULL, 'Invalid tag');
select htp_header(1, 'Pretty Normal');
select htp_header(7, 'Tag overflow'); -- 7 is converted to 6
select htp_header(0, 'Invalid 0 tag'); -- 0 is okay
select htp_header(13, 'найс'); -- converts russian symbols in html unicode codes
select htp_header(-2, '🙂'); -- emoji is converted to html unicode too, -2 is 2
select htp_header(-12, '🙂'); -- emoji is converted to html unicode too, -12 is 6
select htp_header(1, '<script>alert(1)</script>');
select htp_header(1, 'A < B > C & D');
select htp_header(1, 'Line
Break');
select htp_header(1, '');              -- Empty string
select htp_header(1, NULL);            -- NULL value
select htp_header(1, ' ');             -- Single space
select htp_header(1, 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D');
select htp_header(2, '', '', '', '', '');
 
-- OWA_UTIL.SHOWPAGE extended call form with HTP output
DO $$
BEGIN
    RAISE NOTICE 'Expected:';
    RAISE NOTICE 'HTP_SHOWPAGE_UTILS_BODY';
    RAISE NOTICE 'Actual:';
    PERFORM owa_init_cgi_env(0, NULL, NULL);
    PERFORM htp_p('HTP_SHOWPAGE_UTILS_BODY'::varchar2);
    PERFORM owa_util_showpage_utils(0::int4);
END $$;
 
-- htp_dlistterm tests
select htp_dlistterm();
select htp_dlistterm('anna');
select htp_dlistterm(NULL);
select htp_dlistterm('');
select htp_dlistterm('найс'); -- converts russian symbols in html unicode codes
select htp_dlistterm('🙂'); -- emoji is converted to html unicode too
select htp_dlistterm('<script>alert(1)</script>');
select htp_dlistterm('A < B > C & D'); -- converts special symbols to html unicode
select htp_dlistterm('Line
Break');
select htp_dlistterm('some term', 'not clear', 'index_rate=100'); -- cclear escapes space
select htp_dlistterm('ийк', 'лмн', 'index_rate=опр');
select htp_dlistterm('E < O > P & N', 'Q < R > S & T', 'U < V > W & X');
select htp_dlistterm('', '', '');
select htp_dlistterm(' ', ' ', ' '); -- cclear escapes space
select htp_dlistterm('\n', '\r', '\t'); -- cclear escapes slash
select htp_dlistterm(chr(9) || 'Test' || chr(9), 'Col1  Col2    Col3', chr(9) || 'Test' || chr(9)); -- cclear escapes tabs
select htp_dlistterm(chr(1) || chr(2) || chr(3), chr(27), chr(8));
 
select htp_enable_test_mode(0);