eric-mechanize 0.9.3.20090623142847
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +504 -0
- data/EXAMPLES.rdoc +171 -0
- data/FAQ.rdoc +11 -0
- data/GUIDE.rdoc +122 -0
- data/LICENSE.rdoc +340 -0
- data/Manifest.txt +169 -0
- data/README.rdoc +60 -0
- data/Rakefile +43 -0
- data/examples/flickr_upload.rb +23 -0
- data/examples/mech-dump.rb +7 -0
- data/examples/proxy_req.rb +9 -0
- data/examples/rubyforge.rb +21 -0
- data/examples/spider.rb +11 -0
- data/lib/mechanize.rb +7 -0
- data/lib/www/mechanize.rb +619 -0
- data/lib/www/mechanize/chain.rb +34 -0
- data/lib/www/mechanize/chain/auth_headers.rb +80 -0
- data/lib/www/mechanize/chain/body_decoding_handler.rb +48 -0
- data/lib/www/mechanize/chain/connection_resolver.rb +78 -0
- data/lib/www/mechanize/chain/custom_headers.rb +23 -0
- data/lib/www/mechanize/chain/handler.rb +9 -0
- data/lib/www/mechanize/chain/header_resolver.rb +53 -0
- data/lib/www/mechanize/chain/parameter_resolver.rb +24 -0
- data/lib/www/mechanize/chain/post_connect_hook.rb +0 -0
- data/lib/www/mechanize/chain/pre_connect_hook.rb +22 -0
- data/lib/www/mechanize/chain/request_resolver.rb +32 -0
- data/lib/www/mechanize/chain/response_body_parser.rb +40 -0
- data/lib/www/mechanize/chain/response_header_handler.rb +50 -0
- data/lib/www/mechanize/chain/response_reader.rb +41 -0
- data/lib/www/mechanize/chain/ssl_resolver.rb +42 -0
- data/lib/www/mechanize/chain/uri_resolver.rb +77 -0
- data/lib/www/mechanize/content_type_error.rb +16 -0
- data/lib/www/mechanize/cookie.rb +72 -0
- data/lib/www/mechanize/cookie_jar.rb +191 -0
- data/lib/www/mechanize/file.rb +73 -0
- data/lib/www/mechanize/file_response.rb +62 -0
- data/lib/www/mechanize/file_saver.rb +39 -0
- data/lib/www/mechanize/form.rb +360 -0
- data/lib/www/mechanize/form/button.rb +8 -0
- data/lib/www/mechanize/form/check_box.rb +13 -0
- data/lib/www/mechanize/form/field.rb +28 -0
- data/lib/www/mechanize/form/file_upload.rb +24 -0
- data/lib/www/mechanize/form/image_button.rb +23 -0
- data/lib/www/mechanize/form/multi_select_list.rb +69 -0
- data/lib/www/mechanize/form/option.rb +51 -0
- data/lib/www/mechanize/form/radio_button.rb +38 -0
- data/lib/www/mechanize/form/select_list.rb +45 -0
- data/lib/www/mechanize/headers.rb +12 -0
- data/lib/www/mechanize/history.rb +67 -0
- data/lib/www/mechanize/inspect.rb +90 -0
- data/lib/www/mechanize/monkey_patch.rb +37 -0
- data/lib/www/mechanize/page.rb +181 -0
- data/lib/www/mechanize/page/base.rb +10 -0
- data/lib/www/mechanize/page/frame.rb +22 -0
- data/lib/www/mechanize/page/link.rb +50 -0
- data/lib/www/mechanize/page/meta.rb +51 -0
- data/lib/www/mechanize/pluggable_parsers.rb +103 -0
- data/lib/www/mechanize/redirect_limit_reached_error.rb +18 -0
- data/lib/www/mechanize/redirect_not_get_or_head_error.rb +20 -0
- data/lib/www/mechanize/response_code_error.rb +25 -0
- data/lib/www/mechanize/unsupported_scheme_error.rb +10 -0
- data/lib/www/mechanize/util.rb +76 -0
- data/mechanize.gemspec +41 -0
- data/test/chain/test_argument_validator.rb +14 -0
- data/test/chain/test_auth_headers.rb +25 -0
- data/test/chain/test_custom_headers.rb +18 -0
- data/test/chain/test_header_resolver.rb +28 -0
- data/test/chain/test_parameter_resolver.rb +35 -0
- data/test/chain/test_request_resolver.rb +29 -0
- data/test/chain/test_response_reader.rb +24 -0
- data/test/data/htpasswd +1 -0
- data/test/data/server.crt +16 -0
- data/test/data/server.csr +12 -0
- data/test/data/server.key +15 -0
- data/test/data/server.pem +15 -0
- data/test/helper.rb +129 -0
- data/test/htdocs/alt_text.html +10 -0
- data/test/htdocs/bad_form_test.html +9 -0
- data/test/htdocs/button.jpg +0 -0
- data/test/htdocs/empty_form.html +6 -0
- data/test/htdocs/file_upload.html +26 -0
- data/test/htdocs/find_link.html +41 -0
- data/test/htdocs/form_multi_select.html +16 -0
- data/test/htdocs/form_multival.html +37 -0
- data/test/htdocs/form_no_action.html +18 -0
- data/test/htdocs/form_no_input_name.html +16 -0
- data/test/htdocs/form_select.html +16 -0
- data/test/htdocs/form_select_all.html +16 -0
- data/test/htdocs/form_select_none.html +17 -0
- data/test/htdocs/form_select_noopts.html +10 -0
- data/test/htdocs/form_set_fields.html +14 -0
- data/test/htdocs/form_test.html +188 -0
- data/test/htdocs/frame_test.html +30 -0
- data/test/htdocs/google.html +13 -0
- data/test/htdocs/iframe_test.html +16 -0
- data/test/htdocs/index.html +6 -0
- data/test/htdocs/link with space.html +5 -0
- data/test/htdocs/meta_cookie.html +11 -0
- data/test/htdocs/no_title_test.html +6 -0
- data/test/htdocs/relative/tc_relative_links.html +21 -0
- data/test/htdocs/tc_bad_links.html +5 -0
- data/test/htdocs/tc_base_link.html +8 -0
- data/test/htdocs/tc_blank_form.html +11 -0
- data/test/htdocs/tc_checkboxes.html +19 -0
- data/test/htdocs/tc_encoded_links.html +5 -0
- data/test/htdocs/tc_follow_meta.html +8 -0
- data/test/htdocs/tc_form_action.html +48 -0
- data/test/htdocs/tc_links.html +18 -0
- data/test/htdocs/tc_no_attributes.html +16 -0
- data/test/htdocs/tc_pretty_print.html +17 -0
- data/test/htdocs/tc_radiobuttons.html +17 -0
- data/test/htdocs/tc_referer.html +10 -0
- data/test/htdocs/tc_relative_links.html +19 -0
- data/test/htdocs/tc_textarea.html +23 -0
- data/test/htdocs/unusual______.html +5 -0
- data/test/servlets.rb +365 -0
- data/test/ssl_server.rb +48 -0
- data/test/test_authenticate.rb +71 -0
- data/test/test_bad_links.rb +25 -0
- data/test/test_blank_form.rb +16 -0
- data/test/test_checkboxes.rb +61 -0
- data/test/test_content_type.rb +13 -0
- data/test/test_cookie_class.rb +338 -0
- data/test/test_cookie_jar.rb +362 -0
- data/test/test_cookies.rb +123 -0
- data/test/test_encoded_links.rb +20 -0
- data/test/test_errors.rb +49 -0
- data/test/test_follow_meta.rb +108 -0
- data/test/test_form_action.rb +52 -0
- data/test/test_form_as_hash.rb +61 -0
- data/test/test_form_button.rb +38 -0
- data/test/test_form_no_inputname.rb +15 -0
- data/test/test_forms.rb +564 -0
- data/test/test_frames.rb +25 -0
- data/test/test_get_headers.rb +52 -0
- data/test/test_gzipping.rb +22 -0
- data/test/test_hash_api.rb +45 -0
- data/test/test_history.rb +142 -0
- data/test/test_history_added.rb +16 -0
- data/test/test_html_unscape_forms.rb +39 -0
- data/test/test_if_modified_since.rb +20 -0
- data/test/test_keep_alive.rb +31 -0
- data/test/test_links.rb +120 -0
- data/test/test_mech.rb +268 -0
- data/test/test_mechanize_file.rb +47 -0
- data/test/test_meta.rb +65 -0
- data/test/test_multi_select.rb +106 -0
- data/test/test_no_attributes.rb +13 -0
- data/test/test_option.rb +18 -0
- data/test/test_page.rb +124 -0
- data/test/test_pluggable_parser.rb +145 -0
- data/test/test_post_form.rb +34 -0
- data/test/test_pretty_print.rb +22 -0
- data/test/test_radiobutton.rb +75 -0
- data/test/test_redirect_limit_reached.rb +41 -0
- data/test/test_redirect_verb_handling.rb +45 -0
- data/test/test_referer.rb +39 -0
- data/test/test_relative_links.rb +40 -0
- data/test/test_request.rb +13 -0
- data/test/test_response_code.rb +52 -0
- data/test/test_save_file.rb +48 -0
- data/test/test_scheme.rb +48 -0
- data/test/test_select.rb +106 -0
- data/test/test_select_all.rb +15 -0
- data/test/test_select_none.rb +15 -0
- data/test/test_select_noopts.rb +16 -0
- data/test/test_set_fields.rb +44 -0
- data/test/test_ssl_server.rb +20 -0
- data/test/test_subclass.rb +14 -0
- data/test/test_textarea.rb +45 -0
- data/test/test_upload.rb +109 -0
- data/test/test_verbs.rb +25 -0
- metadata +314 -0
data/test/helper.rb
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..','lib')))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'mechanize'
|
5
|
+
require 'webrick/httputils'
|
6
|
+
require File.join(File.dirname(__FILE__),'servlets')
|
7
|
+
|
8
|
+
BASE_DIR = File.dirname(__FILE__)
|
9
|
+
|
10
|
+
# Move this to a test base class
|
11
|
+
module MechTestHelper
|
12
|
+
def self.fake_page(agent)
|
13
|
+
html = <<-END
|
14
|
+
<html><body>
|
15
|
+
<form><input type="submit" value="submit" /></form>
|
16
|
+
</body></html>
|
17
|
+
END
|
18
|
+
html_response = { 'content-type' => 'text/html' }
|
19
|
+
page = WWW::Mechanize::Page.new( nil, html_response, html, 200, agent )
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Net::HTTP
|
24
|
+
alias :old_do_start :do_start
|
25
|
+
|
26
|
+
def do_start
|
27
|
+
@started = true
|
28
|
+
end
|
29
|
+
|
30
|
+
SERVLETS = {
|
31
|
+
'/gzip' => GzipServlet,
|
32
|
+
'/form_post' => FormTest,
|
33
|
+
'/basic_auth' => BasicAuthServlet,
|
34
|
+
'/form post' => FormTest,
|
35
|
+
'/response_code' => ResponseCodeTest,
|
36
|
+
'/http_refresh' => HttpRefreshTest,
|
37
|
+
'/bad_content_type' => BadContentTypeTest,
|
38
|
+
'/content_type_test' => ContentTypeTest,
|
39
|
+
'/referer' => RefererServlet,
|
40
|
+
'/file_upload' => FileUploadTest,
|
41
|
+
'/one_cookie' => OneCookieTest,
|
42
|
+
'/one_cookie_no_space' => OneCookieNoSpacesTest,
|
43
|
+
'/many_cookies' => ManyCookiesTest,
|
44
|
+
'/many_cookies_as_string' => ManyCookiesAsStringTest,
|
45
|
+
'/send_cookies' => SendCookiesTest,
|
46
|
+
'/if_modified_since' => ModifiedSinceServlet,
|
47
|
+
'/http_headers' => HeaderServlet,
|
48
|
+
'/infinite_redirect' => InfiniteRedirectTest,
|
49
|
+
'/infinite_refresh' => InfiniteRefreshTest,
|
50
|
+
'/redirect' => RedirectTest,
|
51
|
+
'/refresh_without_url' => RefreshWithoutUrl,
|
52
|
+
'/refresh_with_empty_url' => RefreshWithEmptyUrl,
|
53
|
+
'/digest_auth' => DigestAuthServlet,
|
54
|
+
'/verb' => VerbServlet,
|
55
|
+
}
|
56
|
+
|
57
|
+
PAGE_CACHE = {}
|
58
|
+
|
59
|
+
alias :old_request :request
|
60
|
+
|
61
|
+
def request(request, *data, &block)
|
62
|
+
url = URI.parse(request.path)
|
63
|
+
path = URI.unescape(url.path)
|
64
|
+
|
65
|
+
path = '/index.html' if path == '/'
|
66
|
+
|
67
|
+
res = Response.new
|
68
|
+
request.query = WEBrick::HTTPUtils.parse_query(url.query)
|
69
|
+
request.cookies = WEBrick::Cookie.parse(request['Cookie'])
|
70
|
+
if SERVLETS[path]
|
71
|
+
if request.method == "POST"
|
72
|
+
if request['Content-Type'] =~ /^multipart\/form-data/
|
73
|
+
request.body = data.first
|
74
|
+
else
|
75
|
+
request.query = WEBrick::HTTPUtils.parse_query(data.first)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
SERVLETS[path].new({}).send("do_#{request.method}", request, res)
|
79
|
+
else
|
80
|
+
filename = "htdocs#{path.gsub(/[^\/\\.\w_\s]/, '_')}"
|
81
|
+
unless PAGE_CACHE[filename]
|
82
|
+
File.open("#{BASE_DIR}/#{filename}", 'rb') { |file|
|
83
|
+
PAGE_CACHE[filename] = file.read
|
84
|
+
}
|
85
|
+
end
|
86
|
+
res.body = PAGE_CACHE[filename]
|
87
|
+
end
|
88
|
+
|
89
|
+
res['Content-Type'] ||= 'text/html'
|
90
|
+
res['Content-Length'] ||= res.body.length.to_s
|
91
|
+
res.code ||= "200"
|
92
|
+
|
93
|
+
res.cookies.each do |cookie|
|
94
|
+
res.add_field('Set-Cookie', cookie.to_s)
|
95
|
+
end
|
96
|
+
yield res if block_given?
|
97
|
+
res
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class Net::HTTPRequest
|
102
|
+
attr_accessor :query, :body, :cookies, :user
|
103
|
+
end
|
104
|
+
|
105
|
+
class Response
|
106
|
+
include Net::HTTPHeader
|
107
|
+
|
108
|
+
attr_reader :code
|
109
|
+
attr_accessor :body, :query, :cookies
|
110
|
+
|
111
|
+
def code=(c)
|
112
|
+
@code = c.to_s
|
113
|
+
end
|
114
|
+
|
115
|
+
alias :status :code
|
116
|
+
alias :status= :code=
|
117
|
+
|
118
|
+
def initialize
|
119
|
+
@header = {}
|
120
|
+
@body = ''
|
121
|
+
@code = nil
|
122
|
+
@query = nil
|
123
|
+
@cookies = []
|
124
|
+
end
|
125
|
+
|
126
|
+
def read_body
|
127
|
+
yield body
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<html>
|
2
|
+
<meta http-equiv="Refresh" content="0; url=http://www.drphil.com/">
|
3
|
+
<body>
|
4
|
+
<a href="alt_text.html"><img alt="alt text" src="hello"></a>
|
5
|
+
<a href="no_alt_text.html"><img src="hello"></a>
|
6
|
+
<a href="nil_alt_text.html"><img alt src="hello"></a>
|
7
|
+
<a href="no_image.html">no image</a>
|
8
|
+
<a href="no_text.html"></a>
|
9
|
+
</body>
|
10
|
+
</html>
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>File Upload Form</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<h1>File Upload Test</h1>
|
7
|
+
<form enctype="multipart/form-data" action="/file_upload" method="post">
|
8
|
+
Your name: <input type="text" name="name" /><br />
|
9
|
+
File to process: <input name="userfile1" type="file" /><br />
|
10
|
+
<input type="text" name="foo[aaron]" value="test" />
|
11
|
+
<select name="foo">
|
12
|
+
</select>
|
13
|
+
<input type="submit" value="Send File" />
|
14
|
+
</form>
|
15
|
+
<form enctype="multipart/form-data" action="/file_upload" method="post">
|
16
|
+
Your name: <input type="text" name="name" /><br />
|
17
|
+
File to process: <input name="green[eggs]" type="file" /><br />
|
18
|
+
<input type="submit" value="Send File" />
|
19
|
+
</form>
|
20
|
+
<form enctype="multipart/form-data" action="/file_upload" name="value_test" method="post">
|
21
|
+
Your name: <input type="text" name="name" /><br />
|
22
|
+
File to process: <input name="green[eggs]" value="/etc/hosts" type="file" /><br />
|
23
|
+
<input type="submit" value="Send File" />
|
24
|
+
</form>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta http_equiv="Refresh" content="0; url=http://www.incorrect.com">
|
4
|
+
<meta http-equiv="Rfresh" content="0; url=http://www.also-wrong.com">
|
5
|
+
<meta http-equiv="Refresh" content="0; url=http://www.drphil.com/">
|
6
|
+
<meta http-equiv="Refresh" content="0; url='http://tenderlovemaking.com/'">
|
7
|
+
<META HTTP-EQUIV="REFRESH" CONTENT="0; URL=HTTP://WWW.UPCASE.COM/">
|
8
|
+
<TITLE>Testing the links</TITLE>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<A HREF="http://blargle.com/">blargle</A>
|
12
|
+
<A HREF="http://a.cpan.org/">CPAN A</A>
|
13
|
+
<A HREF="http://b.cpan.org/">CPAN B</A>
|
14
|
+
<FRAME SRC="foo.html">
|
15
|
+
<FRAME SRC="bar.html">
|
16
|
+
<A HREF="http://c.cpan.org/" NAME="bongo">CPAN C</A>
|
17
|
+
<A HREF="http://d.cpan.org/">CPAN D</A>
|
18
|
+
|
19
|
+
<A HREF="http://www.msnbc.com/">MSNBC</A>
|
20
|
+
<FRAME SRC="http://www.oreilly.com/" NAME="wongo">
|
21
|
+
<A HREF="http://www.cnn.com/">CNN</A>
|
22
|
+
<A HREF="http://www.bbc.co.uk/" NAME="Wilma">BBC</A>
|
23
|
+
<A HREF="http://www.msnbc.com/">News</A>
|
24
|
+
<A HREF="http://www.cnn.com/" NAME="Fred">News</A>
|
25
|
+
<A HREF="http://www.bbc.co.uk/">News</A>
|
26
|
+
<A onmouseover="window.status='Rebuild Files'; return true" href="#" onClick="window.open( '/cgi-bin/MT/mt.cgi', 'rebuild', 'width=400,height=200,resizable=yes')">Rebuild Index</A>
|
27
|
+
|
28
|
+
<MAP NAME="SOME_MAP">
|
29
|
+
<AREA HREF="http://www.msnbc.com/area" COORDS="1,2,3,4"></AREA>
|
30
|
+
<AREA HREF="http://www.cnn.com/area" COORDS="5,6,7,8" NAME="Marty">
|
31
|
+
<AREA HREF="http://www.cpan.org/area" COORDS="10,11,12,13" />
|
32
|
+
</MAP>
|
33
|
+
<IMG SRC="SOME_IMAGE" USEMAP="#SOME_MAP">
|
34
|
+
|
35
|
+
<!-- new stuff -->
|
36
|
+
<A HREF="http://nowhere.org/" Name="Here">NoWhere</A>
|
37
|
+
<A HREF="http://nowhere.org/padded" Name=" Here "> NoWhere </A>
|
38
|
+
<A HREF="blongo.html">Blongo!</A>
|
39
|
+
</body>
|
40
|
+
</html>
|
41
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<html>
|
2
|
+
<body>
|
3
|
+
<form name="form1" method="post" action="/form_post">
|
4
|
+
<select name="list" multiple size="3">
|
5
|
+
<option value="1">Option 1</option>
|
6
|
+
<option value="2" selected>Option 2</option>
|
7
|
+
<option value="3">Option 3</option>
|
8
|
+
<option value="4">Option 4</option>
|
9
|
+
<option value="5">Option 5</option>
|
10
|
+
<option value="6">Option 6</option>
|
11
|
+
</select>
|
12
|
+
<br />
|
13
|
+
<input type="submit" value="Submit" />
|
14
|
+
</form>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<html>
|
2
|
+
<head><title>Page Title</title></head>
|
3
|
+
<body>
|
4
|
+
<form name="post_form" method="post" action="/form_post">
|
5
|
+
<table>
|
6
|
+
<tr>
|
7
|
+
<td>First Name</td>
|
8
|
+
<td><input name="first" type="text" /></td>
|
9
|
+
</tr>
|
10
|
+
<tr>
|
11
|
+
<td>First Name Again</td>
|
12
|
+
<td><input name="first" type="text" /></td>
|
13
|
+
</tr>
|
14
|
+
<tr>
|
15
|
+
<td><input type="submit" value="Submit" /></td>
|
16
|
+
<td></td>
|
17
|
+
</tr>
|
18
|
+
</table>
|
19
|
+
</form>
|
20
|
+
<form name="get_form" method="get" action="/form_post">
|
21
|
+
<table>
|
22
|
+
<tr>
|
23
|
+
<td>First Name</td>
|
24
|
+
<td><input name="first" type="text" /></td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<td>First Name Again</td>
|
28
|
+
<td><input name="first" type="text" /></td>
|
29
|
+
</tr>
|
30
|
+
<tr>
|
31
|
+
<td><input type="submit" value="Submit" /></td>
|
32
|
+
<td></td>
|
33
|
+
</tr>
|
34
|
+
</table>
|
35
|
+
</form>
|
36
|
+
</body>
|
37
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<html>
|
2
|
+
<head><title>Page Title</title></head>
|
3
|
+
<body>
|
4
|
+
<form name="get_form" method="get">
|
5
|
+
<table>
|
6
|
+
<tr>
|
7
|
+
<td>First Name</td>
|
8
|
+
<td><input name="first" type="text" /></td>
|
9
|
+
</tr>
|
10
|
+
<tr>
|
11
|
+
<td><input type="submit" value="Submit" /></td>
|
12
|
+
<td></td>
|
13
|
+
</tr>
|
14
|
+
</table>
|
15
|
+
</form>
|
16
|
+
</body>
|
17
|
+
</html>
|
18
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<html>
|
2
|
+
<head><title>Input with no name</title></head>
|
3
|
+
<body>
|
4
|
+
<form name="test" action="/form_post" method="post">
|
5
|
+
<input type="text" /><br />
|
6
|
+
<input type="password" /><br />
|
7
|
+
<input type="hidden" /><br />
|
8
|
+
<input type="radio" /><br />
|
9
|
+
<input type="checkbox" /><br />
|
10
|
+
<input type="file" /><br />
|
11
|
+
<textarea></textarea>
|
12
|
+
<select></select>
|
13
|
+
<input type="submit" />
|
14
|
+
</form>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<html>
|
2
|
+
<body>
|
3
|
+
<form name="form1" method="post" action="/form_post">
|
4
|
+
<select name="list">
|
5
|
+
<option value="1">Option 1</option>
|
6
|
+
<option value="2" selected>Option 2</option>
|
7
|
+
<option value="3">Option 3</option>
|
8
|
+
<option value="4">Option 4</option>
|
9
|
+
<option value="5">Option 5</option>
|
10
|
+
<option value="6">Option 6</option>
|
11
|
+
</select>
|
12
|
+
<br />
|
13
|
+
<input type="submit" value="Submit" />
|
14
|
+
</form>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<html>
|
2
|
+
<body>
|
3
|
+
<form name="form1" method="post" action="/form_post">
|
4
|
+
<select name="list">
|
5
|
+
<option value="1" selected>Option 1</option>
|
6
|
+
<option value="2" selected>Option 2</option>
|
7
|
+
<option value="3" selected>Option 3</option>
|
8
|
+
<option value="4" selected>Option 4</option>
|
9
|
+
<option value="5" selected>Option 5</option>
|
10
|
+
<option value="6" selected>Option 6</option>
|
11
|
+
</select>
|
12
|
+
<br />
|
13
|
+
<input type="submit" value="Submit" />
|
14
|
+
</form>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<html>
|
2
|
+
<body>
|
3
|
+
<form name="form1" method="post" action="/form_post">
|
4
|
+
<select name="list">
|
5
|
+
<option value="1">Option 1</option>
|
6
|
+
<option value="2">Option 2</option>
|
7
|
+
<option>Option No Value</option>
|
8
|
+
<option value="3">Option 3</option>
|
9
|
+
<option value="4">Option 4</option>
|
10
|
+
<option value="5">Option 5</option>
|
11
|
+
<option value="6">Option 6</option>
|
12
|
+
</select>
|
13
|
+
<br />
|
14
|
+
<input type="submit" value="Submit" />
|
15
|
+
</form>
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>HTML for tc_set_fields</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<form name="set_fields" method="post" action="/form_post">
|
7
|
+
<input type="text" name="first_name" /><br />
|
8
|
+
<input type="text" name="first_name" /><br />
|
9
|
+
<input type="text" name="gender" /><br />
|
10
|
+
<input type="text" name="green[eggs]" /><br />
|
11
|
+
<input type="submit" value="Submit" /><br />
|
12
|
+
</form>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,188 @@
|
|
1
|
+
<html>
|
2
|
+
<head><title>Page Title</title></head>
|
3
|
+
<body>
|
4
|
+
<h1>Post Form 1</h1>
|
5
|
+
<form name="post_form1" method="post" action="/form_post">
|
6
|
+
<table>
|
7
|
+
<tr>
|
8
|
+
<td>First Name</td>
|
9
|
+
<td><input type="text" name="first_name" /></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<td>Gender</td>
|
13
|
+
<td>
|
14
|
+
M: <input type="radio" name="gender" value="male" /><br />
|
15
|
+
F: <input type="radio" name="gender" value="female" /><br />
|
16
|
+
</td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td>Check this if you are cool:</td>
|
20
|
+
<td><input type="checkbox" name="cool person" /></td>
|
21
|
+
</tr>
|
22
|
+
<tr>
|
23
|
+
<td>Check this if you like green eggs:</td>
|
24
|
+
<td><input type="checkbox" name="green[eggs]" /></td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<td>Check this if you like ham:</td>
|
28
|
+
<td><input type="checkbox" name="likes ham" /></td>
|
29
|
+
</tr>
|
30
|
+
</table><br />
|
31
|
+
<select name="country">
|
32
|
+
<option value="USA">USA</option>
|
33
|
+
<option value="CANADA">CANADA</option>
|
34
|
+
</select><br />
|
35
|
+
<select name="empty">
|
36
|
+
</select><br />
|
37
|
+
<input type="submit" value="Submit" />
|
38
|
+
</form>
|
39
|
+
<h1>Get Form 1</h1>
|
40
|
+
<form name="get_form1" method="get" action="/form_post">
|
41
|
+
<table>
|
42
|
+
<tr>
|
43
|
+
<td>First Name</td>
|
44
|
+
<td><input type="text" name="first_name" /></td>
|
45
|
+
</tr>
|
46
|
+
<tr>
|
47
|
+
<td>Gender</td>
|
48
|
+
<td>
|
49
|
+
M: <input type="radio" name="gender" value="male" /><br />
|
50
|
+
F: <input type="radio" name="gender" value="female" /><br />
|
51
|
+
</td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td>Check this if you are cool:</td>
|
55
|
+
<td><input type="checkbox" name="cool person" /></td>
|
56
|
+
</tr>
|
57
|
+
<tr>
|
58
|
+
<td>Check this if you like green eggs:</td>
|
59
|
+
<td><input type="checkbox" name="green[eggs]" /></td>
|
60
|
+
</tr>
|
61
|
+
<tr>
|
62
|
+
<td>Check this if you like ham:</td>
|
63
|
+
<td><input type="checkbox" name="likes ham" /></td>
|
64
|
+
</tr>
|
65
|
+
</table><br />
|
66
|
+
<input type="image" name="button" value="button" src="button.jpg" />
|
67
|
+
<input type="submit" value="Submit" />
|
68
|
+
</form>
|
69
|
+
|
70
|
+
<!-- Get ant post to a form with a space in the name -->
|
71
|
+
<h1>Post Form 2</h1>
|
72
|
+
<form name="post_form2" method="post" action="/form post">
|
73
|
+
<table>
|
74
|
+
<tr>
|
75
|
+
<td>First Name</td>
|
76
|
+
<td><input type="text" name="first_name" /></td>
|
77
|
+
</tr>
|
78
|
+
<tr>
|
79
|
+
<td>Gender</td>
|
80
|
+
<td>
|
81
|
+
M: <input type="radio" name="gender" value="male" /><br />
|
82
|
+
F: <input type="radio" name="gender" value="female" /><br />
|
83
|
+
</td>
|
84
|
+
</tr>
|
85
|
+
<tr>
|
86
|
+
<td>Check this if you are cool:</td>
|
87
|
+
<td><input type="checkbox" name="cool person" /></td>
|
88
|
+
</tr>
|
89
|
+
<tr>
|
90
|
+
<td>Check this if you like ham:</td>
|
91
|
+
<td><input type="checkbox" name="likes ham" /></td>
|
92
|
+
</tr>
|
93
|
+
</table><br />
|
94
|
+
<input type="submit" value="Submit" />
|
95
|
+
</form>
|
96
|
+
<h1>Get Form 2</h1>
|
97
|
+
<form name="get_form2" method="get" action="/form post">
|
98
|
+
<table>
|
99
|
+
<tr>
|
100
|
+
<td>First Name</td>
|
101
|
+
<td><input type="text" name="first_name" /></td>
|
102
|
+
</tr>
|
103
|
+
<tr>
|
104
|
+
<td>Gender</td>
|
105
|
+
<td>
|
106
|
+
M: <input type="radio" name="gender" value="male" /><br />
|
107
|
+
F: <input type="radio" name="gender" value="female" /><br />
|
108
|
+
</td>
|
109
|
+
</tr>
|
110
|
+
<tr>
|
111
|
+
<td>Check this if you are cool:</td>
|
112
|
+
<td><input type="checkbox" name="cool person" /></td>
|
113
|
+
</tr>
|
114
|
+
<tr>
|
115
|
+
<td>Check this if you like ham:</td>
|
116
|
+
<td><input type="checkbox" name="likes ham" /></td>
|
117
|
+
</tr>
|
118
|
+
</table><br />
|
119
|
+
<input type="submit" value="Submit" />
|
120
|
+
</form>
|
121
|
+
|
122
|
+
<!-- forms with parameters in the action -->
|
123
|
+
<h1>Post Form 3</h1>
|
124
|
+
<form name="post_form3" method="post" action="/form_post?great day=yes&one=two">
|
125
|
+
<table>
|
126
|
+
<tr>
|
127
|
+
<td>First Name</td>
|
128
|
+
<td><input type="text" name="first_name" /></td>
|
129
|
+
</tr>
|
130
|
+
<tr>
|
131
|
+
<td>Gender</td>
|
132
|
+
<td>
|
133
|
+
M: <input type="radio" name="gender" value="male" /><br />
|
134
|
+
F: <input type="radio" name="gender" value="female" /><br />
|
135
|
+
</td>
|
136
|
+
</tr>
|
137
|
+
<tr>
|
138
|
+
<td>Check this if you are cool:</td>
|
139
|
+
<td><input type="checkbox" name="cool person" /></td>
|
140
|
+
</tr>
|
141
|
+
<tr>
|
142
|
+
<td>Check this if you like ham:</td>
|
143
|
+
<td><input type="checkbox" name="likes ham" /></td>
|
144
|
+
</tr>
|
145
|
+
</table><br />
|
146
|
+
<input type="submit" value="Submit" />
|
147
|
+
</form>
|
148
|
+
|
149
|
+
<!-- Post form with multipart/form-data -->
|
150
|
+
<h1>Post Form 4 - Multipart</h1>
|
151
|
+
<form name="post_form4_multipart" enctype="multipart/form-data" method="post" action="/form_post">
|
152
|
+
<table>
|
153
|
+
<tr>
|
154
|
+
<td>First Name</td>
|
155
|
+
<td><input type="text" name="first_name" /></td>
|
156
|
+
</tr>
|
157
|
+
</table><br />
|
158
|
+
<input type="submit" value="Submit" />
|
159
|
+
</form>
|
160
|
+
|
161
|
+
<h1>Get Form 3</h1>
|
162
|
+
<form name="get_form3" method="get" action="/form_post?great day=yes&one=two">
|
163
|
+
<table>
|
164
|
+
<tr>
|
165
|
+
<td>First Name</td>
|
166
|
+
<td><input type="text" name="first_name" /></td>
|
167
|
+
</tr>
|
168
|
+
<tr>
|
169
|
+
<td>Gender</td>
|
170
|
+
<td>
|
171
|
+
M: <input type="radio" name="gender" value="male" /><br />
|
172
|
+
F: <input type="radio" name="gender" value="female" /><br />
|
173
|
+
</td>
|
174
|
+
</tr>
|
175
|
+
<tr>
|
176
|
+
<td>Check this if you are cool:</td>
|
177
|
+
<td><input type="checkbox" name="cool person" /></td>
|
178
|
+
</tr>
|
179
|
+
<tr>
|
180
|
+
<td>Check this if you like ham:</td>
|
181
|
+
<td><input type="checkbox" name="likes ham" /></td>
|
182
|
+
</tr>
|
183
|
+
</table><br />
|
184
|
+
<input type="submit" value="Submit" />
|
185
|
+
</form>
|
186
|
+
<a href="/form_test.html">form test</a>
|
187
|
+
</body>
|
188
|
+
</html>
|