-- Execute HTP in UTF8 independently of the encoding of the regression cluster.
|
CREATE DATABASE rudb_htp_utf8_regress WITH ENCODING 'UTF8' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;
|
\connect rudb_htp_utf8_regress
|
SET client_encoding = 'UTF8';
|
-- Freeze the original HTP/HTF test contract: backslashes remain literal.
|
SET standard_conforming_strings = on;
|
|
DO $$
|
BEGIN
|
perform htp_appletopen('my_app=let.class&я', 100, 200, 'f');
|
perform htp_appletclose();
|
perform htp_blockquoteopen('1', '2', '3');
|
perform htp_blockquoteclose();
|
perform htp_blockquoteopen('s', '12.,3_-_321 Россия!', 'id="my_quote" !@#$%^&*( .');
|
perform htp_blockquoteclose();
|
perform htp_bodyopen('/images/background.gif.Стиль', 'Вася BGPROPERTIES="fixed"');
|
perform htp_bodyclose();
|
perform htp_dlistopen('hjv', 'class="my-definition-list"');
|
perform htp_dlistclose();
|
perform htp_formopen('/cgi-bin/&search.pl', 'G/ET-я', 'Яr/esults_frame', 'Яr/e', 'name="search_form" class="search-form"');
|
perform htp_formclose();
|
perform htp_fontopen('BL/UE', 'Verd/ana', '3/4', 'name="search_form" class="search-form"');
|
perform htp_fontclose();
|
perform htp_formselectopen('"hobby_list', 'Ва"ши хобби: ', 8.7::number, 'multiple style="width: 200px;"');
|
perform htp_formselectclose();
|
perform htp_framesetopen('', '25%, 75%', 'border="1"');
|
perform htp_framesetclose();
|
perform htp_mapopen(NULL, NULL);
|
perform htp_mapclose();
|
perform htp_olistopen('both"', 'soft"', NULL);
|
perform htp_olistclose();
|
perform htp_preopen('both"', '80"', 'class="source-code" style="font-size:12px;"');
|
perform htp_preclose();
|
perform htp_tableopen(' ', ' ', ' ', ' ', ' ');
|
perform htp_tableclose();
|
perform htp_tablerowopen('CENTER"', 'MIDDLE"', '1"', 'yes"', 'style="background-color: #E0E0E0;"');
|
perform htp_tablerowclose();
|
perform htp_ulistopen('a"', 'HORIZ"', '⚡', 'd"', 'class="energy-list" id="main"');
|
perform htp_ulistclose();
|
perform htp_centeropen();
|
perform htp_centerclose();
|
perform htp_dirlistopen();
|
perform htp_dirlistclose();
|
perform htp_headopen();
|
perform htp_headclose();
|
perform htp_htmlopen();
|
perform htp_htmlclose();
|
perform htp_listingopen();
|
perform htp_listingclose();
|
perform htp_menulistopen();
|
perform htp_menulistclose();
|
perform htp_noframesopen();
|
perform htp_noframesclose();
|
perform htp_escape_sc('Россия qwerasdf1234" & . @ '' ');
|
perform htp_escape_sc('Visit <our site> & enjoy! !@#$%^&*()_+|/');
|
perform htp_formcheckbox('"interests', '"travel', '9', 'style="color: blue;"');
|
perform htp_formfile('"interests', '"travel', 'style="color: blue;"');
|
perform htp_formhidden('"i', '"t', 'style="c"');
|
perform htp_formimage('"i', '"t', '"','style="c"');
|
perform htp_formpassword('"i', '"t', '"','"w"', 'style="c"');
|
perform htp_formradio('"i', '"t', '"', 'style="c"');
|
perform htp_formreset('"i', 'style="c"');
|
perform htp_formselectoption('"i', '"','style="c"');
|
perform htp_formsubmit('"i', '"','style="c"');
|
perform htp_formtext('"i', '"','"9"', '"2"', 'style="c"');
|
perform htp_formtextarea('"i', 2, 9, '"2"', 'style="c"');
|
perform htp_formtextarea2('"i', 2.9::number, 9, '"2"', ' ', 'style="c"');
|
perform htp_address(NULL, '', 'Б"al l*', 'style="font-style: italic;"');
|
perform htp_anchor(NULL, 'NEW* сайт', 'x"в', 'class="external"');
|
perform htp_area('x"в','x"в','x"в','x"в','x"в', 'b"Я');
|
perform htp_get_data();
|
END $$;
|
|
-- htp_em tests
|
DO $$
|
BEGIN
|
perform htp_em('NICE');
|
perform htp_em('найс'); -- converts russian symbols in html unicode codes
|
perform htp_em('🙂'); -- emoji is converted to html unicode too
|
perform htp_em('<script>alert(1)</script>');
|
perform htp_em('Test ''Single Quotes''');
|
perform htp_em('A < B > C & D');
|
perform htp_em('Tab s Here');
|
perform htp_em('Line
|
Break');
|
perform htp_em(''); -- Empty string
|
perform htp_em(NULL); -- NULL value
|
perform htp_em(' '); -- Single space
|
perform htp_em('Emphasized', 'class="highlight"');
|
perform htp_em('Text', 'style="font-weight: bold;"');
|
perform htp_em('Link', 'id="my-id"');
|
perform htp_em('Mixed', 'class="test" id="x" style="color:red"');
|
perform htp_em('<script>', 'onclick="alert(1)"');
|
perform htp_em('Text', 'data-value="<script>"');
|
perform htp_em('Emphasized');
|
perform htp_em(NULL, 'class="test"');
|
perform htp_em('Text', NULL);
|
perform htp_em('Text', '');
|
perform htp_em(NULL, NULL);
|
perform htp_get_data();
|
END $$;
|
|
-- htp_frame tests
|
DO $$
|
BEGIN
|
perform htp_frame('https://awww.ru');
|
perform htp_frame('найс'); -- outputs unicode
|
perform htp_frame('<script>alert(1)</script>');
|
perform htp_frame('A < B > C & D');
|
perform htp_frame('Line
|
Break');
|
perform htp_frame(''); -- Empty string
|
perform htp_frame(NULL); -- NULL value
|
perform htp_frame(' ');
|
perform htp_frame('Col1 Col2 Col3'); -- Tab handling
|
perform htp_frame(chr(9) || 'Test' || chr(9));
|
perform htp_frame('https://awww.ru', 'art site', '100', '100', 'yes', '555', 'index_rate=100'); -- name escapes space!
|
perform 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
|
perform htp_frame('https://awww.ru', '555', 'abc', 'zyx', '444', 'canresize', 'index_rate=100'); -- attrs are messed up logically
|
perform htp_frame('https://awww.ru', 'абв', 'где', 'ёжз', 'ийк', 'лмн', 'index_rate=опр'); -- attrs are escaping unicode, noresize is ok, cattrs is not escaped
|
perform 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');
|
perform htp_frame('https://spaces.nul0', '', '', '', '', '', '');
|
perform htp_frame('https://spaces.nul1', ' ', ' ', ' ', ' ', ' ', ' ');
|
perform htp_frame('https://symbols.esc', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is escaped as html unicode for attrs
|
perform htp_get_data();
|
END $$;
|
|
-- htp_header tests
|
DO $$
|
BEGIN
|
perform htp_header(NULL, 'Invalid tag');
|
perform htp_header(1, 'Pretty Normal');
|
perform htp_header(7, 'Tag overflow'); -- 7 is converted to 6
|
perform htp_header(0, 'Invalid 0 tag'); -- 0 is okay
|
perform htp_header(13, 'найс'); -- converts russian symbols in html unicode codes
|
perform htp_header(-2, '🙂'); -- emoji is converted to html unicode too, -2 is 2
|
perform htp_header(-12, '🙂'); -- emoji is converted to html unicode too, -12 is 6
|
perform htp_header(1, '<script>alert(1)</script>');
|
perform htp_header(1, 'A < B > C & D');
|
perform htp_header(1, 'Line
|
Break');
|
perform htp_header(1, ''); -- Empty string
|
perform htp_header(1, NULL); -- NULL value
|
perform htp_header(1, ' '); -- Single space
|
perform htp_header(1, 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D');
|
perform htp_header(2, '', '', '', '', '');
|
perform htp_get_data();
|
END $$;
|
|
-- 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
|
DO $$
|
BEGIN
|
perform htp_dlistterm();
|
perform htp_dlistterm('anna');
|
perform htp_dlistterm(NULL);
|
perform htp_dlistterm('');
|
perform htp_dlistterm('найс'); -- converts russian symbols in html unicode codes
|
perform htp_dlistterm('🙂'); -- emoji is converted to html unicode too
|
perform htp_dlistterm('<script>alert(1)</script>');
|
perform htp_dlistterm('A < B > C & D'); -- converts special symbols to html unicode
|
perform htp_dlistterm('Line
|
Break');
|
perform htp_dlistterm('some term', 'not clear', 'index_rate=100'); -- cclear escapes space
|
perform htp_dlistterm('ийк', 'лмн', 'index_rate=опр');
|
perform htp_dlistterm('E < O > P & N', 'Q < R > S & T', 'U < V > W & X');
|
perform htp_dlistterm('', '', '');
|
perform htp_dlistterm(' ', ' ', ' '); -- cclear escapes space
|
perform htp_dlistterm('\n', '\r', '\t'); -- cclear escapes slash
|
perform htp_dlistterm(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3', chr(9) || 'Test' || chr(9)); -- cclear escapes tabs
|
perform htp_dlistterm(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
-- htp_adddefaulthtmlhdr tests
|
DO $$
|
BEGIN
|
perform htp_adddefaulthtmlhdr(TRUE);
|
perform htp_em('hello world');
|
perform htp_dlistterm('заголовок');
|
perform htp_get_data();
|
perform htp_adddefaulthtmlhdr(FALSE);
|
END $$;
|
|
-- htp_base tests
|
DO $$
|
BEGIN
|
perform htp_base('Normal', 'usage=1');
|
perform htp_base(); -- empty
|
perform htp_base(NULL);
|
perform htp_base('');
|
perform htp_base('найс'); -- converts russian symbols in html unicode codes
|
perform htp_base('🙂'); -- emoji is converted to html unicode too
|
perform htp_base('A < B > C & D'); -- converts special symbols to html unicode
|
perform htp_base('Line
|
Break');
|
perform htp_base('some term', 'index_rate=100'); -- target attr escapes space
|
perform htp_base('ийк', 'index_rate=опр');
|
perform htp_base('E < O > P & N', 'U < V > W & X');
|
perform htp_base('', '');
|
perform htp_base(' ', ' '); -- all used, target attr escapes space
|
perform htp_base('\n', '\t'); -- target attr escapes slash
|
perform htp_base(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- target attr escapes tabs
|
perform htp_base(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_basefont tests
|
DO $$
|
BEGIN
|
perform htp_basefont(-100);
|
perform htp_basefont(0);
|
perform htp_basefont(100);
|
perform htp_basefont(1000);
|
perform htp_basefont(1000000);
|
perform htp_basefont(999999999999);
|
perform htp_get_data();
|
END $$;
|
|
--htp_bgsound tests
|
DO $$
|
BEGIN
|
perform htp_bgsound('Normal', 'tag', 'usage=1');
|
perform htp_bgsound(NULL);
|
perform htp_bgsound('');
|
perform htp_bgsound('найс'); -- converts russian symbols in html unicode codes
|
perform htp_bgsound('🙂'); -- emoji is converted to html unicode too
|
perform htp_bgsound('A < B > C & D', 'A < B > C & D'); -- converts special symbols to html unicode
|
perform htp_bgsound('Line
|
Break', 'Line
|
Break');
|
perform htp_bgsound('some term', 'some term', 'index_rate=100'); -- escapes space
|
perform htp_bgsound('ийк', 'абв', 'index_rate=опр');
|
perform htp_bgsound('E < O > P & N', 'U < V > W & X');
|
perform htp_bgsound('', '');
|
perform htp_bgsound(' ', ' '); -- src and loop escape space
|
perform htp_bgsound('\n', '\t'); -- src and loop escape slash
|
perform htp_bgsound(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- src and loop escape tabs
|
perform htp_bgsound(chr(1) || chr(2) || chr(3), chr(27) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_big tests
|
DO $$
|
BEGIN
|
perform htp_big('Normal', 'usage=1');
|
perform htp_big(NULL);
|
perform htp_big('');
|
perform htp_big('найс'); -- converts russian symbols in html unicode codes
|
perform htp_big('🙂'); -- emoji is converted to html unicode too
|
perform htp_big('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_big('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_big('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_big('ийк', 'index_rate=опр');
|
perform htp_big('E < O > P & N', 'U < V > W & X');
|
perform htp_big('', '');
|
perform htp_big(' ', ' ');
|
perform htp_big('\n', '\t'); -- doesn't escape slash
|
perform htp_big(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_big(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_bold tests
|
DO $$
|
BEGIN
|
perform htp_bold('Normal', 'usage=1');
|
perform htp_bold(NULL);
|
perform htp_bold('');
|
perform htp_bold('здесь'); -- converts russian symbols in html unicode codes
|
perform htp_bold('🙂'); -- emoji is converted to html unicode too
|
perform htp_bold('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_bold('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_bold('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_bold('ийк', 'index_rate=опр');
|
perform htp_bold('E < O > P & N', 'U < V > W & X');
|
perform htp_bold('', '');
|
perform htp_bold(' ', ' ');
|
perform htp_bold('\n', '\t'); -- doesn't escape slash
|
perform htp_bold(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_bold(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_br tests
|
DO $$
|
BEGIN
|
perform htp_br('Normal', 'usage=1');
|
perform htp_br(); -- empty
|
perform htp_br(NULL);
|
perform htp_br('');
|
perform htp_br('камень'); -- converts russian symbols in html unicode codes
|
perform htp_br('🙂'); -- emoji is converted to html unicode too
|
perform htp_br('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_br('Line
|
Break'); -- converts linebreak to html unicode codes
|
perform htp_br('some term', 'index_rate=100'); -- escapes space
|
perform htp_br('ийк', 'index_rate=опр');
|
perform htp_br('E < O > P & N', 'U < V > W & X');
|
perform htp_br('', '');
|
perform htp_br(' ', ' ');
|
perform htp_br('\n', '\t'); -- escapes slash
|
perform htp_br(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- escapes tabs
|
perform htp_br(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_center tests
|
DO $$
|
BEGIN
|
perform htp_center('Normal usage');
|
perform htp_center(NULL);
|
perform htp_center('');
|
perform htp_center('лёд'); -- converts russian symbols in html unicode codes
|
perform htp_center('🙂'); -- emoji is converted to html unicode too
|
perform htp_center('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_center('Line
|
Break'); -- doesn't escape linebreak
|
perform htp_center('\n\t'); -- doesn't escape slash
|
perform htp_center(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_center(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_cite tests
|
DO $$
|
BEGIN
|
perform htp_cite('Normal', 'usage=1');
|
perform htp_cite(NULL);
|
perform htp_cite('');
|
perform htp_cite('ножницы'); -- converts russian symbols in html unicode codes
|
perform htp_cite('🙂'); -- emoji is converted to html unicode too
|
perform htp_cite('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_cite('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_cite('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_cite('ийк', 'index_rate=опр');
|
perform htp_cite('E < O > P & N', 'U < V > W & X');
|
perform htp_cite('', '');
|
perform htp_cite(' ', ' ');
|
perform htp_cite('\n', '\t'); -- doesn't escape slash
|
perform htp_cite(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_cite(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_code tests
|
DO $$
|
BEGIN
|
perform htp_code('Normal', 'usage=1');
|
perform htp_code(NULL);
|
perform htp_code('');
|
perform htp_code('бумага'); -- converts russian symbols in html unicode codes
|
perform htp_code('🙂'); -- emoji is converted to html unicode too
|
perform htp_code('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_code('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_code('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_code('ийк', 'index_rate=опр');
|
perform htp_code('E < O > P & N', 'U < V > W & X');
|
perform htp_code('', '');
|
perform htp_code(' ', ' ');
|
perform htp_code('\n', '\t'); -- doesn't escape slash
|
perform htp_code(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_code(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_comment tests
|
DO $$
|
BEGIN
|
perform htp_comment('Normal usage');
|
perform htp_comment(NULL);
|
perform htp_comment('');
|
perform htp_comment('ящерица'); -- converts russian symbols in html unicode codes
|
perform htp_comment('🙂'); -- emoji is converted to html unicode too
|
perform htp_comment('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_comment('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_comment(' ');
|
perform htp_comment('\n\t'); -- doesn't escape slash
|
perform htp_comment(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_comment(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_dfn tests
|
DO $$
|
BEGIN
|
perform htp_dfn('Normal usage');
|
perform htp_dfn('Normal usage', 'attr=100');
|
perform htp_dfn(NULL);
|
perform htp_dfn('');
|
perform htp_dfn('колодец'); -- converts russian symbols in html unicode codes
|
perform htp_dfn('🙂'); -- emoji is converted to html unicode too
|
perform htp_dfn('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_dfn('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_dfn('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_dfn('E < O > P & N', 'U < V > W & X');
|
perform htp_dfn('', '');
|
perform htp_dfn(' ');
|
perform htp_dfn('\n\t'); -- doesn't escape slash
|
perform htp_dfn(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_dfn(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_div tests
|
DO $$
|
BEGIN
|
perform htp_div('Normal', 'usage=1');
|
perform htp_div();
|
perform htp_div(NULL);
|
perform htp_div(NULL, NULL);
|
perform htp_div('');
|
perform htp_div('пламя'); -- converts russian symbols in html unicode codes
|
perform htp_div('🙂'); -- emoji is converted to html unicode too
|
perform htp_div('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_div('Line
|
Break'); -- converts linebreak
|
perform htp_div('some term', 'index_rate=100'); -- escapes space
|
perform htp_div('ийк', 'index_rate=опр');
|
perform htp_div('E < O > P & N', 'U < V > W & X');
|
perform htp_div('', '');
|
perform htp_div(' ', ' ');
|
perform htp_div('\n', '\t'); -- escapes slash
|
perform htp_div(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- escapes tabs
|
perform htp_div(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_dlistdef tests
|
DO $$
|
BEGIN
|
perform htp_dlistdef('Normal usage', 'left', 'myValue=66');
|
perform htp_dlistdef();
|
perform htp_dlistdef(NULL);
|
perform htp_dlistdef('');
|
perform htp_dlistdef('вода'); -- converts russian symbols in html unicode codes
|
perform htp_dlistdef('🙂'); -- emoji is converted to html unicode too
|
perform htp_dlistdef('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_dlistdef('some term', 'left right', 'index_rate=100');
|
perform htp_dlistdef('ийк', 'абв', 'index_rate=опр');
|
perform htp_dlistdef('E < O > P & N', 'U < V > W & X', 'U < V > W & X');
|
perform htp_dlistdef('<script>alert(4444)</script>', '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>');
|
perform htp_dlistdef('', '', '');
|
perform htp_dlistdef(' ', ' ', ' ');
|
perform htp_dlistdef('\n', '\r', '\t');
|
perform htp_dlistdef(chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3');
|
perform htp_dlistdef(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_escape_sc tests
|
DO $$
|
BEGIN
|
perform htp_escape_sc('Normal&usage');
|
perform htp_escape_sc(NULL); -- nothing at all
|
perform htp_escape_sc(''); -- nothing at all
|
perform htp_escape_sc('оборот'); -- does not convert russian symbols in html unicode codes
|
perform htp_escape_sc('🙂'); -- does not convert emoji to html unicode too
|
perform htp_escape_sc('A < B > C & D "'); -- converts special symbols to html unicode codes
|
perform htp_escape_sc('Line
|
Break'); -- does not convert linebreak to html unicode codes
|
perform htp_escape_sc(' ');
|
perform htp_escape_sc('\n\t'); -- doesn't escape slash
|
perform htp_escape_sc(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_escape_sc(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_hr tests
|
DO $$
|
BEGIN
|
perform htp_hr('left', '/images/line.jpg', 'myValue=66');
|
perform htp_hr();
|
perform htp_hr(NULL);
|
perform htp_hr('');
|
perform htp_hr('🙂', '🙂'); -- emoji is converted to html unicode by cclear but not by csrc
|
perform htp_hr('Line
|
Break'); -- converts linebreak
|
perform htp_hr('left right', 'some term', 'index_rate 100'); -- space is converted to html unicode by cclear but not by csrc
|
perform htp_hr('ийк', 'абв', 'index_rate=опр'); -- csrc doesn't convert russian symbols to unicode
|
perform htp_hr('E < O > P & N', 'U < V > W & X', 'U < V > W & X');
|
perform htp_hr('<script>alert(4444)</script>', '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>');
|
perform htp_hr('', '', '');
|
perform htp_hr(' ', ' ', ' ');
|
perform htp_hr('\n', '\r', '\t'); -- slash is converted to html unicode by cclear but not by csrc
|
perform htp_hr(chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- tab is converted to html unicode by cclear but not by csrc
|
perform htp_hr(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_htitle tests
|
DO $$
|
BEGIN
|
perform htp_htitle('Normal&usage');
|
perform htp_htitle('заголовок');
|
perform htp_htitle('🙂');
|
perform htp_htitle('<script>alert(1)</script>');
|
perform htp_htitle('A < B > C & D');
|
perform htp_htitle('Line
|
Break');
|
perform htp_htitle('');
|
perform htp_htitle(NULL);
|
perform htp_htitle(' ');
|
perform htp_htitle('TITLE', 16, 'align', 'nowrap', 'clear', 'index_rate=100');
|
perform htp_htitle('TIT LE', -10, 'ali gn', 'no wrap', 'cle ar', 'index_rate 100');
|
perform htp_htitle('Заголовок', 14, 'расположение', 'обертка', 'выключка', 'атрибут');
|
perform htp_htitle('🔥💻🚀', 5, '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀', ' ');
|
perform htp_htitle('U < V > W & X', 1, 'F < G > H & I', 'J < K > L & M', 'E < O > P & N', 'Q < R > S & T');
|
perform htp_htitle(' ', 0, ' ', ' ', ' ', ' ');
|
perform htp_htitle('\n', 1, '\t', '\\', '\n', '\n');
|
perform htp_htitle(chr(9) || 'Test' || chr(9), 2, 'Col1 Col2 Col3', chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3');
|
perform htp_get_data();
|
END $$;
|
|
--htp_img tests
|
DO $$
|
BEGIN
|
perform htp_img('/images/what.jpg', 'left', 'The horse', 'yes', 'index_rate=100'); -- alt escapes space
|
perform htp_img('WHAT?');
|
perform htp_img('гора'); -- doesn't convert russian symbols in html unicode codes
|
perform htp_img('🙂'); -- emoji is not converted to html unicode too
|
perform htp_img('<script>alert(1)</script>');
|
perform htp_img('A < B > C & D');
|
perform htp_img('Line
|
Break');
|
perform htp_img(''); -- Empty string
|
perform htp_img(NULL); -- NULL value
|
perform htp_img(' '); -- Single space
|
perform htp_img('/images/ what.jpg', 'le ft', 'The horse', 'ye s', 'index_rate 100'); -- all attrs are escaping space but not cattr and src
|
perform htp_img('пикчр', 'левый', 'Лошадь', 'да', 'атрибут 30'); -- src doesn't escape unicode, alt and align do, cattrs is not escaped
|
perform htp_img('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
|
perform htp_img('U < V > W & X', 'F < G > H & I', 'J < K > L & M', 'E < O > P & N', 'Q < R > S & T');
|
perform htp_img('', '', '', '', '');
|
perform htp_img(' ', ' ', ' ', ' ', ' ');
|
perform htp_img('\n', '\t', '\\', '\n', '\n');
|
perform htp_img(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3');
|
perform htp_get_data();
|
END $$;
|
|
--htp_img2 tests
|
DO $$
|
BEGIN
|
perform htp_img2('/images/what.jpg', 'left', 'The horse', 'yes', 'map.jpg', 'index_rate=100'); -- alt escapes space
|
perform htp_img2('WHAT?');
|
perform htp_img2('скала'); -- doesn't convert russian symbols in html unicode codes
|
perform htp_img2('🙂'); -- emoji is not converted to html unicode too
|
perform htp_img2('<script>alert(1)</script>');
|
perform htp_img2('A < B > C & D');
|
perform htp_img2('Line
|
Break');
|
perform htp_img2(''); -- Empty string
|
perform htp_img2(NULL); -- NULL value
|
perform htp_img2(' '); -- Single space
|
perform htp_img2('/images/ what.jpg', 'le ft', 'The horse', 'ye s', 'map .jpg', 'index_rate 100'); -- all attrs are escaping space but not cattr and src
|
perform htp_img2('пикчр', 'левый', 'Лошадь', 'да', 'карта', 'атрибут 30'); -- src doesn't escape unicode, alt and align do, cattrs is not escaped
|
perform htp_img2('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
|
perform htp_img2('U < V > W & X', 'F < G > H & I', 'J < K > L & M', 'E < O > P & N', 'Q < R > S & T', 'U < V > X & Y');
|
perform htp_img2('', '', '', '', '', '');
|
perform htp_img2(' ', ' ', ' ', ' ', ' ', ' ');
|
perform htp_img2('\n', '\t', '\\', '\n', '\n', '\t');
|
perform htp_img2(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
|
'Col1 Col2 Col3', 'Col1 Col2 Col3');
|
perform htp_get_data();
|
END $$;
|
|
--htp_isindex tests
|
DO $$
|
BEGIN
|
perform htp_isindex('Enter the message...', 'https://somesite.ru');
|
perform htp_isindex();
|
perform htp_isindex(NULL);
|
perform htp_isindex('');
|
perform htp_isindex('холл'); -- converts russian symbols in html unicode codes
|
perform htp_isindex('🙂'); -- emoji is converted to html unicode too
|
perform htp_isindex('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_isindex('Line
|
Break'); -- converts linebreak
|
perform htp_isindex('ийк', 'опр');
|
perform htp_isindex('E < O > P & N', 'U < V > W & X');
|
perform htp_isindex('', '');
|
perform htp_isindex(' ', ' '); -- prompt escapes spaces
|
perform htp_isindex('\n', '\t'); -- prompt escapes slash
|
perform htp_isindex(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- prompt escapes tabs
|
perform htp_isindex(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_line tests
|
DO $$
|
BEGIN
|
perform htp_line('left', '/images/line.jpg', 'myValue=77');
|
perform htp_line();
|
perform htp_line(NULL);
|
perform htp_line('');
|
perform htp_line('🙂', '🙂'); -- emoji is converted to html unicode by cclear but not by csrc
|
perform htp_line('Line
|
Break'); -- converts linebreak
|
perform htp_line('left right', 'some term', 'index_rate 100'); -- space is converted to html unicode by cclear but not by csrc
|
perform htp_line('ийк', 'абв', 'index_rate=опр'); -- csrc doesn't convert russian symbols to unicode
|
perform htp_line('E < O > P & N', 'U < V > W & X', 'U < V > W & X');
|
perform htp_line('<script>alert(4444)</script>', '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>');
|
perform htp_line('', '', '');
|
perform htp_line(' ', ' ', ' ');
|
perform htp_line('\n', '\r', '\t'); -- slash is converted to html unicode by cclear but not by csrc
|
perform htp_line(chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- tab is converted to html unicode by cclear but not by csrc
|
perform htp_line(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_italic tests
|
DO $$
|
BEGIN
|
perform htp_italic('This one should be italic', 'usage=27');
|
perform htp_italic(NULL);
|
perform htp_italic('');
|
perform htp_italic('мебель'); -- converts russian symbols in html unicode codes
|
perform htp_italic('🙂'); -- emoji is converted to html unicode too
|
perform htp_italic('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_italic('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_italic('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_italic('ийк', 'index_rate=опр');
|
perform htp_italic('E < O > P & N', 'U < V > W & X');
|
perform htp_italic('', '');
|
perform htp_italic(' ', ' ');
|
perform htp_italic('\n', '\t'); -- doesn't escape slash
|
perform htp_italic(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_italic(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_kbd tests
|
DO $$
|
BEGIN
|
perform htp_kbd('This one should be monospace', 'usage=66');
|
perform htp_kbd(NULL);
|
perform htp_kbd('');
|
perform htp_kbd('зарево'); -- converts russian symbols in html unicode codes
|
perform htp_kbd('🙂'); -- emoji is converted to html unicode too
|
perform htp_kbd('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_kbd('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_kbd('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_kbd('ийк', 'index_rate=опр');
|
perform htp_kbd('E < O > P & N', 'U < V > W & X');
|
perform htp_kbd('', '');
|
perform htp_kbd(' ', ' ');
|
perform htp_kbd('\n', '\t'); -- doesn't escape slash
|
perform htp_kbd(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_kbd(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_keyboard tests
|
DO $$
|
BEGIN
|
perform htp_keyboard('This one should be monospace too', 'usage=70');
|
perform htp_keyboard(NULL);
|
perform htp_keyboard('');
|
perform htp_keyboard('корона'); -- converts russian symbols in html unicode codes
|
perform htp_keyboard('🙂'); -- emoji is converted to html unicode too
|
perform htp_keyboard('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_keyboard('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_keyboard('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_keyboard('ийк', 'index_rate=опр');
|
perform htp_keyboard('E < O > P & N', 'U < V > W & X');
|
perform htp_keyboard('', '');
|
perform htp_keyboard(' ', ' ');
|
perform htp_keyboard('\n', '\t'); -- doesn't escape slash
|
perform htp_keyboard(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_keyboard(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_linkrel tests
|
DO $$
|
BEGIN
|
perform htp_linkrel('stylesheet', '/styles/main.css');
|
perform htp_linkrel('style sheet', '/styles/ main.css', 'cascade styles'); -- all attrs are escaping space but not href
|
perform htp_linkrel('стили', 'главный.ксс', 'таблицы стилей'); -- all attrs are escaping unicode but not href
|
perform htp_linkrel('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
|
perform htp_linkrel('<script>alert(22)</script>', '<script>alert(333)</script>', '<script>alert(4444)</script>'); -- href converts special symbols to html codes, others do a html unicode conv
|
perform htp_linkrel('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
|
perform htp_linkrel('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N'); -- all attrs are escaping line breaks but not href
|
perform htp_linkrel('', '', '');
|
perform htp_linkrel(' ', ' ', ' ');
|
perform htp_linkrel('\\', '\n', '\t'); -- all attrs are escaping slashes but not href
|
perform htp_linkrel('\0', '\xFF', '\x41');
|
perform htp_linkrel(NULL, NULL, NULL);
|
perform htp_linkrel('Col1 Col2 Col3', 'Col1 Col2 Col3', chr(9) || 'Test' || chr(9)); -- all attrs are escaping tabs but not href
|
perform htp_linkrel(chr(1) || chr(2) || chr(3), chr(27), chr(8)); -- all attrs are escaping control chars but not href
|
perform htp_get_data();
|
END $$;
|
|
--htp_linkrev tests
|
DO $$
|
BEGIN
|
perform htp_linkrev('htmlpage', '/styles/main.css');
|
perform htp_linkrev('style sheet', '/styles/ main.css', 'cascade styles'); -- all attrs are escaping space but not href
|
perform htp_linkrev('стили', 'главный.ксс', 'таблицы стилей'); -- all attrs are escaping unicode but not href
|
perform htp_linkrev('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
|
perform htp_linkrev('<script>alert(22)</script>', '<script>alert(333)</script>', '<script>alert(4444)</script>'); -- href converts special symbols to html codes, others do a html unicode conv
|
perform htp_linkrev('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
|
perform htp_linkrev('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N'); -- all attrs are escaping line breaks but not href
|
perform htp_linkrev('', '', '');
|
perform htp_linkrev(' ', ' ', ' ');
|
perform htp_linkrev('\\', '\n', '\t'); -- all attrs are escaping slashes but not href
|
perform htp_linkrev('\0', '\xFF', '\x41');
|
perform htp_linkrev(NULL, NULL, NULL);
|
perform htp_linkrev('Col1 Col2 Col3', 'Col1 Col2 Col3', chr(9) || 'Test' || chr(9)); -- all attrs are escaping tabs but not href
|
perform htp_linkrev(chr(1) || chr(2) || chr(3), chr(27), chr(8)); -- all attrs are escaping control chars but not href
|
perform htp_get_data();
|
END $$;
|
|
--htp_listheader tests
|
DO $$
|
BEGIN
|
perform htp_listheader(NULL);
|
perform htp_listheader('');
|
perform htp_listheader('дворец'); -- converts russian symbols in html unicode codes
|
perform htp_listheader('🙂'); -- emoji is converted to html unicode too
|
perform htp_listheader('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_listheader('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_listheader('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_listheader('ийк', 'index_rate=опр');
|
perform htp_listheader('E < O > P & N', 'U < V > W & X');
|
perform htp_listheader('', '');
|
perform htp_listheader(' ', ' ');
|
perform htp_listheader('\n', '\t'); -- doesn't escape slash
|
perform htp_listheader(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_listheader(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_listitem tests
|
DO $$
|
BEGIN
|
perform htp_listitem();
|
perform htp_listitem(''); -- Empty string
|
perform htp_listitem(NULL); -- NULL value
|
perform htp_listitem(' '); -- Single space
|
perform htp_listitem('list point', 'lef t', '* *', '/something. html', 'index_rate=10 0'); -- only text and cattr don't escape space
|
perform htp_listitem('абв', 'где', 'ёжз', 'ийк', 'лмн'); -- text escapes russian symbols
|
perform htp_listitem('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
|
perform htp_listitem('<script>alert(22)</script>', '<script>alert(333)</script>',
|
'<script>alert(4444)</script>', '<script>alert(55555)</script>',
|
'index_rate=<script>alert(666666)</script>');
|
perform htp_listitem('F < G > H & I', 'J < K > L & M', 'E < O > P & N',
|
'Q < R > S & T', 'U < V > W & X'); -- text escapes special symbols to special html code
|
perform htp_listitem('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N', 'Q
|
< R > S & T', 'U < V > W
|
& X'); -- line break is not escaped in text, cattrs
|
perform htp_listitem('', '', '', '', ''); -- '' as null for margins, ' ' as null for noresize
|
perform htp_listitem(' ', ' ', ' ', ' ', ' '); -- space is not escaped by text, cattr
|
perform htp_listitem('\n', '\r', '\t', '\\', '\n');
|
perform htp_listitem('\"', '\x41', '\101', '\0', '\xFF');
|
perform htp_listitem('Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
|
'Col1 Col2 Col3'); -- tab is not escaped by text, cattr
|
perform htp_listitem(chr(1) || chr(2) || chr(3), chr(27), chr(8), chr(7), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_mailto tests
|
DO $$
|
BEGIN
|
perform htp_mailto('some@where.net', 'Send email to someone');
|
perform htp_mailto('some @where.net', 'Send email to someone', 'Some one', 'index_rate=10 0'); -- only name escapes space
|
perform htp_mailto('абв', 'где', 'ёжз', 'ийк'); -- name and text escapes russian symbols
|
perform htp_mailto('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
|
perform htp_mailto('<script>alert(22)</script>', '<script>alert(333)</script>',
|
'<script>alert(4444)</script>', 'index_rate=<script>alert(666666)</script>');
|
perform htp_mailto('F < G > H & I', 'J < K > L & M',
|
'Q < R > S & T', 'U < V > W & X'); -- caddress, ctext, cattr escapes spec symbols to html codes, cname escapes to unicode
|
perform htp_mailto('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N', 'Q
|
< R > S & T'); -- caddress, ctext, cattr doesn't escape tabs, cname escapes to unicode
|
perform htp_mailto('', '', '', '');
|
perform htp_mailto(' ', ' ', ' ', ' '); -- space is escaped by cname
|
perform htp_mailto('\n', '\r', '\t', '\\');
|
perform htp_mailto('\"', '\x41', '\101', '\0');
|
perform htp_mailto('Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9)); -- tab is escaped by cname
|
perform htp_mailto(chr(1) || chr(2) || chr(3), chr(27), chr(8), chr(7));
|
perform htp_get_data();
|
END $$;
|
|
--htp_mapopen tests
|
DO $$
|
BEGIN
|
perform htp_mapopen(NULL);
|
perform htp_mapopen('');
|
perform htp_mapopen('Рыбалка'); -- converts russian symbols in html unicode codes
|
perform htp_mapopen('🙂'); -- emoji is converted to html unicode too
|
perform htp_mapopen('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_mapopen('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_mapopen('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_mapopen('ийк', 'index_rate=опр');
|
perform htp_mapopen('E < O > P & N', 'U < V > W & X');
|
perform htp_mapopen('', '');
|
perform htp_mapopen(' ', ' ');
|
perform htp_mapopen('\n', '\t'); -- doesn't escape slash
|
perform htp_mapopen(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_mapopen(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_meta tests
|
DO $$
|
BEGIN
|
perform htp_meta('re fresh', 'Test Site', '3; url=https://www.test.org'); -- everything escapes spaces
|
perform htp_meta('абв', 'где', 'ёжз'); -- everything escapes russian symbols
|
perform htp_meta('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
|
perform htp_meta('<script>alert(22)</script>', '<script>alert(333)</script>',
|
'<script>alert(4444)</script>');
|
perform htp_meta('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
|
perform htp_meta('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N');
|
perform htp_meta(NULL, NULL, NULL);
|
perform htp_meta('', '', '');
|
perform htp_meta(' ', ' ', ' ');
|
perform htp_meta('\n', '\r', '\t');
|
perform htp_meta('\"', '\x41', '\101');
|
perform htp_meta('Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9));
|
perform htp_meta(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_nextid tests
|
DO $$
|
BEGIN
|
perform htp_nextid(NULL);
|
perform htp_nextid('');
|
perform htp_nextid('Колода');
|
perform htp_nextid('🙂');
|
perform htp_nextid('A < B > C & D');
|
perform htp_nextid('Line
|
Break');
|
perform htp_nextid(' ');
|
perform htp_nextid('\n\t');
|
perform htp_nextid(chr(9) || 'Test' || chr(9));
|
perform htp_nextid(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_nl tests
|
DO $$
|
BEGIN
|
perform htp_nl('Normal', 'usage=1');
|
perform htp_nl(); -- empty
|
perform htp_nl(NULL);
|
perform htp_nl('');
|
perform htp_nl('дерево'); -- converts russian symbols in html unicode codes
|
perform htp_nl('🙂'); -- emoji is converted to html unicode too
|
perform htp_nl('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_nl('Line
|
Break'); -- converts linebreak to html unicode codes
|
perform htp_nl('some term', 'index_rate=100'); -- escapes space
|
perform htp_nl('ийк', 'index_rate=опр');
|
perform htp_nl('E < O > P & N', 'U < V > W & X');
|
perform htp_nl('', '');
|
perform htp_nl(' ', ' ');
|
perform htp_nl('\n', '\t'); -- escapes slash
|
perform htp_nl(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- escapes tabs
|
perform htp_nl(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_nobr tests
|
DO $$
|
BEGIN
|
perform htp_nobr(NULL);
|
perform htp_nobr('');
|
perform htp_nobr('крона'); -- convert russian symbols to html unicode codes
|
perform htp_nobr('🙂'); -- converts emoji to html unicode too
|
perform htp_nobr('A < B > C & D'); -- converts special symbols to html special codes
|
perform htp_nobr('Line
|
Break'); -- does not convert linebreak
|
perform htp_nobr(' ');
|
perform htp_nobr('\n\t'); -- doesn't escape slash
|
perform htp_nobr(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_nobr(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_paragraph tests
|
DO $$
|
BEGIN
|
perform htp_paragraph();
|
perform htp_paragraph(''); -- Empty string
|
perform htp_paragraph(NULL); -- NULL value
|
perform htp_paragraph(' '); -- Single space
|
perform htp_paragraph('le ft', 'ye s', 'le ft', 'myAttr= value'); -- calign cclear escape spaces
|
perform htp_paragraph('абв', 'где', 'ёжз', 'икл'); -- calign cclear escape russian symbols
|
perform htp_paragraph('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
|
perform htp_paragraph('<script>alert(22)</script>', '<script>alert(333)</script>',
|
'<script>alert(4444)</script>', '<script>alert(55555)</script>');
|
perform htp_paragraph('F < G > H & I', 'J < K > L & M',
|
'E < O > P & N', 'Q < R > S & T'); -- calign cclear escape spec symbols
|
perform htp_paragraph('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N', 'Q < R >
|
S & T'); -- calign cclear escape linebreaks
|
perform htp_paragraph(NULL, NULL, NULL, NULL);
|
perform htp_paragraph('', '', '', '');
|
perform htp_paragraph(' ', ' ', ' ', ' '); -- space is escaped by calign cclear
|
perform htp_paragraph('\n', '\r', '\t', '\\'); -- slash is escaped by calign cclear
|
perform htp_paragraph('\"', '\x41', '\101', '\0');
|
perform htp_paragraph('Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
|
perform htp_paragraph(chr(1) || chr(2) || chr(3), chr(27), chr(8), chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_param tests
|
DO $$
|
BEGIN
|
perform htp_param('F < G >
|
H & I', 'J < K >
|
L & M'); -- linebreak is escaped
|
perform htp_param('some term', 'index rate'); -- space is escaped
|
perform htp_param('🔥💻🚀', '🔥💻🚀'); -- emoji is escaped
|
perform htp_param('ийк', 'опр'); -- russian symbols are escaped
|
perform htp_param('E < O > P & N', 'U < V > W & X'); -- spec symbols are escaped
|
perform htp_param('', '');
|
perform htp_param(' ', ' ');
|
perform htp_param('\n', '\t');
|
perform htp_param(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3');
|
perform htp_param(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_plaintext tests
|
DO $$
|
BEGIN
|
perform htp_plaintext(NULL);
|
perform htp_plaintext('');
|
perform htp_plaintext('бокал'); -- converts russian symbols in html unicode codes
|
perform htp_plaintext('🙂'); -- emoji is converted to html unicode too
|
perform htp_plaintext('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_plaintext('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_plaintext('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_plaintext('ийк', 'index_rate=опр');
|
perform htp_plaintext('E < O > P & N', 'U < V > W & X');
|
perform htp_plaintext('', '');
|
perform htp_plaintext(' ', ' ');
|
perform htp_plaintext('\n', '\t'); -- doesn't escape slash
|
perform htp_plaintext(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_plaintext(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_prints tests
|
DO $$
|
BEGIN
|
perform htp_prints(NULL); -- nothing at all
|
perform htp_prints(''); -- nothing at all
|
perform htp_prints('дорога'); -- does not convert russian symbols in html unicode codes
|
perform htp_prints('🙂'); -- does not convert emoji to html unicode too
|
perform htp_prints('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_prints('Line
|
Break'); -- does not convert linebreak to html unicode codes
|
perform htp_prints(' ');
|
perform htp_prints('\n\t'); -- doesn't escape slash
|
perform htp_prints(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_prints(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_ps tests
|
DO $$
|
BEGIN
|
perform htp_ps(NULL); -- nothing at all
|
perform htp_ps(''); -- nothing at all
|
perform htp_ps('долгая'); -- does not convert russian symbols in html unicode codes
|
perform htp_ps('🙂'); -- does not convert emoji to html unicode too
|
perform htp_ps('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_ps('Line
|
Break'); -- does not convert linebreak to html unicode codes
|
perform htp_ps(' ');
|
perform htp_ps('\n\t'); -- doesn't escape slash
|
perform htp_ps(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_ps(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_s tests
|
DO $$
|
BEGIN
|
perform htp_s(NULL);
|
perform htp_s('');
|
perform htp_s('пирог'); -- converts russian symbols in html unicode codes
|
perform htp_s('🙂'); -- emoji is converted to html unicode too
|
perform htp_s('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_s('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_s('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_s('ийк', 'index_rate=опр');
|
perform htp_s('E < O > P & N', 'U < V > W & X');
|
perform htp_s('', '');
|
perform htp_s(' ', ' ');
|
perform htp_s('\n', '\t'); -- doesn't escape slash
|
perform htp_s(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_s(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_strike tests
|
DO $$
|
BEGIN
|
perform htp_strike(NULL);
|
perform htp_strike('');
|
perform htp_strike('облако'); -- converts russian symbols in html unicode codes
|
perform htp_strike('🙂'); -- emoji is converted to html unicode too
|
perform htp_strike('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_strike('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_strike('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_strike('ийк', 'index_rate=опр');
|
perform htp_strike('E < O > P & N', 'U < V > W & X');
|
perform htp_strike('', '');
|
perform htp_strike(' ', ' ');
|
perform htp_strike('\n', '\t'); -- doesn't escape slash
|
perform htp_strike(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_strike(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_samp tests
|
DO $$
|
BEGIN
|
perform htp_sample(NULL);
|
perform htp_sample('');
|
perform htp_sample('провод'); -- converts russian symbols in html unicode codes
|
perform htp_sample('🙂'); -- emoji is converted to html unicode too
|
perform htp_sample('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_sample('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_sample('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_sample('ийк', 'index_rate=опр');
|
perform htp_sample('E < O > P & N', 'U < V > W & X');
|
perform htp_sample('', '');
|
perform htp_sample(' ', ' ');
|
perform htp_sample('\n', '\t'); -- doesn't escape slash
|
perform htp_sample(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_sample(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_small tests
|
DO $$
|
BEGIN
|
perform htp_small(NULL);
|
perform htp_small('');
|
perform htp_small('шарнир'); -- converts russian symbols in html unicode codes
|
perform htp_small('🙂'); -- emoji is converted to html unicode too
|
perform htp_small('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_small('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_small('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_small('ийк', 'index_rate=опр');
|
perform htp_small('E < O > P & N', 'U < V > W & X');
|
perform htp_small('', '');
|
perform htp_small(' ', ' ');
|
perform htp_small('\n', '\t'); -- doesn't escape slash
|
perform htp_small(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_small(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_script tests
|
DO $$
|
BEGIN
|
perform htp_script(NULL);
|
perform htp_script('');
|
perform htp_script('собор'); -- converts russian symbols in html unicode codes
|
perform htp_script('🙂'); -- emoji is converted to html unicode too
|
perform htp_script('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_script('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_script('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_script('ийк', 'index_rate=опр');
|
perform htp_script('E < O > P & N', 'U < V > W & X');
|
perform htp_script('', '');
|
perform htp_script(' ', ' ');
|
perform htp_script('\n', '\t'); -- doesn't escape slash
|
perform htp_script(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_script(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_strong tests
|
DO $$
|
BEGIN
|
perform htp_strong('Normal', 'usage=1');
|
perform htp_strong(NULL);
|
perform htp_strong('');
|
perform htp_strong('кабриолет'); -- converts russian symbols in html unicode codes
|
perform htp_strong('🙂'); -- emoji is converted to html unicode too
|
perform htp_strong('A < B > C & D'); -- converts special symbols to special html code
|
perform htp_strong('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_strong('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_strong('ийк', 'index_rate=опр');
|
perform htp_strong('E < O > P & N', 'U < V > W & X');
|
perform htp_strong('', '');
|
perform htp_strong(' ', ' ');
|
perform htp_strong('\n', '\t'); -- doesn't escape slash
|
perform htp_strong(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_strong(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_style tests
|
DO $$
|
BEGIN
|
perform htp_style(NULL); -- nothing at all
|
perform htp_style(''); -- nothing at all
|
perform htp_style('закат'); -- convert russian symbols to html unicode codes
|
perform htp_style('🙂'); -- converts emoji to html unicode too
|
perform htp_style('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_style('Line
|
Break'); -- does not convert linebreak to html unicode codes
|
perform htp_style(' ');
|
perform htp_style('\n\t'); -- doesn't escape slash
|
perform htp_style(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_style(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_sub tests
|
DO $$
|
BEGIN
|
perform htp_sub(''); -- Empty string
|
perform htp_sub(NULL); -- NULL value
|
perform htp_sub(' '); -- Single space
|
perform htp_sub('subscript data');
|
perform htp_sub('сапожник'); -- converts russian symbols in html unicode codes
|
perform htp_sub('🙂'); -- emoji is converted to html unicode too
|
perform htp_sub('yes', 'left', 'myAttr=value');
|
perform htp_sub('ye s', 'le ft', 'myAttr= value'); -- calign escapes spaces
|
perform htp_sub('абв', 'где', 'ёжз'); -- calign ctext escape russian symbols
|
perform htp_sub('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
|
perform htp_sub('<script>alert(22)</script>', '<script>alert(333)</script>',
|
'<script>alert(4444)</script>');
|
perform htp_sub('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
|
perform htp_sub('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N'); -- calign cclear escape linebreaks
|
perform htp_sub(NULL, NULL, NULL);
|
perform htp_sub('', '', '');
|
perform htp_sub(' ', ' ', ' '); -- space is escaped by calign
|
perform htp_sub('\n', '\r', '\t'); -- slash is escaped by calign
|
perform htp_sub('\"', '\x41', '\101');
|
perform htp_sub('Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
|
perform htp_sub(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_sup tests
|
DO $$
|
BEGIN
|
perform htp_sup(''); -- Empty string
|
perform htp_sup(NULL); -- NULL value
|
perform htp_sup(' '); -- Single space
|
perform htp_sup('subscript data');
|
perform htp_sup('краб'); -- converts russian symbols in html unicode codes
|
perform htp_sup('🙂'); -- emoji is converted to html unicode too
|
perform htp_sup('yes', 'left', 'myAttr=value');
|
perform htp_sup('ye s', 'le ft', 'myAttr= value'); -- calign escapes spaces
|
perform htp_sup('абв', 'где', 'ёжз'); -- calign ctext escape russian symbols
|
perform htp_sup('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
|
perform htp_sup('<script>alert(22)</script>', '<script>alert(333)</script>',
|
'<script>alert(4444)</script>');
|
perform htp_sup('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
|
perform htp_sup('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N'); -- calign cclear escape linebreaks
|
perform htp_sup(NULL, NULL, NULL);
|
perform htp_sup('', '', '');
|
perform htp_sup(' ', ' ', ' '); -- space is escaped by calign
|
perform htp_sup('\n', '\r', '\t'); -- slash is escaped by calign
|
perform htp_sup('\"', '\x41', '\101');
|
perform htp_sup('Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
|
perform htp_sup(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_tablecaption tests
|
DO $$
|
BEGIN
|
perform htp_tablecaption(''); -- Empty string
|
perform htp_tablecaption(NULL); -- NULL value
|
perform htp_tablecaption(' '); -- Single space
|
perform htp_tablecaption('subscript data');
|
perform htp_tablecaption('нож'); -- converts russian symbols in html unicode codes
|
perform htp_tablecaption('🙂'); -- emoji is converted to html unicode too
|
perform htp_tablecaption('yes', 'left', 'myAttr=value');
|
perform htp_tablecaption('ye s', 'le ft', 'myAttr= value'); -- calign escapes spaces
|
perform htp_tablecaption('абв', 'где', 'ёжз'); -- calign ctext escape russian symbols
|
perform htp_tablecaption('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
|
perform htp_tablecaption('<script>alert(22)</script>', '<script>alert(333)</script>',
|
'<script>alert(4444)</script>');
|
perform htp_tablecaption('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
|
perform htp_tablecaption('F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N'); -- calign cclear escape linebreaks
|
perform htp_tablecaption(NULL, NULL, NULL);
|
perform htp_tablecaption('', '', '');
|
perform htp_tablecaption(' ', ' ', ' '); -- space is escaped by calign
|
perform htp_tablecaption('\n', '\r', '\t'); -- slash is escaped by calign
|
perform htp_tablecaption('\"', '\x41', '\101');
|
perform htp_tablecaption('Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
|
perform htp_tablecaption(chr(1) || chr(2) || chr(3), chr(27), chr(8));
|
perform htp_get_data();
|
END $$;
|
|
--htp_tabledata tests
|
DO $$
|
BEGIN
|
perform htp_tabledata('cell');
|
perform htp_tabledata(''); -- Empty string
|
perform htp_tabledata(NULL); -- NULL value
|
perform htp_tabledata(' '); -- Single space
|
perform htp_tabledata('Todd', 'left', 'rrr10', 'yes', '3', '3', 'index_rate=100');
|
perform htp_tabledata('To dd', 'le ft', '1 0', 'ye s', ' 3', ' 3', 'index_rate= 100'); -- all attrs are escaping space but not cvalue and cattr
|
perform htp_tabledata('абв', 'где', 'ёжз', 'ийк', 'лмн', 'опр', 'сту'); -- attrs are escaping unicode, cattrs is not escaped
|
perform htp_tabledata('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
|
perform htp_tabledata('<script>alert()</script>', '<script>alert(1)</script>', '<script>alert(22)</script>',
|
'<script>alert(333)</script>', '<script>alert(4444)</script>',
|
'<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>'); -- cvalue escapes spec symbs to html spec
|
perform htp_tabledata('A < B > C & D', 'E < E > E & E', 'F < G > H & I',
|
'J < K > L & M', 'E < O > P & N',
|
'Q < R > S & T', 'U < V > W & X');
|
perform htp_tabledata('A < B >
|
C & D', 'E < E >
|
E & E', 'F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N', 'Q
|
< R > S & T', 'U < V > W
|
& X'); -- line break is escaped by every attr, not escaped in cattrs, cvalue
|
perform htp_tabledata('', '', '', '', '', '', '');
|
perform htp_tabledata(' ', ' ', ' ', ' ', ' ', ' ', ' '); -- spaces is not escaped only by cattrs, cvalue
|
perform htp_tabledata('\\', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is not escaped in cattrs, cvalue
|
perform htp_tabledata('\101', '\"', '\x41', '\101', '\0', '\xFF', '\xFF');
|
perform htp_tabledata('""', '"', NULL, NULL, '""', '"', '"');
|
perform htp_tabledata('Col1 Col2 Col3', 'Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
|
'Col1 Col2 Col3', chr(9) || 'Test' || chr(9));
|
perform htp_tabledata(chr(1) || chr(2) || chr(3), chr(1) || chr(2) || chr(3), chr(27),
|
chr(8), chr(7), chr(8), chr(7));
|
perform htp_get_data();
|
END $$;
|
|
--htp_tableheader tests
|
DO $$
|
BEGIN
|
perform htp_tableheader('cell');
|
perform htp_tableheader(''); -- Empty string
|
perform htp_tableheader(NULL); -- NULL value
|
perform htp_tableheader(' '); -- Single space
|
perform htp_tableheader('Todd', 'left', 'rrr10', 'yes', '3', '3', 'index_rate=100');
|
perform htp_tableheader('To dd', 'le ft', '1 0', 'ye s', ' 3', ' 3', 'index_rate= 100'); -- all attrs are escaping space but not cvalue and cattr
|
perform htp_tableheader('абв', 'где', 'ёжз', 'ийк', 'лмн', 'опр', 'сту'); -- attrs are escaping unicode, cattrs is not escaped
|
perform htp_tableheader('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
|
perform htp_tableheader('<script>alert()</script>', '<script>alert(1)</script>', '<script>alert(22)</script>',
|
'<script>alert(333)</script>', '<script>alert(4444)</script>',
|
'<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>'); -- cvalue escapes spec symbs to html spec
|
perform htp_tableheader('A < B > C & D', 'E < E > E & E', 'F < G > H & I',
|
'J < K > L & M', 'E < O > P & N',
|
'Q < R > S & T', 'U < V > W & X');
|
perform htp_tableheader('A < B >
|
C & D', 'E < E >
|
E & E', 'F < G >
|
H & I', 'J < K >
|
L & M', 'E < O
|
> P & N', 'Q
|
< R > S & T', 'U < V > W
|
& X'); -- line break is escaped by every attr, not escaped in cattrs, cvalue
|
perform htp_tableheader('', '', '', '', '', '', '');
|
perform htp_tableheader(' ', ' ', ' ', ' ', ' ', ' ', ' '); -- spaces is not escaped only by cattrs, cvalue
|
perform htp_tableheader('\\', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is not escaped in cattrs, cvalue
|
perform htp_tableheader('\101', '\"', '\x41', '\101', '\0', '\xFF', '\xFF');
|
perform htp_tableheader('""', '"', NULL, NULL, '""', '"', '"');
|
perform htp_tableheader('Col1 Col2 Col3', 'Col1 Col2 Col3', 'Col1 Col2 Col3',
|
chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
|
'Col1 Col2 Col3', chr(9) || 'Test' || chr(9));
|
perform htp_tableheader(chr(1) || chr(2) || chr(3), chr(1) || chr(2) || chr(3), chr(27),
|
chr(8), chr(7), chr(8), chr(7));
|
perform htp_get_data();
|
END $$;
|
|
-- htp_teletype tests
|
DO $$
|
BEGIN
|
perform htp_teletype(NULL);
|
perform htp_teletype('');
|
perform htp_teletype('Зелено'); -- converts russian symbols in html unicode codes
|
perform htp_teletype('🙂'); -- emoji is converted to html unicode too
|
perform htp_teletype('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_teletype('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_teletype('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_teletype('ийк', 'index_rate=опр');
|
perform htp_teletype('E < O > P & N', 'U < V > W & X');
|
perform htp_teletype('', '');
|
perform htp_teletype(' ', ' ');
|
perform htp_teletype('\n', '\t'); -- doesn't escape slash
|
perform htp_teletype(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_teletype(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
-- htp_title tests
|
DO $$
|
BEGIN
|
perform htp_title(NULL); -- nothing at all
|
perform htp_title(''); -- nothing at all
|
perform htp_title('много'); -- convert russian symbols to html unicode codes
|
perform htp_title('🙂'); -- converts emoji to html unicode too
|
perform htp_title('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_title('Line
|
Break'); -- does not convert linebreak to html unicode codes
|
perform htp_title(' ');
|
perform htp_title('\n\t'); -- doesn't escape slash
|
perform htp_title(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
|
perform htp_title(chr(1) || chr(2) || chr(3));
|
perform htp_get_data();
|
END $$;
|
|
--htp_underline tests
|
DO $$
|
BEGIN
|
perform htp_underline(NULL);
|
perform htp_underline('');
|
perform htp_underline('уголь'); -- converts russian symbols in html unicode codes
|
perform htp_underline('🙂'); -- emoji is converted to html unicode too
|
perform htp_underline('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_underline('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_underline('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_underline('ийк', 'index_rate=опр');
|
perform htp_underline('E < O > P & N', 'U < V > W & X');
|
perform htp_underline('', '');
|
perform htp_underline(' ', ' ');
|
perform htp_underline('\n', '\t'); -- doesn't escape slash
|
perform htp_underline(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_underline(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--htp_variable tests
|
DO $$
|
BEGIN
|
perform htp_variable(NULL);
|
perform htp_variable('');
|
perform htp_variable('руда'); -- converts russian symbols in html unicode codes
|
perform htp_variable('🙂'); -- emoji is converted to html unicode too
|
perform htp_variable('A < B > C & D'); -- converts special symbols to html unicode codes
|
perform htp_variable('Line
|
Break'); -- doesn't convert linebreak
|
perform htp_variable('some term', 'index_rate=100'); -- doesn't escape space
|
perform htp_variable('ийк', 'index_rate=опр');
|
perform htp_variable('E < O > P & N', 'U < V > W & X');
|
perform htp_variable('', '');
|
perform htp_variable(' ', ' ');
|
perform htp_variable('\n', '\t'); -- doesn't escape slash
|
perform htp_variable(chr(9) || 'Test' || chr(9), 'Col1 Col2 Col3'); -- doesn't escape tabs
|
perform htp_variable(chr(1) || chr(2) || chr(3), chr(27));
|
perform htp_get_data();
|
END $$;
|
|
--common test
|
DO $$
|
BEGIN
|
perform htp_htitle('Test HTML doc', 1, 'left', 'yes', 'left', 'myAttr=1');
|
perform htp_title('Big Great Test Page');
|
perform htp_style('body {background-color: #f0f0f0;}');
|
perform htp_linkrel('stylesheet', 'main.css', 'css');
|
perform htp_linkrev('author', 'book.html', 'War And Peace');
|
perform htp_meta('refresh', 'Test Site', '3;url=https://www.test.org');
|
perform htp_hr('left', '/images/line.jpg', 'myAttr=2');
|
perform htp_line('right', '/images/line2.jpg', 'myAttr=2.5');
|
perform htp_basefont(14);
|
perform htp_bgsound('town.mid', '-1', 'myAttr=value');
|
perform htp_div('', 'myAttr=3');
|
perform htp_header(1, 'Test Header');
|
perform htp_frame('https://example.com', 'sample site', '100', '100', 'yes', '555', 'myAttr=3.5');
|
perform htp_base('_self', 'myAttr=3.7');
|
perform htp_comment('Obsolete data');
|
perform htp_code('print("Hello World")', 'myAttr=4');
|
perform htp_cite('Cite this', 'myAttr=5');
|
perform htp_center('Needs to be centered');
|
perform htp_br('linebreak', 'myAttr=6');
|
perform htp_em('This needs to be emphasized', 'myAttr=6.5');
|
perform htp_bold('This needs to be bolder', 'myAttr=7');
|
perform htp_big('This needs to be bigger', 'myAttr=7.5');
|
perform htp_img('/images/horse.jpg', 'left', 'Horse.', 'yes', 'myAttr=8');
|
perform htp_img2('/images/jaguar.jpg', 'left', 'Tiger.', 'yes', '/images/lion.jpg', 'myAttr=9');
|
perform htp_isindex('Enter the message...', 'https://somesite.ru');
|
perform htp_italic('This one should be italic', 'myAttr=10');
|
perform htp_kbd('This one should be monospace', 'myAttr=11');
|
perform htp_keyboard('This one should be monospace too', 'myAttr=12');
|
perform htp_dfn('Also italic', 'myAttr=13');
|
perform htp_listheader('Coffee List', 'myAttr=14');
|
perform htp_listitem('listpoint', 'left', '*', '/something.html', 'myAttr=15');
|
perform htp_mailto('some@where.net', 'Send email to someone', 'Someone', 'myAttr=16');
|
perform htp_mapopen('Infographic', 'myAttr=17');
|
perform htp_mapclose();
|
perform htp_nextid('Prefix');
|
perform htp_nl('linebreak', 'myAttr=18');
|
perform htp_nobr('Oneliner');
|
perform htp_wbr();
|
perform htp_paragraph('left', 'yes', 'left', 'myAttr=17');
|
perform htp_param('length', '18');
|
perform htp_plaintext('Fixed-width text', 'myAttr=18');
|
perform htp_prints('Normal&usage');
|
perform htp_ps('std::vector<int>');
|
perform htp_s('Dead option', 'myAttr=19');
|
perform htp_strike('Another dead option', 'myAttr=20');
|
perform htp_sample('Another monospace sample', 'myAttr=21');
|
perform htp_small('This needs to be smaller', 'myAttr=22');
|
perform htp_script('alert("The number is negative")', 'javascript');
|
perform htp_strong('Make it bolder', 'myAttr=23');
|
perform htp_sub('subscript data', 'left', 'myAttr=24');
|
perform htp_sup('superscript data', 'right', 'myAttr=25');
|
perform htp_tablecaption('Big Main Table', 'right', 'myAttr=26');
|
perform htp_tableheader('Cell header', 'left', '10', 'yes', '3', '3', 'myAttr=27');
|
perform htp_tabledata('Cell data', 'left', '10', 'yes', '3', '3', 'myAttr=28');
|
perform htp_teletype('Teletype text', 'myAttr=29');
|
perform htp_underline('Underlined text', 'myAttr=30');
|
perform htp_variable('Variable in italics', 'myAttr=31');
|
perform htp_get_data();
|
END $$;
|
\connect regression
|
DROP DATABASE rudb_htp_utf8_regress;
|