File:  [parser3project] / parser3 / tests / 346-curl.html
Revision 1.11: download - view: text, annotated - select for diffs - revision graph
Fri Dec 13 14:18:51 2024 UTC (17 months, 2 weeks ago) by moko
Branches: MAIN
CVS tags: release_3_5_1, release_3_5_0, HEAD
no dll name under Windows, hiding

@main[]

1. ^try-catch{ ^curl:info[] }
2. ^try-catch{ ^curl:options[ $.charset[UTF-8] ] }
3. ^try-catch{ ^curl:options[ $.url[http://parser.ru/] ] }

4. ^curl:session{ $s[^curl:version[]] }

5. ^try-catch{ ^curl:options[ $.library[no-such-library.so] ] }

^curl:session{
	6. ^try-catch{ ^curl:options[ $.url[ftp://parser.ru/] ] }
	7. ^try-catch{ ^curl:options[ $.httppost[ $.name[ $.hash[] ]] ] }
	8. ^try-catch{ ^curl:options[ $.httppost[string] ] }
	8.1. ^try-catch{ ^curl:options[ $.httppost{code} ] }

	8.2. ^try-catch{ ^curl:options[ $.httpheader[string] ] }
	8.3. ^try-catch{ ^curl:options[ $.httpheader{code} ] }
	8.4. ^try-catch{ ^curl:options[ $.httpheader{  } ] }

	9. ^try-catch{ ^curl:options[ $.no-such-option[] ] }
	10. ^try-catch{ ^curl:info[no-such-info] }
	11. ^json:string[^curl:info[]]

	^curl:options[
		$.url[http://www.parser.ru/_/tests/readme]
		$.timeout(5)
	]

	12. $f[^curl:load[
		$.range[4-] 
	]]

	$f.text $f.CONTENT-RANGE

	13. $f[^curl:load[
		$.range[33-]
	]]

	$f.text $f.CONTENT-RANGE

	13.1. ^try-catch{ ^curl:options[ $.http_version[unknown] ] }
	13.2. ^try-catch{ ^curl:options[ $.http_version[1.0] ] }
}

14. ^show[text;
	$.postfields[test]
	$.useragent[^taint[parser 3]]

	$.name[test.txt]
	$.mode[binary]
	$.content-type[something/text]
]

15. ^show[binary;
	$.postfields[^file::load[binary;155.cfg]]
]

^curl:session{

16. ^show[empty post;
	$.post(true)
]

17. ^show[empty get;
	$.httppost[]
	$.post(false)
]

}

18. ^show[empty custompost;
	$.customrequest[POST]
]

19. ^try-catch-filtered{ ^curl:load[ $.url[http://no-such-domain.parser.ru/] ] }

@show[title;options]
^try-catch{^show-real[$title;$options]}

@show-real[title;options][f;text;t;post]

$f[^curl:load[
	$options
	$.timeout(5)
	$.url[http://www.parser.ru/_/tests/223.pl]
]]

$title : {
"name":"$f.name",
"size":$f.size,
"mode":"$f.mode",
"content-type":"^taint[json;$f.content-type]",
}

$text[^taint[as-is][$f.text]]
# cut off the post's body is any
$text[^text.match[POST:(.*)<EOF>][]{$post[$match.1]}]

# create table with http headers
$t[^table::create[nameless]{^taint[as-is][^text.replace[^table::create{a	b
 = 	^taint[^#09]
^taint[^#0A]	^taint[^#0A]}]]}]
^t.sort{$t.0}

# print all
<h3>Headers</h3>
<pre>^t.menu{$t.0	: $t.1}[^#0A]</pre>

<h3>Body</h3>
<pre>^taint[as-is][$post]</pre>
<hr />

E-mail: