From 58daab21cd043e1dc37024a7f99b396788372918 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Mar 2024 14:19:48 +0100 Subject: Merging upstream version 1.44.3. Signed-off-by: Daniel Baumann --- web/server/h2o/libh2o/doc/Makefile | 56 + web/server/h2o/libh2o/doc/README.md | 11 + .../doc/assets/8mbps100msec-nginx195-h2o150.png | Bin 0 -> 328434 bytes .../h2o/libh2o/doc/assets/firstpaintbench.png | Bin 0 -> 79485 bytes web/server/h2o/libh2o/doc/assets/remotebench.png | Bin 0 -> 166223 bytes web/server/h2o/libh2o/doc/assets/searchstyle.css | 125 + .../doc/assets/staticfile612-nginx1910-h2o170.png | Bin 0 -> 106392 bytes web/server/h2o/libh2o/doc/assets/style.css | 367 + web/server/h2o/libh2o/doc/benchmarks.html | 124 + web/server/h2o/libh2o/doc/configure.html | 109 + .../h2o/libh2o/doc/configure/access_control.html | 444 + .../doc/configure/access_log_directives.html | 222 + .../h2o/libh2o/doc/configure/base_directives.html | 975 +++ .../h2o/libh2o/doc/configure/basic_auth.html | 101 + web/server/h2o/libh2o/doc/configure/cgi.html | 112 + .../h2o/libh2o/doc/configure/command_options.html | 102 + .../libh2o/doc/configure/compress_directives.html | 177 + .../h2o/libh2o/doc/configure/dos_detection.html | 173 + .../libh2o/doc/configure/errordoc_directives.html | 133 + .../libh2o/doc/configure/expires_directives.html | 109 + .../libh2o/doc/configure/fastcgi_directives.html | 232 + .../h2o/libh2o/doc/configure/file_directives.html | 427 + .../libh2o/doc/configure/headers_directives.html | 204 + .../h2o/libh2o/doc/configure/http1_directives.html | 112 + .../h2o/libh2o/doc/configure/http2_directives.html | 510 ++ web/server/h2o/libh2o/doc/configure/mruby.html | 281 + .../h2o/libh2o/doc/configure/mruby_directives.html | 144 + .../h2o/libh2o/doc/configure/proxy_directives.html | 535 ++ .../h2o/libh2o/doc/configure/quick_start.html | 128 + .../libh2o/doc/configure/redirect_directives.html | 125 + .../libh2o/doc/configure/reproxy_directives.html | 105 + .../libh2o/doc/configure/status_directives.html | 149 + .../libh2o/doc/configure/syntax_and_structure.html | 284 + .../configure/throttle_response_directives.html | 122 + web/server/h2o/libh2o/doc/faq.html | 126 + web/server/h2o/libh2o/doc/index.html | 114 + web/server/h2o/libh2o/doc/install.html | 188 + .../h2o/libh2o/doc/search/jquery-1.9.1.min.js | 5 + .../libh2o/doc/search/oktavia-english-search.js | 9039 ++++++++++++++++++++ .../h2o/libh2o/doc/search/oktavia-jquery-ui.js | 175 + web/server/h2o/libh2o/doc/search/searchindex.js | 2 + 41 files changed, 16347 insertions(+) create mode 100644 web/server/h2o/libh2o/doc/Makefile create mode 100644 web/server/h2o/libh2o/doc/README.md create mode 100644 web/server/h2o/libh2o/doc/assets/8mbps100msec-nginx195-h2o150.png create mode 100644 web/server/h2o/libh2o/doc/assets/firstpaintbench.png create mode 100644 web/server/h2o/libh2o/doc/assets/remotebench.png create mode 100644 web/server/h2o/libh2o/doc/assets/searchstyle.css create mode 100644 web/server/h2o/libh2o/doc/assets/staticfile612-nginx1910-h2o170.png create mode 100644 web/server/h2o/libh2o/doc/assets/style.css create mode 100644 web/server/h2o/libh2o/doc/benchmarks.html create mode 100644 web/server/h2o/libh2o/doc/configure.html create mode 100644 web/server/h2o/libh2o/doc/configure/access_control.html create mode 100644 web/server/h2o/libh2o/doc/configure/access_log_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/base_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/basic_auth.html create mode 100644 web/server/h2o/libh2o/doc/configure/cgi.html create mode 100644 web/server/h2o/libh2o/doc/configure/command_options.html create mode 100644 web/server/h2o/libh2o/doc/configure/compress_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/dos_detection.html create mode 100644 web/server/h2o/libh2o/doc/configure/errordoc_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/expires_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/fastcgi_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/file_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/headers_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/http1_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/http2_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/mruby.html create mode 100644 web/server/h2o/libh2o/doc/configure/mruby_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/proxy_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/quick_start.html create mode 100644 web/server/h2o/libh2o/doc/configure/redirect_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/reproxy_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/status_directives.html create mode 100644 web/server/h2o/libh2o/doc/configure/syntax_and_structure.html create mode 100644 web/server/h2o/libh2o/doc/configure/throttle_response_directives.html create mode 100644 web/server/h2o/libh2o/doc/faq.html create mode 100644 web/server/h2o/libh2o/doc/index.html create mode 100644 web/server/h2o/libh2o/doc/install.html create mode 100644 web/server/h2o/libh2o/doc/search/jquery-1.9.1.min.js create mode 100644 web/server/h2o/libh2o/doc/search/oktavia-english-search.js create mode 100644 web/server/h2o/libh2o/doc/search/oktavia-jquery-ui.js create mode 100644 web/server/h2o/libh2o/doc/search/searchindex.js (limited to 'web/server/h2o/libh2o/doc') diff --git a/web/server/h2o/libh2o/doc/Makefile b/web/server/h2o/libh2o/doc/Makefile new file mode 100644 index 000000000..5cd5f2984 --- /dev/null +++ b/web/server/h2o/libh2o/doc/Makefile @@ -0,0 +1,56 @@ +VPATH=../srcdoc +OUTPUT=\ + index.html \ + install.html \ + benchmarks.html \ + configure.html \ + configure/quick_start.html \ + configure/command_options.html \ + configure/syntax_and_structure.html \ + configure/base_directives.html \ + configure/compress_directives.html \ + configure/http1_directives.html \ + configure/http2_directives.html \ + configure/access_log_directives.html \ + configure/errordoc_directives.html \ + configure/expires_directives.html \ + configure/fastcgi_directives.html \ + configure/file_directives.html \ + configure/headers_directives.html \ + configure/mruby_directives.html \ + configure/proxy_directives.html \ + configure/redirect_directives.html \ + configure/reproxy_directives.html \ + configure/status_directives.html \ + configure/throttle_response_directives.html \ + configure/basic_auth.html \ + configure/cgi.html \ + configure/mruby.html \ + configure/dos_detection.html \ + configure/access_control.html \ + faq.html \ + +%.html: %.mt snippets/directive.mt snippets/wrapper.mt + ../misc/makedoc.pl $< $@ + +all: mkdir html search/searchindex.js + +mkdir: + mkdir -p doc/configure + +html: $(OUTPUT) + +search/searchindex.js: html + ../misc/oktavia/bin/oktavia-mkindex $(patsubst %,-i %,$(OUTPUT)) -m html -u h2 -c 10 -t js -s english + +publish: all + @if [ -z "$$PUBLISH" ] ; then \ + echo "environment variable PUBLISH not set" >&2 ; \ + exit 1; \ + fi + tar cf - `git ls-files` | (cd $$PUBLISH && tar xf -) + +clean: + rm -f $(OUTPUT) search/searchindex.js + +.PHONY: mkdir html publish publish-check do-publish diff --git a/web/server/h2o/libh2o/doc/README.md b/web/server/h2o/libh2o/doc/README.md new file mode 100644 index 000000000..12500b018 --- /dev/null +++ b/web/server/h2o/libh2o/doc/README.md @@ -0,0 +1,11 @@ +H2O DOCS +======== + +Open index.html for documentation. + +Updating the docs +----------------- + +The contents are automatically generated from https://github.com/h2o/h2o by running `cd doc && make`. + +Please submit changes to the aforementioned repository. diff --git a/web/server/h2o/libh2o/doc/assets/8mbps100msec-nginx195-h2o150.png b/web/server/h2o/libh2o/doc/assets/8mbps100msec-nginx195-h2o150.png new file mode 100644 index 000000000..0a73185de Binary files /dev/null and b/web/server/h2o/libh2o/doc/assets/8mbps100msec-nginx195-h2o150.png differ diff --git a/web/server/h2o/libh2o/doc/assets/firstpaintbench.png b/web/server/h2o/libh2o/doc/assets/firstpaintbench.png new file mode 100644 index 000000000..82d8deffe Binary files /dev/null and b/web/server/h2o/libh2o/doc/assets/firstpaintbench.png differ diff --git a/web/server/h2o/libh2o/doc/assets/remotebench.png b/web/server/h2o/libh2o/doc/assets/remotebench.png new file mode 100644 index 000000000..5ed9261b8 Binary files /dev/null and b/web/server/h2o/libh2o/doc/assets/remotebench.png differ diff --git a/web/server/h2o/libh2o/doc/assets/searchstyle.css b/web/server/h2o/libh2o/doc/assets/searchstyle.css new file mode 100644 index 000000000..e0a5b6f54 --- /dev/null +++ b/web/server/h2o/libh2o/doc/assets/searchstyle.css @@ -0,0 +1,125 @@ +.search { + position: absolute; + right: 10px; + bottom: 20px; + width: 240px; +} + +#searchresult_box { + display: none; + position: absolute; + top: 135px; + right: 0px; + max-width: 500px; + padding: 10px; + background-color: #ffffff; + -moz-border-radius: 8px; + border-radius: 8px; + -moz-box-shadow: 3px 3px 5px 5px #b5b2b2; + box-shadow: 3px 3px 5px 5px #b5b2b2; + opacity: 0.95; + z-index: 100000; +} + +#close_search_box { + position: absolute; + top: 10px; + right: 10px; + width: 20px; + height: 20px; + text-align: center; + vertical-align: middle; + color: #666; +} + +#close_search_box:hover { + background-color: #d1e8ff; + border: 1px solid gray; +} + +#close_search_box:active { + background-color: #b4c8db; + border: 1px solid gray; +} + + +#searchresult_summary { + color: #444; +} + +#searchresult .entry { + margin: 10px 10px 10px 10px; + color: black; +} + +#searchresult .entry .title { + font-size: normal; +} + +#searchresult .entry .url { + font-size: 14px!important; + color: #093; + font-style: normal; + font-family: arial,sans-serif; +} + +#searchresult .entry .content { + font-size: small; + font-family: arial,sans-serif; + color: #222; +} + +#searchresult .entry .content .hit { + font-weight: bolder; + text-decoration: underline; +} + +#searchresult .proposal { + margin: 10px 10px 10px 10px; + color: #222; + font-size: small; + font-family: arial,sans-serif; +} +#searchresult .proposal .option { + background-color: #e8f4ff; + border-bottom: 1px solid blue; +} + +#searchresult .proposal .option:hover { + background-color: #d1e8ff; +} + +#searchresult .proposal .option:active { + background-color: #b4c8db; +} + +#searchresult_nav .selected { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +#searchresult_nav span { + background-color: #ffffff; + border: 1px solid #888888; + padding: 5px; + margin: 5px; + color: #222; +} + +#searchresult_nav span:hover { + background-color: #d1e8ff; + border: 1px solid #7d98ff; +} + +#searchresult_nav span:active { + background-color: #b4c8db; + border: 1px solid #6c83db; +} + +#searchresult_box span.pr { + position: absolute; + right: 10px; + bottom: 10px; + font-size: x-small; + color: #555; +} diff --git a/web/server/h2o/libh2o/doc/assets/staticfile612-nginx1910-h2o170.png b/web/server/h2o/libh2o/doc/assets/staticfile612-nginx1910-h2o170.png new file mode 100644 index 000000000..63ec69310 Binary files /dev/null and b/web/server/h2o/libh2o/doc/assets/staticfile612-nginx1910-h2o170.png differ diff --git a/web/server/h2o/libh2o/doc/assets/style.css b/web/server/h2o/libh2o/doc/assets/style.css new file mode 100644 index 000000000..fec08c3a7 --- /dev/null +++ b/web/server/h2o/libh2o/doc/assets/style.css @@ -0,0 +1,367 @@ +body { + background: #f2f2f2; + margin: 0; + padding: 0; + color: black; + font-family: Arial, sans-serif; + line-height: 1.3em; +} + +a { + color: #009; +} + +#body { + background: #fff; + margin: 0 auto; + padding: 0; + width: 100%; + max-width: 800px; + text-align: justify; +} + +#top { + background: #336; + color: #eee; + width: 100%; + padding: 0 0; + margin: 0 0; + position: relative; +} + +#top h1 { + font-size: 60px; + padding: 35px 10px 0 50px; + margin: 0 0; + line-height: 1em; +} + +#top h1 a { + color: #fff; + text-decoration: none; +} + +#top .description { + padding: 0 10px 20px 50px; + margin: 0 0; +} + +@media screen and (max-width: 800px) { + #top .description { + padding-bottom: 45px; + } +} + +#top ul { + float: right; + margin: 20px 0 0 0; + padding: 0 50px 0 0; +} + +#top ul li { + display: inline; + font-weight: bold; + margin: 0; + padding: 0 0 0 1em; +} + +#top ul li a { + color: #600; +} + +#menu { + width: 100%; + background: #fff; + padding: 0; + border-collapse: collapse; + table-layout: fixed; +} + +#menu td { + text-align: center; + border: 1px solid #aaa; + background: #ddd; +} + +@media screen and (max-width: 800px) { + #menu td { + word-break: break-word; + } + + #menu td:first-child, + #menu td:last-child { + border-left: none; + border-right: none; + } +} + +#menu td a { + display: block; + padding: 0.4em; + color: #333; + font-weight: bold; + text-decoration: none; +} + +@media screen and (max-width: 800px) { + #menu td a { + padding-left: 0; + padding-right: 0; + } +} + +#menu .selected { + background: white; + font-weight: bold; +} + +#menu .selected a { + color: black; +} + +#breadcrumb { + margin: 0; + padding: 2em 50px 0 50px; + font-weight: bold; +} + +#main { + margin: 0; + width: 698px; + padding: 0 50px 1em 50px; + display: inline-block; + border: 1px solid #aaa; + border-top: none; +} + +@media screen and (max-width: 800px) { + #main { + width: 100%; + padding-left: 0; + padding-right: 0; + border-left: none; + border-right: none; + } +} + +#main h2 { + font-size: 120%; + margin: 2em 0 1em 0; +} + +#main h2 a { + color: black; + text-decoration: none; +} + +#main h3 { + font-size: 100%; + margin: 2em 0 1em 0; +} + +#main div { + margin: 1em 0; +} + +#main dt { + margin-top: 0.5em; + font-weight: bold; +} + +#main ul li { + margin-top: 0.2em; + margin-bottom: 0.2em; +} + +#main ul li ul li { + margin-top: 0.1em; + margin-bottom: 0.1em; +} + +#main pre { + border: 1px solid gray; + margin: 0.2em 0; + padding: 0.5em; + background: #f6f6f6; + overflow-x: auto; +} + +#main .example .caption { + text-align: center; + margin-bottom: 0.2em; +} + +#main table { + margin: 1em auto; + border: 1px solid #ccc; + border-collapse: collapse; +} + +#main table td,th { + border: 1px solid #ccc; + padding: 0.3em 0.5em; +} + +#main table th { + background-color: #eee; + text-align: center; +} + +#main table caption { + caption-side: top; + font-size: 100%; + font-weight: normal; + padding: 0.3em; +} + +#main .notes { + margin: 3em 0 1em 0; + font-size: 70%; +} + +#main .notes h3 { + margin: 1em 0 0.2em 0; + font-weight: bold; +} + +#main .notes ol { + margin: 0; + padding-left: 0.5em; + list-style: inside decimal; +} + +#main .doc-image { + display: block; + margin: 1em auto; + border: 0; +} + +#main sup a { + text-decoration: none; +} + +#main img { + height: auto; + max-width: 100%; +} + +#main .section-head { + border-bottom: 1px solid gray; +} + +#main .directive-head { + margin: 2em 0 1em 0; + border-bottom: 1px solid #999; +} + +#main .directive-head h3 { + margin: 0; + font-size: 120%; +} + +#main .directive-head h3 a { + color: black; + text-decoration: none; +} + +#main .directive-since { + margin: 0; + font-size: 80%; + float: right; +} + +#main .directive-desc dt { + margin: 0.5em 0 0.3em 0; +} + +#main .directive-desc dd { + margin: 0.5em 0 1em 0; +} + +#main .directive-desc dd :first-child { + margin-top: 0.3em; +} + +#main .mruby-method-head { + margin: 2em 0 1em 0; + border-bottom: 1px solid #999; +} + +#main .mruby-method-head h3 { + margin: 0; + font-size: 120%; +} + +#main .mruby-method-head h3 a { + color: black; + text-decoration: none; +} + +#main .mruby-method-since { + margin: 0; + font-size: 80%; + float: right; +} + +#main .mruby-method-desc dt { + margin: 0.5em 0 0.3em 0; +} + +#main .mruby-method-desc dd { + margin: 0.5em 0 1em 0; +} + +#main .mruby-method-desc dd :first-child { + margin-top: 0.3em; +} + +#main .mruby-method-parameters { + margin-left: 1.5em; +} + +@media screen and (max-width: 800px) { + #main h2, + #main h3, + #main h4, + #main div, + #main p, + #main dt, + #main ul, + #main pre, + #main table, + #main .notes, + #main .directive-head, + #main .directive-desc { + margin-left: 25px; + margin-right: 25px + } + #main .mruby-method-head, + #main .mruby-method-desc { + margin-left: 25px; + margin-right: 25px + } + + #main * div, + #main * p, + #main * table, + #main * ul, + #main * pre { + margin-left: 0; + margin-right: 0; + } +} + +#footer { + border-width: 0 1px 1px 1px; + border-style: solid; + border-color: #aaa; + padding: 1em 50px 1em 50px; + text-align: center; +} + +@media screen and (max-width: 800px) { + #footer { + border-right: none; + border-left: none; + } +} diff --git a/web/server/h2o/libh2o/doc/benchmarks.html b/web/server/h2o/libh2o/doc/benchmarks.html new file mode 100644 index 000000000..2b90b80de --- /dev/null +++ b/web/server/h2o/libh2o/doc/benchmarks.html @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + +Benchmarks - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Benchmarks +

+ + +

Download Timings

+ +
+

+Providing quick response to user is more important than anything else in web performance tuning. +According to a research conducted by Microsoft, 500msec slowdown in Bing causes their revenue go down by 1.2%1. +

+

+The chart below compares the first-paint times and download completion times of different web browsers / HTTP servers on a simulated network of 8Mbps bandwidth with 100ms latency, which is typical for today's mobile networks2. +

+
+ +
+

+It is clear in the case of this benchmark that the visitors of the web site would be more satisfied, if H2O was used as the HTTP server. +

+
+ +

Static-File Serving

+ +
+

+Below chart shows the scores recorded on Amazon EC2 running two c3.8xlarge instances (server and client) on a single network placement, serving a 612-byte file3. +For each measurement, 250 concurrent clients were used4. +open_file_cache was used for Nginx. +H2O implements a open-file-cache that gets updated immediately when the files are replaced. +

+
+ +
+
+ +

Reverse Proxy

+ +
+

+Presented below is an old chart showing the scores recorded on Amazon EC2 running two c3.8xlarge instances (server and client) on a single network placement56. +

+
+ +
+
+ + + +
+

Notes:

+
    +
  1. Velocity and the Bottom Line - O'Reilly Radar
  2. +
  3. A fork of http2rulez.com was used as the target website; bandwidth and latency were induced to local network using qdisc, specifically by running tc qdisc replace dev eth1 root handle 1:0 tbf rate 8192kbit burst 2048 latency 100ms; sudo tc qdisc add dev eth1 parent 1:1 netem delay 100ms, and sysctl -w net.ipv4.tcp_no_metrics_save=1.
  4. +
  5. Configuration files used: nginx.conf, h2o.conf.
  6. +
  7. Wrk was used for HTTP/1 tests. h2load was used for HTTP/2.
  8. +
  9. For reverse-proxy tests, another H2O process running on the same host was used as the upstream server
  10. +
  11. open-file-cache was not used in the static-file benchmark
  12. +
+
+ +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure.html b/web/server/h2o/libh2o/doc/configure.html new file mode 100644 index 000000000..230310b59 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + +Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + + + + + diff --git a/web/server/h2o/libh2o/doc/configure/access_control.html b/web/server/h2o/libh2o/doc/configure/access_control.html new file mode 100644 index 000000000..74f4ced6f --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/access_control.html @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + +Access Control - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Access Control +

+ + +

+Starting from version 2.1, H2O comes with a DSL-like mruby library which makes it easy to write access control list (ACL). +

+ +

Example

+ +

+Below example uses this Access Control feature to write various access control. +

+ +
+
Example. Access Control
+
paths:
+  "/":
+    mruby.handler: |
+      acl {
+        allow { addr == "127.0.0.1" }
+        deny { user_agent.match(/curl/i) && ! addr.start_with?("192.168.") }
+        respond(503, {}, ["Service Unavailable"]) { addr == malicious_ip }
+        redirect("https://example.com/", 301) { path =~ /moved/ }
+        use Htpasswd.new("/path/to/.htpasswd", "realm") { path.start_with?("/admin") }
+      }
+    file.dir: /path/to/doc_root
+
+
+ + +

+In the example, the handler you get by calling acl method will do the following: +

    +
  • + if the remote IP address is exactly equal to "127.0.0.1", the request will be delegated to the next handler (i.e. serve files under /path/to/doc_root) and all following acl settings are ignored +
  • +
  • + otherwise, if the user agent string includes "curl" and the remote IP address doesn't start with "192.168.", this handler immediately returns 403 Forbidden response +
  • +
  • + otherwise, if the remote IP address is exactly equal to the malicious_ip variable, this handler immediately returns 503 Service Unavailable response +
  • +
  • + otherwise, if the request path matches with the pattern /moved/i, this handler immediately redirects the client to "https://example.com" with 301 status code +
  • +
  • + otherwise, if the request path starts with /admin, apply Basic Authentication to the request (for details of Basic Authentication, see here). +
  • +
  • + otherwise, the request will be delegated to the next handler (i.e. serve files under /path/to/doc_root) +
  • + +
+ +

ACL Methods

+ +

+An ACL handler is built by calling ACL methods, which can be used like directives. +ACL methods can only be used in acl block. +

+ +

+Each ACL method adds a filter to the handler, which checks whether the request matches the provided condition or not. +Every ACL method can be accompanied by a condition block, which should return boolean value. +

+ +

+The filter defined by the method that first matched the accompanying condition gets applied (e.g. response 403 Forbidden, redirect to somewhere). +If a condition block is omitted, all requests matches. +If none of the conditions matches the request, the handler returns 399 and the request will be delegated to the next handler. +

+ + + +
+
Description:
+
+

+ Adds a filter which delegates the request to the next handler if the request matches the provided condition. +

+ +
allow { ..condition.. }
+ +
+
+ +
+

"deny"

+
+ +
+
Description:
+
+

+ Adds a filter which returns 403 Forbidden if the request matches the provided condition. +

+ +
deny { ..condition.. }
+ +
+
+ + + +
+
Description:
+
+

+ Adds a filter which redirects the client if the request matches the provided condition. +

+ +
redirect(location, status) { ..condition.. }
+ +
+
Parameters:
+
+
+
location
+
Location to which the client will be redirected. Required.
+
status
+
Status code of the response. Default value: 302
+
+
+
+ + + +
+
Description:
+
+

+ Adds a filter which returns arbitrary response if the request matches the provided condition. +

+ +
respond(status, header, body) { ..condition.. }
+ +
+
Parameters:
+
+
+
status
+
Status code of the response. Required.
+
header
+
Header key-value pairs of the response. Default value: {}
+
body
+
Body array of the response. Default value: []
+
+
+
+ +
+

"use"

+
+ +
+
Description:
+
+

+ Adds a filter which applies the provided handler (callable object) if the request matches the provided condition. +

+ +
use(proc) { ..condition.. }
+ +
+
Parameters:
+
+
+
proc
+
Callable object that should be applied
+
+
+
+ +

Matching Methods

+ +

+In a condition block, you can use helpful methods which return particular properties of the request as string values. +Matching methods can only be used in a condition block of the ACL methods. +

+ +
+

"addr"

+
+ +
+
Description:
+
+

+ Returns the remote IP address of the request. +

+ +
addr(forwarded)
+ +
+
Parameters:
+
+
+
forwarded
+
If true, returns the value of X-Forwarded-For header if it exists. Default value: true
+
+
+
+ +
+

"path"

+
+ +
+
Description:
+
+

+ Returns the requested path string of the request. +

+ +
path()
+ +
+
+ + + +
+
Description:
+
+

+ Returns the HTTP method of the request. +

+ +
method()
+ +
+
+ + + +
+
Description:
+
+

+ Returns the header value of the request associated with the provided name. +

+ +
header(name)
+ +
+
Parameters:
+
+
+
name
+
Case-insensitive header name. Required.
+
+
+
+ + + +
+
Description:
+
+

+ Shortcut for header("user-agent"). +

+ +
user_agent()
+ +
+
+ +

Caution

+ +

+Several restrictions are introduced to avoid misconfiguration when using acl method. +

    +
  • acl method can be called only once in each handler configuration
  • +
  • If acl method is used, the handler returned by the configuration directive must be the one returned by the acl method
  • +
+If a configuration violates these restrictions, the server will detect it and refuse to launch with error message. +

+ +

+For example, both of the following examples violate the restrictions above, so the server will refuse to start up. +

+ +
+
Example. Misconfiguration Example 1
+
paths:
+  "/":
+    mruby.handler: |
+      acl {    # this block will be ignored!
+        allow { addr == "127.0.0.1" }
+      }
+      acl {
+        deny
+      }
+    file.dir: /path/to/doc_root
+
+
+ + +
+
Example. Misconfiguration Example 2
+
paths:
+  "/":
+    mruby.handler: |
+      acl {    # this block will be ignored!
+        allow { addr == "127.0.0.1" }
+        deny
+      }
+      proc {|env| [399, {}, []}
+    file.dir: /path/to/doc_root
+
+
+ + +

+You can correct these like the following: +

+ +
+
Example. Valid Configuration Example
+
paths:
+  "/":
+    mruby.handler: |
+      acl {
+        allow { addr == "127.0.0.1" }
+        deny
+      }
+    file.dir: /path/to/doc_root
+
+
+ + +

How-To

+ +

Matching IP Address Blocks

+ +

+You can match an IP address against predefined list of address blocks using a script named trie_addr.rb. +

+

+Below is an example. +

+ +
+
Example. Address Block Matching Example
+
paths:
+  "/":
+    mruby.handler: |
+      require "trie_addr.rb"
+      trie = TrieAddr.new.add(["192.168.0.0/16", "172.16.0.0/12"])
+      acl {
+        allow { trie.match?(addr) }
+        deny
+      }
+    file.dir: /path/to/doc_root
+
+
+ + +

+This library currently supports only IPv4 addresses. TrieAddr#match? returns false when it receives an invalid IPv4 address (including an IPv6 address) as an argument.. +

+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/access_log_directives.html b/web/server/h2o/libh2o/doc/configure/access_log_directives.html new file mode 100644 index 000000000..c6096049a --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/access_log_directives.html @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + +Access Log Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Access Log Directives +

+ + +

+This document describes the configuration directives of the access_log handler. +

+ + + +
+
Description:
+
+

+The directive sets the path and optionally the format of the access log. +

+ +

+If the supplied argument is a scalar, it is treated as the path of the log file, or if the value starts with a |, it is treated as a command to which the log should be emitted. +

+
+
Example. Emit access log to file
+
access-log: /path/to/access-log-file
+
+
+ +
+
Example. Emit access log through pipe
+
access-log: "| rotatelogs /path/to/access-log-file.%Y%m%d 86400"
+
+
+ + +

+If the supplied argument is a mapping, its path property is considered as the path of the log file or the pipe command, and the format property is treated as the format of the log file. +Starting from version 2.2, escape property can be used to specify the escape sequence that should be used to emit unsafe octets. +

+ +

+Two forms of escape sequences are supported. +If apache is specified as the value of the escape property, unsafe octets are emitted in the form of \xNN, where N is a hexadecimal number in lower case. +If json is specified, unsafe octets are emitted in the form of \u00NN. +apache is the default escape method. +

+ +
+
Example. Emit access log to file using Common Log Format
+
access-log:
+    path: /path/to/access-log-file
+    format: "%h %l %u %t \"%r\" %s %b"
+    escape: apache
+
+
+ + +

+The list of format strings recognized by H2O is as follows. +

+ + +
Format StringDescription +
%%the percent sign +
%Alocal address (e.g. 4.5.6.7) +
%bsize of the response body in bytes +
%Hrequest protocol as sent by the client (e.g. HTTP/1.1) +
%hremote address (e.g. 1.2.3.4) +
%lremote logname (always -) +
%mrequest method (e.g. GET, POST) +
%plocal port (%{local}p is a synonym that is supported since version 2.2) +
%{remote}premote port (since version 2.2) +
%qquery string (? is prepended if exists, otherwise an empty string) +
%rrequest line (e.g. GET / HTTP/1.1) +
%sstatus code sent to client (e.g. 200) +
%<sstatus code received from upstream (or initially generated) +
%ttime when the request was received in format: [02/Jan/2006:15:04:05 -0700] +
%{FORMAT}ttime when the request was received using the specified format. FORMAT should be an argument to strftime, or one of: + +
secnumber of seconds since Epoch +
msecnumber of milliseconds since Epoch +
usecnumber of microseconds since Epoch +
msec_fracmillisecond fraction +
usec_fracmicrosecond fraction +
+As an example, it is possible to log timestamps in millisecond resolution using %{%Y/%m/%d:%H:%M:%S}t.%{msec_frac}t, which results in a timestamp like 2006-01-02:15:04:05.000. +
%Urequested URL path, not including the query string +
%uremote user if the request was authenticated (always -) +
%Vrequested server name (or the default server name if not specified by the client) +
%vcanonical server name +
%{VARNAME}erequest environment variable (since version 2.3; see Logging Arbitrary Variable) +
%{HEADERNAME}ivalue of the given request header (e.g. %{user-agent}i) +
%{HEADERNAME}ovalue of the given response header sent to client (e.g. %{set-cookie}o) +
%<{HEADERNAME}ovalue of the response header received from upstream (or initially generated) +
%{NAME}xvarious extensions. NAME must be one listed in the following tables. A dash (-) is emitted if the directive is not applicable to the request being logged. + + +
Access Timings
NameDescription +
connect-timetime spent to establish the connection (i.e. since connection gets accept(2)-ed until first octet of the request is received) +
request-header-timetime spent receiving request headers +
request-body-timetime spent receiving request body +
request-total-timesum of request-header-time and request-body-time +
process-timetime spent after receiving request, before starting to send response +
response-timetime spent sending response +
durationsum of request-total-time, process-time, response-time +
+ + +
Connection (since v2.0)
NameDescription +
connection-id64-bit internal ID assigned to every client connection +
ssl.protocol-versionSSL protocol version obtained from SSL_get_version +
ssl.session-reused1 if the SSL session was reused, or 0 if not1 +
ssl.session-idbase64-encoded value of the session id used for resuming the session (since v2.2) +
ssl.ciphername of the cipher suite being used, obtained from SSL_CIPHER_get_name +
ssl.cipher-bitsstrength of the cipher suite in bits +
+ + +
HTTP/2 (since v2.0)
NameDescription +
http2.stream-idstream ID +
http2.priority.receivedcolon-concatenated values of exclusive, parent, weight +
http2.priority.received.exclusiveexclusive bit of the most recent priority specified by the client +
http2.priority.received.parentparent stream ID of the most recent priority specified by the client +
http2.priority.received.weightweight of the most recent priority specified by the client +
+ + +
Miscellaneous
NameDescription +
errorrequest-level errors. Unless specified otherwise by using the error-log.emit-request-errors directive, the same messages are emitted to the error-log. (since v2.1) +
+
+ +

+The default format is %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i", a.k.a. the NCSA extended/combined log format. +

+

+Note that you may need to quote (and escape) the format string as required by YAML (see Yaml Cookbook). +

+ +
+
Level:
+
global, host, path, extension
+
See also:
+
error-log +error-log.emit-request-errors +
+
+ + + +
+

Notes:

+
    +
  1. A single SSL connection may transfer more than one HTTP request.
  2. +
+
+ +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/base_directives.html b/web/server/h2o/libh2o/doc/configure/base_directives.html new file mode 100644 index 000000000..38f8ea021 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/base_directives.html @@ -0,0 +1,975 @@ + + + + + + + + + + + + + + + + +Base Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Base Directives +

+ + +

+This document describes the configuration directives common to all the protocols and handlers. +

+ + + +
+
Description:
+
+

+Maps host:port to the mappings of per-host configs. +

+ +

+The directive specifies the mapping between the authorities (the host or host:port section of an URL) and their configurations. +The directive is mandatory, and must at least contain one entry. +

+

+When port is omitted, the entry will match the requests targetting the default ports (i.e. port 80 for HTTP, port 443 for HTTPS) with given hostname. +Otherwise, the entry will match the requests targetting the specified port. +

+

+Since version 1.7, a wildcard character * can be used as the first component of the hostname. +If used, they are matched using the rule defined in RFC 2818 Section 3.1. +For example, *.example.com will match HTTP requests for both foo.example.com and bar.example.com. +Note that an exact match is preferred over host definitions using wildcard characters. +

+ + +
+
Example. A host redirecting all HTTP requests to HTTPS
+
hosts:
+  "www.example.com:80":
+    listen:
+      port: 80
+    paths:
+      "/":
+        redirect: https://www.example.com/
+  "www.example.com:443":
+    listen:
+      port: 443
+      ssl:
+        key-file: /path/to/ssl-key-file
+        certificate-file: /path/to/ssl-certificate-file
+    paths:
+      "/":
+        file.dir: /path/to/doc-root
+
+
+ + +
+
Level:
+
global
+
+ + + +
+
Description:
+
+

+Mapping of paths and their configurations. +

+ +

+

+The mapping is searched using prefix-match. +The entry with the longest path is chosen when more than one matching paths were found. +An 404 Not Found error is returned if no matching paths were found. +

+
+
Example. Configuration with two paths
+
hosts:
+  "www.example.com":
+    listen:
+      port: 80
+    paths:
+      "/":
+        file.dir: /path/to/doc-root
+      "/assets":
+        file.dir: /path/to/assets
+
+
+ +

+In releases prior to version 2.0, all the path entries are considered as directories. +When H2O receives a request that exactly matches to an entry in paths that does not end with a slash, the server always returns a 301 redirect that appends a slash. +

+

+Since 2.0, it depends on the handler of the path whether if a 301 redirect that appends a slash is returned. +Server administrators can take advantage of this change to define per-path configurations (see the examples in file.file and the FastCGI handler). +file.dir is an exception that continues to perform the redirection; in case of the example above, access to /assets is redirected to /assets/. +

+ +
+
Level:
+
host
+
+ + + +
+
Description:
+
+

+Specifies the port at which the server should listen to. +

+ +

+

+In addition to specifying the port number, it is also possible to designate the bind address or the SSL configuration. +

+
+
Example. Various ways of using the Listen Directive
+
# accept HTTP on port 80 on default address (both IPv4 and IPv6)
+listen: 80
+
+# accept HTTP on 127.0.0.1:8080
+listen:
+  host: 127.0.0.1
+  port: 8080
+
+# accept HTTPS on port 443
+listen:
+  port: 443
+  ssl:
+    key-file: /path/to/key-file
+    certificate-file: /path/to/certificate-file
+
+# accept HTTPS on port 443 (using PROXY protocol)
+listen:
+  port: 443
+  ssl:
+    key-file: /path/to/key-file
+    certificate-file: /path/to/certificate-file
+  proxy-protocol: ON
+
+
+ +

Configuration Levels

+

+The directive can be used either at global-level or at host-level. +At least one listen directive must exist at the global level, or every host-level configuration must have at least one listen directive. +

+

+Incoming connections accepted by global-level listeners will be dispatched to one of the host-level contexts with the corresponding host:port, or to the first host-level context if none of the contexts were given host:port corresponding to the request. +

+

+Host-level listeners specify bind addresses specific to the host-level context. +However it is permitted to specify the same bind address for more than one host-level contexts, in which case hostname-based lookup will be performed between the host contexts that share the address. +The feature is useful for setting up a HTTPS virtual host using Server-Name Indication (RFC 6066). +

+
+
Example. Using host-level listeners for HTTPS virtual-hosting
+
hosts:
+  "www.example.com:443":
+    listen:
+      port: 443
+      ssl:
+        key-file: /path/to/www_example_com.key
+        certificate-file: /path/to/www_example_com.crt
+    paths:
+      "/":
+        file.dir: /path/to/doc-root_of_www_example_com
+  "www.example.jp:443":
+    listen:
+      port: 443
+      ssl:
+        key-file: /path/to/www_example_jp.key
+        certificate-file: /path/to/www_example_jp.crt
+    paths:
+      "/":
+        file.dir: /path/to/doc-root_of_www_example_jp
+
+
+ +

SSL Attribute

+

+The ssl attribute must be defined as a mapping, and recognizes the following attributes. +

+
+
certificate-file:
+
path of the SSL certificate file (mandatory)
+
key-file:
+
path of the SSL private key file (mandatory)
+
minimum-version:
+
+minimum protocol version, should be one of: SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2. +Default is TLSv1 +
+
min-verison:
+
+synonym of minimum-version (introduced in version 2.2) +
+
maximum-version:
+
+maximum protocol version. +Introduced in version 2.2. +Default is the maximum protocol version supported by the server. +
+
max-version:
+
+synonym of maximum-version. +
+
cipher-suite:
+
list of cipher suites to be passed to OpenSSL via SSL_CTX_set_cipher_list (optional)
+
cipher-preference:
+
+side of the list that should be used for selecting the cipher-suite; should be either of: client, server. +Default is client. +
+
dh-file:
+
+path of a PEM file containing the Diffie-Hellman parameters to be used. +Use of the file is recommended for servers using Diffie-Hellman key agreement. +(optional) +
+
ocsp-update-interval:
+
+interval for updating the OCSP stapling data (in seconds), or set to zero to disable OCSP stapling. +Default is 14400 (4 hours). +
+
ocsp-max-failures:
+
+number of consecutive OCSP query failures before stopping to send OCSP stapling data to the client. +Default is 3. +
+
neverbleed:
+
+unless set to OFF, H2O isolates RSA private key operations to an isolated process by using Neverbleed. +Default is ON. +
+

+ssl-session-resumption directive is provided for tuning parameters related to session resumption and session tickets. +

+

The Proxy-Protocol Attribute

+

+The proxy-protocol attribute (i.e. the value of the attribute must be either ON or OFF) specifies if the server should recognize the information passed via "the PROXY protocol in the incoming connections. +The protocol is used by L4 gateways such as AWS Elastic Load Balancing to send peer address to the servers behind the gateways. +

+

+When set to ON, H2O standalone server tries to parse the first octets of the incoming connections as defined in version 1 of the specification, and if successful, passes the addresses obtained from the protocol to the web applications and the logging handlers. +If the first octets do not accord with the specification, it is considered as the start of the SSL handshake or as the beginning of an HTTP request depending on whether if the ssl attribute has been used. +

+

+Default is OFF. +

+

Listening to a Unix Socket

+

+If the type attribute is set to unix, then the port attribute is assumed to specify the path of the unix socket to which the standalone server should bound. +Also following attributes are recognized. +

+
+
owner
+
+username of the owner of the socket file. +If omitted, the socket file will be owned by the launching user. +
+
permission
+
+an octal number specifying the permission of the socket file. +Many operating systems require write permission for connecting to the socket file. +If omitted, the permission of the socket file will reflect the umask of the calling process. +
+
+
+
Example. Listening to a Unix Socket accessible only by www-data
+
listen:
+  type:       unix
+  port:       /tmp/h2o.sock
+  owner:      www-data
+  permission: 600
+
+
+ + +
+
Level:
+
global, host
+
+ + + +
+
Description:
+
+

+Path of the file to which error logs should be appended. +

+ +

+Default is stderr. +

+

+If the path starts with |, the rest of the path is considered as a command to which the logs should be piped. +

+
+
Example. Log errors to file
+
error-log: /path/to/error-log-file
+
+
+ +
+
Example. Log errors through pipe
+
error-log: "| rotatelogs /path/to/error-log-file.%Y%m%d 86400"
+
+
+ + +
+
Level:
+
global
+
See also:
+
error-log.emit-request-errors +
+
+ + + +
+
Description:
+
+

+Sets whether if request-level errors should be emitted to the error log. +

+ +By setting the value to OFF and by using the %{error}x specifier of the access-log directive, it is possible to log request-level errors only to the access log. + +
+
Level:
+
global, host, path, extension
+
Default:
+
error-log.emit-request-errors: ON
+
See also:
+
access-log +error-log +
+
+ + + +
+
Description:
+
+

+Maximum time (in seconds) that can be spent by a connection before it becomes ready to accept an HTTP request. +

+ +Times spent for receiving the PROXY protocol and TLS handshake are counted. + +
+
Level:
+
global
+
Default:
+
handshake-timeout: 10
+
+ + + +
+
Description:
+
+

+Maximum size of request body in bytes (e.g. content of POST). +

+ +

+Default is 1073741824 (1GB). +

+ +
+
Level:
+
global
+
+ + + +
+
Description:
+
+

+Number of connections to handle at once at maximum. +

+ +
+
Level:
+
global
+
Default:
+
max-connections: 1024
+
+ + +
+
Description:
+
+

+Limits the number of delegations (i.e. internal redirects using the X-Reproxy-URL header). +

+ +
+
Level:
+
global
+
Default:
+
max-delegations: 5
+
+ + +
+
Description:
+
+

+Maximum number of threads to run for name resolution. +

+ +
+
Level:
+
global
+
Default:
+
num-name-resolution-threads: 32
+
+ + +
+
since v2.0
+

"num-ocsp-updaters"

+
+ +
+
Description:
+
+

+Maximum number of OCSP updaters. +

+ +

+OSCP Stapling is an optimization that speeds up the time spent for establishing a TLS connection. +In order to staple OCSP information, a HTTP server is required to periodically contact the certificate authority. +This directive caps the number of the processes spawn for collecting the information. +

+

+The use and the update interval of OCSP can be configured using the SSL attributes of the listen configuration directive. +

+ +
+
Level:
+
global
+
Default:
+
num-ocsp-updaters: 10
+
+ + + +
+
Description:
+
+

+Number of worker threads. +

+ +

+Default is the number of the processors connected to the system as obtained by getconf NPROCESSORS_ONLN. +

+ +
+
Level:
+
global
+
+ + + +
+
Description:
+
+

+Name of the file to which the process id of the server should be written. +

+ +

+Default is none. +

+ +
+
Level:
+
global
+
+ + + +
+
Description:
+
+

+Size of the queue used for TCP Fast Open. +

+ +

+TCP Fast Open is an extension to the TCP/IP protocol that reduces the time spent for establishing a connection. +On Linux that support the feature, the default value is 4,096. +On other platforms the default value is 0 (disabled). +

+ +
+
Level:
+
global
+
+ +
+
since v2.0
+

"send-server-name"

+
+ +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating whether if the server response header should be sent. +

+ + +
+
Level:
+
global
+
Default:
+
send-server-name: ON
+
See also:
+
server-name +
+
+ +
+
since v2.0
+

"server-name"

+
+ +
+
Description:
+
+

+Lets the user override the value of the server response header. +

+ +The default value is h2o/VERSION-NUMBER. + +
+
Level:
+
global
+
See also:
+
send-server-name +
+
+ +
+
since v2.0
+

"setenv"

+
+ +
+
Description:
+
+

+Sets one or more environment variables. +

+ +

+Environment variables are a set of key-value pairs containing arbitrary strings, that can be read from applications invoked by the standalone server (e.g. fastcgi handler, mruby handler) and the access logger. +

+

+The directive is applied from outer-level to inner-level. +At each level, the directive is applied after the unsetenv directive at the corresponding level is applied. +

+

+Environment variables are retained through internal redirections. +

+
+
Example. Setting an environment variable named FOO
+
setenv:
+  FOO: "value_of_FOO"
+
+
+ + +
+
Level:
+
global, host, path, extension
+
See also:
+
unsetenv +
+
+ +
+
since v2.0
+

"unsetenv"

+
+ +
+
Description:
+
+

+Unsets one or more environment variables. +

+ +

+The directive can be used to have an exception for the paths that have an environment variable set, or can be used to reset variables after an internal redirection. +

+
+
Example. Setting environment variable for example.com excluding /specific-path
+
hosts:
+  example.com:
+    setenv:
+      FOO: "value_of_FOO"
+    paths:
+      /specific-path:
+        unsetenv:
+          - FOO
+      ...
+
+
+ + +
+
Level:
+
global, host, path, extension
+
See also:
+
setenv +
+
+ + + +
+
Description:
+
+

+Configures cache-based and ticket-based session resumption. +

+ +

+To reduce the latency introduced by the TLS (SSL) handshake, two methods to resume a previous encrypted session are defined by the Internet Engineering Task Force. +H2O supports both of the methods: cache-based session resumption (defined in RFC 5246) and ticket-based session resumption (defined in RFC 5077). +

+
+
Example. Various session-resumption configurations
+
# use both methods (storing data on internal memory)
+ssl-session-resumption:
+    mode: all
+
+# use both methods (storing data on memcached running at 192.168.0.4:11211)
+ssl-session-resumption:
+    mode: all
+    cache-store: memcached
+    ticket-store: memcached
+    cache-memcached-num-threads: 8
+    memcached:
+        host: 192.168.0.4
+        port: 11211
+
+# use ticket-based resumption only (with secrets used for encrypting the tickets stored in a file)
+ssl-session-resumption:
+    mode: ticket
+    ticket-store: file
+    ticket-file: /path/to/ticket-secrets.yaml
+
+
+ +

Defining the Methods Used

+

+The mode attribute defines which methods should be used for resuming the TLS sessions. +The value can be either of: off, cache, ticket, all. +Default is all. +

+

+If set to off, session resumption will be disabled, and all TLS connections will be established via full handshakes. +If set to all, both session-based and ticket-based resumptions will be used, with the preference given to the ticket-based resumption for clients supporting both the methods. +

+

+For each method, additional attributes can be used to customize their behaviors. +Attributes that modify the behavior of the disabled method are ignored. +

+

Attributes for Cache-based Resumption

+

+Following attributes are recognized if the cache-based session resumption is enabled. +Note that memcached attribute must be defined as well in case the memcached cache-store is used. +

+
+
cache-store:
+
+

+defines where the cache should be stored, must be one of: internal, memcached. +Default is internal. +

+

+Please note that if you compiled h2o with OpenSSL 1.1.0 ~ 1.1.0f, session resumption with external cache store would fail due to bug of OpenSSL. +

+
+
cache-memcached-num-threads:
+
defines the maximum number of threads used for communicating with the memcached server. +Default is 1. +
+
cache-memcached-prefix:
+
+for the memcached store specifies the key prefix used to store the secrets on memcached. +Default is h2o:ssl-session-cache:. +
+
+

Attributes for Ticket-based Resumption

+

+Ticket-based session resumption uses master secret(s) to encrypt the keys used for encrypting the data transmitted over TLS connections. +To achieve forward-secrecy (i.e. protect past communications from being decrypted in case a master secret gets obtained by a third party), it is essential to periodically change the secret and remove the old ones. +

+

+Among the three types of stores supported for ticket-based session resumption, the internal store and memcached store implement automatic roll-over of the secrets. +A new master secret is created every 1/4 of the session lifetime (defined by the lifetime attribute), and they expire (and gets removed) after 5/4 of the session lifetime elapse. +

+

+For the file store, it is the responsibility of the web-site administrator to periodically update the secrets. H2O monitors the file and reloads the secrets when the file is altered. +

+

+Following attributes are recognized if the ticket-based resumption is enabled. +

+
+
ticket-store:
+
defines where the secrets for ticket-based resumption should be / is stored, must be one of: internal, file, memcached. +Default is internal. +
ticket-cipher:
+
+for stores that implement automatic roll-over, specifies the cipher used for encrypting the tickets. +The value must be one recognizable by EVP_get_cipherbyname. +Default is aes-256-cbc. +
ticket-hash:
+
+for stores that implement automatic roll-over, specifies the cipher used for digitally-signing the tickets. +The value must be one recognizable by EVP_get_digestbyname. +Default is sha-256. +
+
ticket-file:
+
for the file store specifies the file in which the secrets are stored
+
ticket-memcached-key:
+
+for the memcached store specifies the key used to store the secrets on memcached. +Default is h2o:ssl-session-ticket. +
+
+

Other Attributes

+

+Following attributes are common to cache-based and ticket-based session resumption. +

+
+
lifetime:
+
+defines the lifetime of a TLS session; when it expires the session cache entry is purged, and establishing a new connection will require a full TLS handshake. +Default value is 3600 (in seconds). +
+
memcached:
+
+specifies the location of memcached used by the memcached stores. +The value must be a mapping with host attribute specifying the address of the memcached server, and optionally a port attribute specifying the port number (default is 11211). +By default, the memcached client uses the BINARY protocol. +Users can opt-in to using the legacy ASCII protocol by adding a protocol attribute set to ASCII. +
+ +
+
Level:
+
global
+
+ +
+
since v2.0
+

"temp-buffer-path"

+
+ +
+
Description:
+
+

+Directory in which temporary buffer files are created. +

+ +

+H2O uses an internal structure called h2o_buffer_t for buffering various kinds of data (e.g. POST content, response from upstream HTTP or FastCGI server). +When amount of the data allocated in the buffer exceeds 32MB, it starts allocating storage from the directory pointed to by the directive. +

+

+By using the directive, users can set the directory to one within a memory-backed file system (e.g. tmpfs) for speed, or specify a disk-based file system to avoid memory pressure. +

+

+Note that the directory must be writable by the running user of the server. +

+ +
+
Level:
+
global
+
Default:
+
temp-buffer-path: "/tmp"
+
See also:
+
user +
+
+ +
+

"user"

+
+ +
+
Description:
+
+

+Username under which the server should handle incoming requests. +

+ +

+If the directive is omitted and if the server is started under root privileges, the server will attempt to setuid to nobody. +

+ +
+
Level:
+
global
+
+ +
+
since v2.1
+

"crash-handler"

+
+ +
+
Description:
+
+

+Script to invoke if h2o receives a fatal signal. +

+ +

Note: this feature is only available when linking to the GNU libc.

+ +

The script is invoked if one of the SIGABRT, +SIGBUS, SIGFPE, SIGILL or +SIGSEGV signals is received by h2o.

+ +

h2o writes the backtrace as provided by +backtrace() and backtrace_symbols_fd to the +standard input of the program.

+ +

If the path is not absolute, it is prefixed with ${H2O_ROOT}/.

+ +
+
Level:
+
global
+
Default:
+
crash-handler: "${H2O_ROOT}/share/h2o/annotate-backtrace-symbols"
+
+ + + +
+
Description:
+
+

+Whether h2o should wait for the crash handler pipe to close before exiting. +

+ +

When this setting is ON, h2o will wait +for the pipe to the crash handler to be closed before exiting. +This can be useful if you use a custom handler that inspects the dying +process.

+ +
+
Level:
+
global
+
Default:
+
crash-handler.wait-pipe-close: OFF
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/basic_auth.html b/web/server/h2o/libh2o/doc/configure/basic_auth.html new file mode 100644 index 000000000..7c3825c71 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/basic_auth.html @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + +Using Basic Authentication - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Using Basic Authentication +

+ + +

+Starting from version 1.7, H2O comes with a mruby script named htpasswd.rb that implements Basic Authentication. +The script provides a Rack handler that implements Basic Authentication using password files generated by the htpasswd command. +

+ +

+Below example uses the mruby script to restrict access to the path. +If authentication fails, the mruby handler returns a 401 Unauthorized response. +If authentication succeeds, the handler returns a 399 response, and the request is delegated internally to the next handler (i.e. file.dir). +

+ +
+
Example. Configuring HTTP authentication using htpasswd.rb
+
paths:
+  "/":
+    mruby.handler: |
+      require "htpasswd.rb"
+      Htpasswd.new("/path/to/.htpasswd", "realm-name")
+    file.dir: /path/to/doc_root
+
+
+ + +

+In H2O versions prior to 2.0, you should specify "#{$H2O_ROOT}/share/h2o/mruby/htpasswd.rb" as the argument to require, since the directory is not registered as part of $LOAD_PATH. +

+ +For convenience, the mruby script also forbids access to files or directories that start with .ht. + + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/cgi.html b/web/server/h2o/libh2o/doc/configure/cgi.html new file mode 100644 index 000000000..983a674ff --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/cgi.html @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + +Using CGI - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Using CGI +

+ + +

+Starting from version 1.7, H2O comes with a FastCGI-to-CGI gateway (fastcgi-cgi), which can be found under share/h2o directory of the installation path. +The gateway can be used for running CGI scripts through the FastCGI handler. +

+ +

+The example below maps .cgi files to be executed by the gateway. +It is also possible to run CGI scripts under different privileges by specifying the user attribute of the directive. +

+ +
+
Example. Execute .cgi files using FastCGI-to-CGI gateway
+
file.custom-handler:
+  extension: .cgi
+  fastcgi.spawn:
+    command: "exec $H2O_ROOT/share/h2o/fastcgi-cgi"
+
+
+ + +The gateway also provides options to for tuning the behavior. A full list of options can be obtained by running the gateway directly with --help option. + +
+
Example. Output of share/h2o/fastcgi-cgi --help
+
$ share/h2o/fastcgi-cgi --help
+Usage:
+    share/h2o/fastcgi-cgi [options]
+
+Options:
+  --listen=sockfn    path to the UNIX socket.  If specified, the program will
+                     create a UNIX socket at given path replacing the existing
+                     file (should it exist).  If not, file descriptor zero (0)
+                     will be used as the UNIX socket for accepting new
+                     connections.
+  --max-workers=nnn  maximum number of CGI processes (default: unlimited)
+  --pass-authz       if set, preserves HTTP_AUTHORIZATION parameter
+
+
+ + + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/command_options.html b/web/server/h2o/libh2o/doc/configure/command_options.html new file mode 100644 index 000000000..3ece2a707 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/command_options.html @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + +Command Options - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Command Options +

+ + +

+Full list of command options can be viewed by running h2o --help. +Following is the output of --help as of version 1.2.0. +

+ +
Options:
+  -c, --conf FILE    configuration file (default: h2o.conf)
+  -m, --mode <mode>  specifies one of the following mode
+                     - worker: invoked process handles incoming connections
+                               (default)
+                     - daemon: spawns a master process and exits. `error-log`
+                               must be configured when using this mode, as all
+                               the errors are logged to the file instead of
+                               being emitted to STDERR
+                     - master: invoked process becomes a master process (using
+                               the `share/h2o/start_server` command) and spawns
+                               a worker process for handling incoming
+                               connections. Users may send SIGHUP to the master
+                               process to reconfigure or upgrade the server.
+                     - test:   tests the configuration and exits
+  -t, --test         synonym of `--mode=test`
+  -v, --version      prints the version number
+  -h, --help         print this help
+
+ +

+The default path of the configuration file may differ depending on the distribution. +Please run h2o --help to find out the location. +

+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/compress_directives.html b/web/server/h2o/libh2o/doc/configure/compress_directives.html new file mode 100644 index 000000000..04336e11b --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/compress_directives.html @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + +Compress Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Compress Directives +

+ + +

+The compress handler performs on-the-fly compression - it compresses the contents of an HTTP response as it is being sent, if the client indicates itself to be capable of decompressing the response transparently with the use of Accept-Encoding header, and if the response is deemed compressible according to the following rules. +

+

+If x-compress-hint response header does not exist or the value is auto, then whether if the response is considered compressible depends on the is_compressible attribute assigned to the content type (see file.mime.addtypes). +If x-compress-hint response header exists and the value is on, the response is always considered to be compressible. +If the value of the response header is set to off, then the response never gets compressed. +

+ +

+The following are the configuration directives recognized by the handler. +

+ +
+
since v2.0
+

"compress"

+
+ +
+
Description:
+
+

+Enables on-the-fly compression of HTTP response. + +

+ +

+If the argument is ON, both brotli and gzip compression are enabled. +If the argument is OFF, on-the-fly compression is disabled. +If the argument is a sequence, the elements are the list of compression algorithms to be enabled. +If the argument is a mapping, each key specifies the compression algorithm to be enabled, and the values specify the quality of the algorithms. +

+

+When both brotli and gzip are enabled and if the client supports both, H2O is hard-coded to prefer brotli. +

+
+
Example. Enabling on-the-fly compression
+
# enable all algorithms
+compress: ON
+
+# enable by name
+compress: [ gzip, br ]
+
+# enable gzip only
+compress: [ gzip ]
+
+
+ + +
+
Level:
+
global, host, path, extension
+
Default:
+
compress: OFF
+
See also:
+
file.send-compressed, file.mime.addtypes +
+
+ +
+
since v2.0
+

"compress-minimum-size"

+
+ +
+
Description:
+
+

+Defines the minimum size a files needs to have in order for H2O to compress the request. + +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
compress-minimum-size: 100
+
+ + +
+
since v1.5
+

"gzip"

+
+ +
+
Description:
+
+

+Enables on-the-fly compression of HTTP response using gzip. + +

+ +Equivalent to compress: [ gzip ]. + +
+
Level:
+
global, host, path, extension
+
Default:
+
gzip: OFF
+
See also:
+
compress +
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/dos_detection.html b/web/server/h2o/libh2o/doc/configure/dos_detection.html new file mode 100644 index 000000000..e7153afd7 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/dos_detection.html @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + +Using DoS Detection - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Using DoS Detection +

+ + +

+Starting from version 2.1, H2O comes with a mruby script named dos_detector.rb that implements DoS Detection feature. +The script provides a Rack handler that detects HTTP flooding attacks based on the client's IP address. +

+ +

Basic Usage

+ +

+Below example uses the mruby script to detect DoS attacks. +The default detecting strategy is simply counting requests within configured period. +If the count exceeds configured threshold, the handler returns a 403 Forbidden response. +Otherwise, the handler returns a 399 response, and the request is delegated internally to the next handler. +

+ +
+
Example. Configuring DoS Detection
+
paths:
+  "/":
+    mruby.handler: |
+      require "dos_detector.rb"
+      DoSDetector.new({
+        :strategy => DoSDetector::CountingStrategy.new({
+          :period     => 10,  # default
+          :threshold  => 100, # default
+          :ban_period => 300, # default
+        }),
+      })
+    file.dir: /path/to/doc_root
+
+
+ + +

+In the example above, the handler countup the requests within 10 seconds for each IP address, and when the count exceeds 100, +it returns a 403 Forbidden response for the request and marks the client as "Banned" for 300 seconds. While marked as "Banned", the handler returns a 403 Forbidden to all requests from the same IP address. +

+ +

Configuring Details

+ +

+You can pass the following parameters to DoSDetector.new . +

    +
  • :strategy +

    The algorithm to detect DoS attacks. You can write and pass your own strategies if needed. The default strategy is DoSDetector.CountingStrategy which takes the following parameters:

    +
      +
    • :period +

      Time window in seconds to count requests. The default value is 10.

      +
    • +
    • :threshold +

      Threshold count of request. The default value is 100.

      +
    • +
    • :ban_period +

      Duration in seconds in which "Banned" client continues to be restricted. The default value is 300.

      +
    • +
    +
  • +
  • :callback +

    The callback which is called by the handler with detecting result. You can define your own callback to return arbitrary response, set response headers, etc. The default callback returns 403 Forbidden if DoS detected, otherwise delegate the request to the next handler.

    +
  • +
  • :forwarded +

    + If set true, the handler uses X-HTTP-Forwarded-For header to get client's IP address if the header exists. The default value is true. +

    +
  • +
  • :cache_size +

    + The capacity of the LRU cache which preserves client's IP address and associated request count. The default value is 128. +

    +
  • +
+
+
Example. Configuring Details
+
paths:
+  "/":
+    mruby.handler: |
+      require "dos_detector.rb"
+      DoSDetector.new({
+        :strategy => DoSDetector::CountingStrategy.new,
+        :forwarded => false,
+        :cache_size => 2048,
+        :callback => proc {|env, detected, ip|
+          if detected && ! ip.start_with?("192.168.")
+            [503, {}, ["Service Unavailable"]]
+          else
+            [399, {}, []]
+          end
+        }
+      })
+    file.dir: /path/to/doc_root
+
+
+ +

+ +

Points to Notice

+
    +
  • + For now, counting requests is "per-thread" and not shared between multiple threads. +
  • +
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/errordoc_directives.html b/web/server/h2o/libh2o/doc/configure/errordoc_directives.html new file mode 100644 index 000000000..77e635f8f --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/errordoc_directives.html @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + +Errordoc Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Errordoc Directives +

+ + +

+This document describes the configuration directives of the errordoc handler. +

+ + + +
+
Description:
+
+

+Specifies the content to be sent when returning an error response (i.e. a response with 4xx or 5xx status code). + +

+ +

+The argument must be a mapping containing following attributes, or if it is a sequence, every element must be a mapping with the following attributes. +

    +
  • status - three-digit number indicating the status code (or sequence of that from version 2.3) +
  • url - URL of the document to be served +
+

+

+URL can either be absolute or relative. +Only content-type, content-language, set-cookie headers obtained from the specified URL are served to the client. +

+

+

+
Example. Set error document for 404 status
+
error-doc:
+  status: 404
+  url: /404.html
+
+
+ +
+
Example. Set error document for 500 and 503 status
+
error-doc:
+  - status: 500
+    url: /internal-error.html
+  - status: 503
+    url: /service-unavailable.html
+
+
+ +
+
Example. Set error document for 50x statuses (From version 2.3)
+
error-doc:
+  status: [500, 502, 503, 504]
+  url: /50x.html
+
+
+ +

+ +
+
Level:
+
global, host, path, extension
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/expires_directives.html b/web/server/h2o/libh2o/doc/configure/expires_directives.html new file mode 100644 index 000000000..7ca6ad677 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/expires_directives.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + +Expires Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Expires Directives +

+ + +

+This document describes the configuration directives of the expires handler. +

+ + + +
+
Description:
+
+

+An optional directive for setting the Cache-Control: max-age= header. + +

+ +
    +
  • if the argument is OFF the feature is not used +
  • if the value is NUMBER UNIT then the header is set +
  • the units recognized are: second, minute, hour, day, month, year +
  • the units can also be in plural forms +
+
+
Example. Set Cache-Control: max-age=86400
+
expires: 1 day
+
+
+ +

+You can also find an example that conditionally sets the header depending on the aspects of a request in Modifying the Response section of the Mruby directives documentation. +

+ +
+
Level:
+
global, host, path, extension
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/fastcgi_directives.html b/web/server/h2o/libh2o/doc/configure/fastcgi_directives.html new file mode 100644 index 000000000..a2e895ace --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/fastcgi_directives.html @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + +FastCGI Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +FastCGI Directives +

+ + +

+This document describes the configuration directives of the FastCGI handler. +

+

+The configuration directives of the FastCGI handler can be categorized into two groups. +Fastcgi.connect and fastcgi.spawn define the address (or the process) to which the requests should be sent. +Other directives customize how the connections to the FastCGI processes should be maintained. +

+ + + +
+
Description:
+
+

+The directive specifies the address at where the FastCGI daemon is running. +

+ +

+If the argument is a mapping, following properties are recognized. +

+
host +
name (or IP address) of the server running the FastCGI daemon (ignored if type is unix) +
port +
TCP port number or path to the unix socket +
type +
either tcp (default) or unix +
+

+

+If the argument is a scalar, the value is considered as a TCP port number and the host is assumed to be 127.0.0.1. +

+
+
Example. Map /app to FastCGI daemon listening to /tmp/fcgi.sock
+
hosts:
+    "example.com:80":
+        paths:
+            "/app":
+                fastcgi.connect:
+                    port: /tmp/fcgi.sock
+                    type: unix
+
+
+ + +
+
Level:
+
path, extension
+
+ + + +
+
Description:
+
+

+The directive specifies the command to start the FastCGI process manager. +

+ +

+In contrast to fastcgi.connect that connects to a FastCGI server running externally, this directive launches a FastCGI process manager under the control of H2O, and terminates it when H2O quits. +The argument is a /bin/sh -c expression to be executed when H2O boots up. +The HTTP server records the process id of the expression, and sends SIGTERM to the id when it exits. +

+
+
Example. Map .php files to 10 worker processes of /usr/local/bin/php-cgi
+
file.custom-handler:
+    extension:     .php
+    fastcgi.spawn: "PHP_FCGI_CHILDREN=10 exec /usr/local/bin/php-cgi"
+
+
+ +

+As of version 1.4.0, the spawned process is run under the privileges of user specified by the user directive (in version 1.3.x, the FastCGI process was spawned under the privileges that spawned the H2O standalone server). +It is possible to specify a different user for running the FastCGI process, by providing a mapping that contains an attribute named user together with an attribute named command. +

+
+
Example. Running FastCGI processes under user fastcgi
+
file.custom-handler:
+    extension:     .php
+    fastcgi.spawn:
+        command: "PHP_FCGI_CHILDREN=10 exec /usr/local/bin/php-cgi"
+        user:    fastcgi
+
+
+ + +
+
Level:
+
path, extension
+
+ + + +
+
Description:
+
+

+Sets the I/O timeout of connections to the FastCGI process in milliseconds. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
fastcgi.timeout.io: 30000
+
+ + + + +
+
Description:
+
+

+Sets the keepl-alive timeout for idle connections in milliseconds. +

+ +

+FastCGI connections will not be persistent if the value is set to zero (default). +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
fastcgi.timeout.keepalive: 0
+
+ + + +
+
Description:
+
+

+Send the modified HTTP_HOST and REQUEST_URI being rewritten in case of internal redirect. +

+ +

+In H2O, it is possible to perform internal redirects (a.k.a. delegations or URL rewrites) using the redirect directive or by returning X-Reproxy-URL headers from web applications. +The directive specifies whether to send the original values to the FastCGI process (default), or if the rewritten values should be sent. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
fastcgi.send-delegated-uri: OFF
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/file_directives.html b/web/server/h2o/libh2o/doc/configure/file_directives.html new file mode 100644 index 000000000..a5ec2c683 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/file_directives.html @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + +File Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +File Directives +

+ + +

+This document describes the configuration directives of the file handler - a handler that for serving static files. +

+

+Two directives: file.dir and file.file are used to define the mapping. +Other directives modify the behavior of the mappings defined by the two. +

+ + + +
+
Description:
+
+

+The directive maps extensions to a custom handler (e.g. FastCGI). +

+ +

+The directive accepts a mapping containing configuration directives that can be used at the extension level, together with a property named extension specifying a extension (starting with .) or a sequence of extensions to which the directives should be applied. +Only one handler must exist within the directives. +

+
+
Example. Mapping PHP files to FastCGI
+
file.custom-handler:
+  extension: .php
+  fastcgi.connect:
+    port: /tmp/fcgi.sock
+    type: unix
+
+
+
+ + +
+
Level:
+
global, host, path
+
+ + + +
+
Description:
+
+

+The directive specifies the directory under which should be served for the corresponding path. +

+ +
+
Example. Serving files under different paths
+
paths:
+    "/":
+        file.dir: /path/to/doc-root
+    "/icons":
+        file.dir: /path/to/icons-dir
+
+
+ + +
+
Level:
+
path
+
See also:
+
file.dirlisting, +file.file, +file.index +
+
+ + + +
+
Description:
+
+

+A boolean flag (OFF, or ON) specifying whether or not to send the directory listing in case none of the index files exist. + +

+ +
+
Level:
+
global, host, path
+
Default:
+
file.dirlisting: OFF
+
See also:
+
file.dir +
+
+ + +
+
Description:
+
+

+A boolean flag (OFF, or ON) specifying whether or not to send etags. + +

+ +
+
Level:
+
global, host, path
+
Default:
+
file.etag: ON
+
+ + +
+
since v2.0
+

"file.file"

+
+ +
+
Description:
+
+

+The directive maps a path to a specific file. +

+ +
+
Example. Mapping a path to a specific file
+
paths:
+  /robots.txt:
+    file.file: /path/to/robots.txt
+
+
+ + +
+
Level:
+
path
+
See also:
+
file.dir +
+
+ + + +
+
Description:
+
+

+Specifies the names of the files that should be served when the client sends a request against the directory. +

+ +

+The sequence of filenames are searched from left to right, and the first file that existed is sent to the client. +

+ +
+
Level:
+
global, host, path
+
Default:
+
file.index: [ 'index.html', 'index.htm', 'index.txt' ]
+
See also:
+
file.dir +
+
+ + + +
+
Description:
+
+

+The directive modifies the MIME mappings by adding the specified MIME type mappings. +

+ +
+
Example. Adding MIME mappings
+
file.mime.addtypes:
+    "application/javascript": ".js"
+    "image/jpeg": [ ".jpg", ".jpeg" ]
+
+
+ +

+The default mappings is hard-coded in lib/handler/mimemap/defaults.c.h. +

+

+It is also possible to set certain attributes for a MIME type. +The example below maps .css files to text/css type, setting is_compressible flag to ON and priority to highest. +

+ +
+
Example. Setting MIME attributes
+
file.mime.settypes:
+    "text/css":
+         extensions: [".css"]
+         is_compressible: yes
+         priority: highest
+
+
+ + +

+Following attributes are recognized. +

+ + +
AttributePossible ValuesDescription +
is_compressibleON, OFFif content is compressible +
priorityhighest, normalsend priority of the content +
+ +

+The priority attribute affects how the HTTP/2 protocol implementation handles the request. +For detail, please refer to the HTTP/2 directives listed in the see also section below. +By default, mime-types for CSS and JavaScript files are the only ones that are given highest priority. +

+ + +
+
Level:
+
global, host, path
+
See also:
+
compress, +http2-casper, +http2-reprioritize-blocking-assets +
+
+ + + +
+
Description:
+
+

+Removes the MIME mappings for specified extensions supplied as a sequence of extensions. +

+ +
+
Example. Removing MIME mappings
+
file.mime.removetypes: [ ".jpg", ".jpeg" ]
+
+
+ + +
+
Level:
+
global, host, path
+
+ + + +
+
Description:
+
+

+Sets the default MIME-type that is used when an extension does not exist in the MIME mappings +

+ +
+
Level:
+
global, host, path
+
Default:
+
file.mime.setdefaulttype: "application/octet-stream"
+
+ + + + +
+
Description:
+
+

+Resets the MIME mappings to given mapping. +

+ +
+
Example. Resetting the MIME mappings to minimum
+
file.mime.settypes:
+    "text/html":  [ ".html", ".htm" ]
+    "text/plain": ".txt"
+
+
+ + +
+
Level:
+
global, host, path
+
+ +
+
since v2.0
+

"file.send-compressed"

+
+ +
+
Description:
+
+

+A flag indicating how a pre-compressed file should be served. + +

+ +

+If set to ON, the handler looks for a file with .br or .gz appended and sends the file, if the client is capable of transparently decoding a brotli or gzip-encoded response. +For example, if a client requests a file named index.html with Accept-Encoding: gzip header and if index.html.gz exists, the .gz file is sent as a response together with a Content-Encoding: gzip response header. +

+

+If set to OFF, the handler always serves the file specified by the client. +

+

+Starting from version 2.2, gunzip is also supported. +If set, the handler acts identical to when the value was set to ON. +In addition, the handler will send an uncompressed response by dynamically decompressing the .gz file if the client and the server failed to agree on using a pre-compressed file as the response and if a non-compressed file was not found. +The option is useful when conserving disk space is important; it is possible to remove the uncompressed files in place for gzipped ones. +

+ +
+
Level:
+
global, host, path
+
Default:
+
file.send-compressed: OFF
+
See also:
+
compress +
+
+ + + +
+
Description:
+
+

+Obsoleted in 2.0. +Synonym of file.send-compressed. + +

+ +
+
Level:
+
global, host, path
+
+ + + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/headers_directives.html b/web/server/h2o/libh2o/doc/configure/headers_directives.html new file mode 100644 index 000000000..078331048 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/headers_directives.html @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + +Headers Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Headers Directives +

+ + +

+This document describes the configuration directives of the headers handler. +

+ + + +
+
Description:
+
+

+Adds a new header line to the response headers, regardless if a header with the same name already exists. +

+ +
+
Example. Setting the Set-Cookie header
+
header.add: "Set-Cookie: test=1"
+
+ +
+
Level:
+
global, host, path, extension
+
+ + + +
+
Description:
+
+

+Adds a new header line, or appends the value to the existing header with the same name, separated by ,. + +

+ +
+
Level:
+
global, host, path, extension
+
+ + + + +
+
Description:
+
+

+Adds a new header line, or merges the value to the existing header of comma-separated values. + +

+ +

+The following example sets the must-revalidate attribute of the Cache-Control header when and only when the attribute is not yet being set. +

+
+
Example. Setting the must-revalidate attribute
+
header.merge: "Cache-Control: must-revalidate"
+
+
+ + +
+
Level:
+
global, host, path, extension
+
+ + + +
+
Description:
+
+

+Sets a header line, removing headers with the same name if exists. +

+ +
+
Example. Setting the X-Content-Type-Options: nosniff header
+
header.set: "X-Content-Type-Options: nosniff"
+
+
+ + +
+
Level:
+
global, host, path, extension
+
+ + + +
+
Description:
+
+

+Sets a header line when and only when a header with the same name does not already exist. + +

+ +
+
Level:
+
global, host, path, extension
+
+ + +
+
Description:
+
+

+Removes headers with given name. +

+ +
+
Example. Removing the X-Powered-By header
+
header.unset: "X-Powered-By"
+
+
+ + +
+
Level:
+
global, host, path, extension
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/http1_directives.html b/web/server/h2o/libh2o/doc/configure/http1_directives.html new file mode 100644 index 000000000..f7768d57b --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/http1_directives.html @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + +HTTP/1 Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +HTTP/1 Directives +

+ + +

+This document describes the configuration directives for controlling the HTTP/1 protocol handler. +

+ + + +
+
Description:
+
+

+Timeout for incoming requests in seconds. +

+ +
+
Level:
+
global
+
Default:
+
http1-request-timeout: 10
+
+ + +
+
Description:
+
+

+Boolean flag (ON or OFF) indicating whether or not to allow upgrade to HTTP/2. +

+ +
+
Level:
+
global
+
Default:
+
http1-upgrade-to-http2: ON
+
+ + + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/http2_directives.html b/web/server/h2o/libh2o/doc/configure/http2_directives.html new file mode 100644 index 000000000..2d92aafc5 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/http2_directives.html @@ -0,0 +1,510 @@ + + + + + + + + + + + + + + + + +HTTP/2 Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +HTTP/2 Directives +

+ + +

+H2O provides one of the world's most sophisticated HTTP/2 protocol implementation, including following features. +

+ +

Prioritization

+ +

+H2O is one of the few servers that fully implement prioritization of HTTP responses conformant to what is defined in the HTTP/2 specification. +The server implements a O(1) scheduler that determines which HTTP response should be sent to the client, per every 16KB chunk. +

+

+Unfortunately, some web browsers fail to specify response priorities that lead to best end-user experience. +H2O is capable of detecting such web browsers, and if it does, uses server-driven prioritization; i.e. send responses with certain MIME-types before others. +

+

+It is possible to tune or turn off server-driven prioritization using directives: file.mime.addtypes, http2-reprioritize-blocking-assets. +

+

+See also: +

+

+ +

Server push

+ +

+H2O recognizes link headers with preload keyword sent by a backend application server (reverse proxy or FastCGI) or an mruby handler, and pushes the designated resource to a client. +

+
+
Example. A link response header triggering HTTP/2 push
+
link: </assets/jquery.js>; rel=preload; as=script
+
+
+ + +

When the HTTP/2 driver of H2O recognizes a link response header with rel=preload attribute set, and if all of the following conditions are met, the specified resource is pushed to the client. +

+
    +
  • configuration directive http2-push-preload is not set to OFF
  • +
  • the link header does not have the nopush attribute set
  • +
  • the link header is not part of a pushed response
  • +
  • the client does not disable HTTP/2 push
  • +
  • number of the pushed responses in-flight is below the negotiated threshold
  • +
  • authority of the resource specified is equivalent to the request that tried to trigger the push
  • +
  • (for handlers that return the status code synchronously) the status code of the response to be pushed does not indicate an error (i.e. 4xx or 5xx)
  • +
+

+The server also provides a mechanism to track the clients' cache state via cookies, and to push the resources specified with the link header only when it does not exist within the clients' cache. For details, please refer to the documentation of http2-casper configuration directive. +

+

+When a resource is pushed, the priority is determined using the priority attribute of the MIME-type configuration. If the priority is set to highest then the resource will be sent to the client before anything else; otherwise the resource will be sent to client after the main content, as per defined by the HTTP/2 specification. +

+

+HTTP/1.1 allows a server to send an informational response (see RFC 7230 section 6.2) before sending the final response. +Starting from version 2.1, web applications can take advantage of the informational response to initiate HTTP/2 pushes before starting to process the request. +The following example shows how such responses would look like. +

+
+
Example. 100 response with link headers
+
HTTP/1.1 100 Continue
+Link: </assets/style.css>; rel=preload; as=style
+Link: </assets/jquery.js>; rel=preload; as=script
+
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+<!doctype html>
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="/assets/style.css">
+<script type="text/javascript" src="/assets/jquery.js"></scrrpt>
+...
+
+
+ +

+Pushed responses will have x-http2-push: pushed header set; by looking for the header, it is possible to determine if a resource has been pushed. +It is also possible to log the value in the access log by specifying %{x-http2-push}o, push responses but cancelled by CASPER will have the value of the header logged as cancelled. +

+

+See also: +

+

+ +

Latency Optimization

+ +

+When using HTTP/2, a client often issues high-priority requests (e.g. requests for CSS and JavaScript files that block the rendering) while a lower-priority response (e.g. HTML) is in flight. +In such case, it is desirable for a server to switch to sending the response of the high-priority requests as soon as it observes the requests. +

+

+In order to do so, send buffer of the TCP/IP stack should be kept empty except for the packets in-flight, and size of the TLS records must be small enough to avoid head-of-line blocking. +The downside is that obeying the requirement increases the interaction between the server process and kernel, which result in consumption of more CPU cycles and slightly increased latency. +

+

+Starting from version 2.1, H2O provides directives that lets the users tune how the TCP/IP stack is used depending on the observed RTT, CWND, and the additional latency imposed by the interaction between the server and the OS. +

+

+For TCP/IP connections with greater RTT and smaller CWND than the configured threshold, the server will try to keep the size of HTTP/2 frames unsent as small as possible so that it can switch to sending a higher-priority response. +Benchmarks suggest that users can expect in average 1 RTT reduction when this optimization is enabled. +For connections that do not meet the criteria, the server will utilize the TCP/IP stack in ordinary ways. +

+

+The default values of the thresholds have been chosen that the optimization will come into action for mobile and long-distance networks but not when a proxy exists on the network. +

+

+The optimization is supported only on Linux and OS X. The two are the operating systems that provide access to TCP_INFO and an interface to adjust the size of the unsent buffer (TCP_NOTSENT_LOWAT). +

+

+Please refer to the documentation of the directives below to configure the optimization: +

+

+

+See also: +

+

+ +

+The following describes the configuration directives for controlling the HTTP/2 protocol handler. +

+ + + +
+
Description:
+
+

+Configures CASPer (cache-aware server-push). + +

+ +

+When enabled, H2O maintains a fingerprint of the web browser cache, and cancels server-push suggested by the handlers if the client is known to be in possession of the content. +The fingerprint is stored in a cookie named h2o_casper using Golomb-compressed sets (a compressed encoding of Bloom filter). +

+

+If the value is OFF, the feature is disabled. +Push requests (made by the handlers through the use of Link: rel=preload header) are processed regardless of whether if client already has the responses in its cache. +If the value is ON, the feature is enabled with the defaults value specified below. +If the value is mapping, the feature is enabled, recognizing the following attributes. +

+
capacity-bits: +
number of bits used for the fingerprinting. +Roughly speaking, the number of bits should be log2(1/P * number-of-assets-to-track) where P being the probability of false positives. +Default is 13, enough for tracking about 100 asset files with 1/100 chance of false positives (i.e. log2(100 * 100) =~ 13). +
tracking-types: +
specifies the types of the content tracked by casper. +If omitted or set to blocking-assets, maintains fingerprint (and cancels server push) for resources with mime-type of highest priority. +If set to all, tracks all responses. +
+

+It should be noted that the size of the cookie will be log2(P) * number-of-assets-being-tracked bits multiplied by the overhead of Base 64 encoding (4/3). +Therefore with current cookie-based implementation, it is necessary in many cases to restrict the resources being tracked to those have significant effect to user-perceived response time. +

+ +
+
Example. Enabling CASPer
+
http2-casper: ON
+
+# `ON` is equivalent to:
+# http2-casper:
+#   capacity-bits:  13
+#   tracking-types: blocking-assets
+
+
+ + + +
+
Level:
+
global, host
+
Default:
+
http2-casper: OFF
+
See also:
+
file.mime.addtypes, +issue #421 +
+
+ + + +
+
Description:
+
+

+A directive to turn on the HTTP/2 Implementation Debug State. + +

+ + +

+This experimental feature serves a JSON document at the fixed path /.well-known/h2/state, which describes an internal HTTP/2 state of the H2O server. +To know the details about the response fields, please see the spec. +This feature is only for developing and debugging use, so it's highly recommended that you disable this setting in the production environment. +

+ +

+The value of this directive specifies the property set contained in the response. Available values are minimum or hpack. +If hpack is specified, the response will contain the internal hpack state of the same connection. +If minimum is specified, the response doesn't contain the internal hpack state. +

+ +

+In some circumstances, there may be a risk of information leakage on providing an internal hpack state. For example, the case that some proxies exist between the client and the server, and they share the connections among the clients. +Therefore, you should specify hpack only when the server runs in the environments you can completely control. +

+ +

+This feature is considered experimental yet. +For now, the implementation conforms to the version draft-01 of the specification. +

+ + +
+
Level:
+
host
+
See also:
+
HTTP/2 Implementation Debug State (draft-01) +
+
+ + + +
+
Description:
+
+

+Timeout for idle connections in seconds. + +

+ +
+
Level:
+
global
+
Default:
+
http2-idle-timeout: 10
+
+ + +
+
Description:
+
+

+Maximum number of requests to be handled concurrently within a single HTTP/2 connection. + +

+ +

+The value cannot exceed 256. +

+ +
+
Level:
+
global
+
Default:
+
http2-max-concurrent-requests-per-connection: 100
+
+ + + +
+
Description:
+
+

+Minimum RTT (in milliseconds) to enable latency optimization. + +

+ +

+Latency optimization is disabled for TCP connections with smaller RTT (round-trip time) than the specified value. +Otherwise, whether if the optimization is used depends on other parameters. +

+

+Setting this value to 4294967295 (i.e. UINT_MAX) effectively disables the optimization. +

+ +
+
Level:
+
global
+
Default:
+
http2-latency-optimization-min-rtt: 50
+
+ + + +
+
Description:
+
+

+Maximum additional delay (as the ratio to RTT) permitted to get latency optimization activated. + +

+ +

+Latency optimization is disabled if the additional delay imposed by the interaction between the OS and the TCP/IP stack is estimated to be greater than the given threshold. +Otherwise, whether if the optimization is used depends on other parameters. +

+ +
+
Level:
+
global
+
Default:
+
http2-latency-optimization-max-additional-delay: 0.1
+
+ + + +
+
Description:
+
+

+Maximum size (in octets) of CWND to get latency optimization activated. + +

+ +

+CWND is a per-TCP-connection variable that represents the number of bytes that can be sent within 1 RTT. +

+

+The server will not use or stop using latency optimization mode if CWND becomes greater than the configured value. +In such case, average size of HTTP/2 frames buffered unsent will be slightly above the tcp_notsent_lowat sysctl value. +

+ + +
+
Level:
+
global
+
Default:
+
http2-latency-optimization-max-cwnd: 65535
+
+ +
+
since v2.1
+

"http2-push-preload"

+
+ +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating whether if the server should push resources when observing a link: rel=preload header. + +

+ + +
+
Level:
+
global, host
+
Default:
+
http2-push-preload: ON
+
+ + + +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating if the server should send contents with highest priority before anything else. + +

+ +

+To maximize the user-perceived responsiveness of a web page, it is essential for the web server to send blocking assets (i.e. CSS and JavaScript files in <HEAD>) before any other files such as images. +HTTP/2 provides a way for web browsers to specify such priorities to the web server. +However, as of Sep. 2015, no major web browsers except Mozilla Firefox take advantage of the feature. +

+

+This option, when enabled, works as a workaround for such web browsers, thereby improving experience of users using the web browsers. +

+

+Technically speaking, it does the following: +

    +
  • if the client uses dependency-based prioritization, do not reprioritize +
  • if the client does not use dependency-based prioritization, send the contents of which their types are given highest priority before any other responses +
+

+ +
+
Level:
+
global
+
Default:
+
http2-reprioritize-blocking-assets: ON
+
See also:
+
file.mime.addtypes, +HTTP/2 (and H2O) improves user experience over HTTP/1.1 or SPDY +
+
+ + + +
+
Description:
+
+

+A timeout in seconds. How long to wait before closing the connection on graceful shutdown. Setting the timeout to 0 deactivates the feature: H2O will wait for the peer to close the connections. + +

+ +
+
Level:
+
global
+
Default:
+
http2-graceful-shutdown-timeout: 0
+
+ + + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/mruby.html b/web/server/h2o/libh2o/doc/configure/mruby.html new file mode 100644 index 000000000..d424351d8 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/mruby.html @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + +Using Mruby - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Using Mruby +

+ + +

+mruby is a lightweight implementation of the Ruby programming language. +With H2O, users can implement their own request handling logic using mruby, either to generate responses or to fix-up the request / response. +

+ +

Rack-based Programming Interface

+ +

+The interface between the mruby program and the H2O server is based on Rack interface specification. +Below is a simple configuration that returns hello world. +

+ +
+
Example. Hello-world in mruby
+
paths:
+  "/":
+    mruby.handler: |
+      Proc.new do |env|
+        [200, {'content-type' => 'text/plain'}, ["Hello world\n"]]
+      end
+
+
+ + +

+It should be noted that as of H2O version 1.7.0, there are limitations when compared to ordinary web application server with support for Rack such as Unicorn: +

    +
  • no libraries provided as part of Rack is available (only the interface is compatible) +
+

+ +

+In addition to the Rack interface specification, H2O recognizes status code 399 which can be used to delegate request to the next handler. +The feature can be used to implement access control and response header modifiers. +

+ +

Access Control

+ +

+By using the 399 status code, it is possible to implement access control using mruby. +The example below restricts access to requests from 192.168. private address. +

+ +
+
Example. Restricting access to 192.168.
+
paths:
+  "/":
+    mruby.handler: |
+      lambda do |env|
+        if /\A192\.168\./.match(env["REMOTE_ADDR"])
+          return [399, {}, []]
+        end
+        [403, {'content-type' => 'text/plain'}, ["access forbidden\n"]]
+      end
+
+
+ + +

+Support for Basic Authentication is also provided by an mruby script. +

+ +

Delegating the Request

+ +

+When enabled using the reproxy directive, it is possible to delegate the request from the mruby handler to any other handler. +

+

+

+
Example. Rewriting URL with delegation
+
paths:
+  "/":
+    mruby.handler: |
+      lambda do |env|
+        if /\/user\/([^\/]+)/.match(env["PATH_INFO"])
+          return [307, {"x-reproxy-url" => "/user.php?user=#{$1}"}, []]
+        end
+        return [399, {}, []]
+      end
+
+
+ + +

Modifying the Response

+ +

+When the mruby handler returns status code 399, H2O delegates the request to the next handler while preserving the headers emitted by the handler. +The feature can be used to add extra headers to the response. +

+

+For example, the following example sets cache-control header for requests against .css and .js files. +

+ +
+
Example. Setting cache-control header for certain types of files
+
paths:
+  "/":
+    mruby.handler: |
+      Proc.new do |env|
+        headers = {}
+        if /\.(css|js)\z/.match(env["PATH_INFO"])
+          headers["cache-control"] = "max-age=86400"
+        end
+        [399, headers, []]
+      end
+    file.dir: /path/to/doc-root
+
+
+ + +

+Or in the example below, the handler triggers HTTP/2 server push with the use of Link: rel=preload headers, and then requests a FastCGI application to process the request. +

+ +
+
Example. Pushing asset files
+
paths:
+  "/":
+    mruby.handler: |
+      Proc.new do |env|
+        push_paths = []
+        # push css and js when request is to dir root or HTML
+        if /(\/|\.html)\z/.match(env["PATH_INFO"])
+          push_paths << ["/css/style.css", "style"]
+          push_paths << ["/js/app.js", "script"]
+        end
+        [399, push_paths.empty? ? {} : {"link" => push_paths.map{|p| "<#{p[0]}>; rel=preload; as=#{p[1]}"}.join("\n")}, []]
+      end
+    fastcgi.connect: ...
+
+
+ + +

Using the HTTP Client

+ +

+Starting from version 1.7, a HTTP client API is provided. +HTTP requests issued through the API will be handled asynchronously; the client does not block the event loop of the HTTP server. +

+ +
+
Example. Mruby handler returning the response of http://example.com
+
paths:
+  "/":
+    mruby.handler: |
+      Proc.new do |env|
+        req = http_request("http://example.com")
+        status, headers, body = req.join
+        [status, headers, body]
+      end
+
+
+ + +

+http_request is the method that issues a HTTP request. +

+

+The method takes two arguments. +First argument is the target URI. +Second argument is an optional hash; method (defaults to GET), header, body attributes are recognized. +

+

+The method returns a promise object. +When #join method of the promise is invoked, a three-argument array containing the status code, response headers, and the body is returned. +The response body is also a promise. +Applications can choose from three ways when dealing with the body: a) call #each method to receive the contents, b) call #join to retrieve the body as a string, c) return the object as the response body of the mruby handler. +

+

+The header and the body object passed to http_request should conform to the requirements laid out by the Rack specification for request header and request body. +The response header and the response body object returned by the #join method of the promise returned by http_request conforms to the requirements of the Rack specification. +

+

+Since the API provides an asynchronous HTTP client, it is possible to effectively issue multiple HTTP requests concurrently and merge them into a single response. +

+

+When HTTPS is used, servers are verified using the properties of proxy.ssl.cafile and proxy.ssl.verify-peer specified at the global level. +

+ +

Logging Arbitrary Variable

+ +

+In version 2.3, it is possible from mruby to set and log an arbitrary-named variable that is associated to a HTTP request. +A HTTP response header that starts with x-fallthru-set- is handled specially by the H2O server. Instead of sending the header downstream, the server accepts the value as a request environment variable, taking the suffix of the header name as the name of the variable. +

+

+This example shows how to read request data, parse json and then log data from mruby. +

+ +
+
Example. Logging the content of a POST request via request environment variable
+
paths:
+  "/":
+    mruby.handler: |
+      Proc.new do |env|
+        input = env["rack.input"] ? env["rack.input"].read : '{"default": "true"}'
+        parsed_json = JSON.parse(input)
+        parsed_json["time"] = Time.now.to_i
+        logdata = parsed_json.to_s
+        [204, {"x-fallthru-set-POSTDATA" => logdata}, []]
+      end
+    access-log:
+      path: /path/to/access-log.json
+      escape: json
+      format: '{"POST": %{POSTDATA}e}'
+
+
+ + + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/mruby_directives.html b/web/server/h2o/libh2o/doc/configure/mruby_directives.html new file mode 100644 index 000000000..2a188a5b4 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/mruby_directives.html @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + +Mruby Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Mruby Directives +

+ + +

+The following are the configuration directives of the mruby handler. +Please refer to Using mruby to find out how to write handlers using mruby. +

+ + + +
+
Description:
+
+

+Upon start-up evaluates given mruby expression, and uses the returned mruby object to handle the incoming requests. + +

+ + +
+
Example. Hello-world in mruby
+
mruby.handler: |
+  Proc.new do |env|
+    [200, {'content-type' => 'text/plain'}, ["Hello world\n"]]
+  end
+
+
+ + +

+Note that the provided expression is evaluated more than once (typically for every thread that accepts incoming connections). +

+ +
+
Level:
+
path
+
See also:
+
mruby.handler-file +
+
+ + + +
+
Description:
+
+

+Upon start-up evaluates given mruby file, and uses the returned mruby object to handle the incoming requests. + +

+ + +
+
Example. Hello-world in mruby
+
mruby.handler-file: /path/to/my-mruby-handler.rb
+
+
+ + +

+Note that the provided expression is evaluated more than once (typically for every thread that accepts incoming connections). +

+ +
+
Level:
+
path
+
See also:
+
mruby.handler +
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/proxy_directives.html b/web/server/h2o/libh2o/doc/configure/proxy_directives.html new file mode 100644 index 000000000..6b8bb7e0a --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/proxy_directives.html @@ -0,0 +1,535 @@ + + + + + + + + + + + + + + + + +Proxy Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Proxy Directives +

+ + +

+Proxy module is the reverse proxy implementation for H2O - it implements a HTTP client that forwards a HTTP request to an upstream server. +

+

+When forwarding the requests, the module sets following request headers: +

+

+

+The HTTP client only supports HTTP/1. +Support for HTTPS has been introduced in version 2.0. +

+

+Following sections describe the configuration directives defined for the module. +

+ + + +
+
Description:
+
+

+Forwards the requests to the specified URL, and proxies the response. +

+ +
+
Example. Forwarding the requests to application server running on 127.0.0.1:8080
+
proxy.reverse.url: "http://127.0.0.1:8080/"
+
+
+ +

+If you want load balancing multiple backends, replace 127.0.0.1 with hostname which returns IP addresses via DNS or /etc/hosts. +

+

+In addition to TCP/IP over IPv4 and IPv6, the proxy handler can also connect to an HTTP server listening to a Unix socket. +Path to the unix socket should be surrounded by square brackets, and prefixed with unix: (e.g. http://[unix:/path/to/socket]/path). +

+ + +
+
Level:
+
path
+
+ + + +
+
Description:
+
+

+A boolean flag (ON or OFF) designating whether or not to pass Host header from incoming request to upstream. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.preserve-host: OFF
+
+ + + + +
+
Description:
+
+

+A boolean flag(ON or OFF) indicating if the server preserve the received x-forwarded-proto request header. +

+ +

+By default, when transmitting a HTTP request to an upstream HTTP server, H2O removes the received x-forwarded-proto request header and sends its own, as a precaution measure to prevent an attacker connecting through HTTP to lie that they are connected via HTTPS. +However in case H2O is run behind a trusted HTTPS proxy, such protection might not be desirable, and this configuration directive can be used to modify the behaviour. +

+ +
+
Level:
+
global
+
Default:
+
proxy.preserve-x-forwarded-proto: OFF
+
+ +
+
since v2.1
+

"proxy.proxy-protocol"

+
+ +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating if PROXY protocol should be used when connecting to the application server. +

+ +

+When using the PROXY protocol, connections to the application server cannot be persistent (i.e. proxy.timeout.keepalive must be set to zero). +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.proxy-protocol: OFF
+
See also:
+
proxy.timeout.keepalive +
+
+ + + +
+
Description:
+
+

+A boolean flag(ON or OFF) indicating if the server will append or add the x-forwarded-proto and x-forwarded-for request headers. +

+ +

+By default, when forwarding an HTTP request H2O sends its own x-forwarded-proto and x-forwarded-for request headers (or might append its value in the x-forwarded-proto case, see proxy.preserve-x-forwarded-proto). This might not be always desirable. Please keep in mind security implications when setting this of OFF, since it might allow an attacker to spoof the originator or the protocol of a request. +

+ +
+
Level:
+
global
+
Default:
+
proxy.emit-x-forwarded-headers: ON
+
See also:
+
proxy.emit-via-header +
+
+ +
+
since v2.2
+

"proxy.emit-via-header"

+
+ +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating if the server adds or appends an entry to the via request header. +

+ +
+
Level:
+
global
+
Default:
+
proxy.emit-via-header: ON
+
See also:
+
proxy.emit-x-forwarded-headers +
+
+ + +
+
since v2.2
+

"proxy.header.add"

+
+ +
+
Description:
+
+

+Modifies the request headers sent to the application server. +

+ +

+The behavior is identical to header.add except for the fact that it affects the request sent to the application server. +Please refer to the documentation of the headers handler to see how the directives can be used to mangle the headers. +

+ +
+
Level:
+
global, host, path, extensions
+
+
+
since v2.2
+

"proxy.header.append"

+
+ +
+
Description:
+
+

+Modifies the request headers sent to the application server. +

+ +

+The behavior is identical to header.append except for the fact that it affects the request sent to the application server. +Please refer to the documentation of the headers handler to see how the directives can be used to mangle the headers. +

+ +
+
Level:
+
global, host, path, extensions
+
+
+
since v2.2
+

"proxy.header.merge"

+
+ +
+
Description:
+
+

+Modifies the request headers sent to the application server. +

+ +

+The behavior is identical to header.merge except for the fact that it affects the request sent to the application server. +Please refer to the documentation of the headers handler to see how the directives can be used to mangle the headers. +

+ +
+
Level:
+
global, host, path, extensions
+
+
+
since v2.2
+

"proxy.header.set"

+
+ +
+
Description:
+
+

+Modifies the request headers sent to the application server. +

+ +

+The behavior is identical to header.set except for the fact that it affects the request sent to the application server. +Please refer to the documentation of the headers handler to see how the directives can be used to mangle the headers. +

+ +
+
Level:
+
global, host, path, extensions
+
+ + +
+
Description:
+
+

+Modifies the request headers sent to the application server. +

+ +

+The behavior is identical to header.setifempty except for the fact that it affects the request sent to the application server. +Please refer to the documentation of the headers handler to see how the directives can be used to mangle the headers. +

+ +
+
Level:
+
global, host, path, extensions
+
+
+
since v2.2
+

"proxy.header.unset"

+
+ +
+
Description:
+
+

+Modifies the request headers sent to the application server. +

+ +

+The behavior is identical to header.unset except for the fact that it affects the request sent to the application server. +Please refer to the documentation of the headers handler to see how the directives can be used to mangle the headers. +

+ +
+
Level:
+
global, host, path, extensions
+
+ + +
+
since v2.0
+

"proxy.ssl.cafile"

+
+ +
+
Description:
+
+

+Specifies the file storing the list of trusted root certificates. +

+ +

+By default, H2O uses share/h2o/ca-bundle.crt. The file contains a set of trusted root certificates maintained by Mozilla, downloaded and converted using mk-ca-bundle.pl. +

+ +
+
Level:
+
global, host, path, extension
+
See also:
+
proxy.ssl.verify-peer +
+
+ + + +
+
Description:
+
+

+Specifies whether if and how a session cache should be used for TLS connections to the application server. +

+ +

+Since version 2.1, result of the TLS handshakes to the application server is memoized and later used to resume the connection, unless set to OFF using this directive. +If the value is a mapping, then the following two attributes must be specified: +

+
lifetime:
+
validity of session cache entries in seconds
+
capacity:
+
maxmum number of entries to be kept in the session cache
+
+If set to ON, lifetime and capacity will be set to 86,400 (one day) and 4,096. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.ssl.session-cache: ON
+
+ +
+
since v2.0
+

"proxy.ssl.verify-peer"

+
+ +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating if the server certificate and hostname should be verified. +

+ +

+If set to ON, the HTTP client implementation of H2O verifies the peer's certificate using the list of trusted certificates as well as compares the hostname presented in the certificate against the connecting hostname. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.ssl.verify-peer: ON
+
See also:
+
proxy.ssl.cafile +
+
+ + + +
+
Description:
+
+

+Sets the upstream I/O timeout in milliseconds. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.timeout.io: 30000
+
+ + + + +
+
Description:
+
+

+Sets the upstream timeout for idle connections in milliseconds. +

+ +

+Upstream connection becomes non-persistent if the value is set to zero. +The value should be set to something smaller than that being set at the upstream server. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.timeout.keepalive: 2000
+
+ + + +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating whether or not to allow upgrading the proxied connection to the WebSocket protocol. +

+ +

+When set to ON, the proxied connection will be upgraded to a bi-directional tunnel stream if upgrading to WebSocket connection is permitted by the backend server (i.e. if the backend server responds to a WebSocket handshake with 101 status code). +

+

+Support for WebSocket is considered experimental for the time being and therefore is not yet turned on by default. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.websocket: OFF
+
+ + + +
+
Description:
+
+

+Sets idle timeout of a WebSocket connection being proxied. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
proxy.websocket.timeout: 300000
+
+ + + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/quick_start.html b/web/server/h2o/libh2o/doc/configure/quick_start.html new file mode 100644 index 000000000..e74f7043a --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/quick_start.html @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + +Quick Start - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Quick Start +

+ + +

+In order to run the H2O standalone HTTP server, you need to write a configuration file. +The minimal configuration file looks like as follows. +

+ +
listen:
+  port: 8080
+user: nobody
+hosts:
+  "myhost.example.com":
+    paths:
+      /:
+        file.dir: /path/to/the/public-files
+access-log: /path/to/the/access-log
+error-log: /path/to/the/error-log
+pid-file: /path/to/the/pid-file
+
+ +

+The configuration instructs the server to: +

    +
  1. listen to port 8080
  2. +
  3. under the privileges of nobody
  4. +
  5. serve files under /path/to/the/public-files
  6. +
  7. emit access logs to file: /path/to/the/access-log
  8. +
  9. emit error logs to /path/to/the/error-log
  10. +
  11. store the process id of the server in /path/to/the/pid-file +
+

+ +

+Enter the command below to start the server. +

+ +
% sudo h2o -m daemon -c /path/to/the/configuration-file
+
+ +

+The command instructs the server to read the configuration file, and start in daemon mode, which dispatches a pair of master and worker processes that serves the HTTP requests. +

+ +

+To stop the server, send SIGTERM to the server. +

+ +
% sudo kill -TERM `cat /path/to/the/pid-file`
+
+ +

Next Step

+ +

+Now that you know how to start and stop the server, the next step is to learn the configuration directives and their structure, or see the configuration examples. +

+ +

+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/redirect_directives.html b/web/server/h2o/libh2o/doc/configure/redirect_directives.html new file mode 100644 index 000000000..81ffb3620 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/redirect_directives.html @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + +Redirect Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Redirect Directives +

+ + +

+This document describes the configuration directives of the redirect handler. +

+ + + +
+
Description:
+
+

+Redirects the requests to given URL. +

+ +

+The directive rewrites the URL by replacing the host and path part of the URL at which the directive is used with the given URL. For example, when using the configuration below, requests to http://example.com/abc.html will be redirected to https://example.com/abc.html. +

+

+If the argument is a scalar, the value is considered as the URL to where the requests should be redirected. +

+

+Following properties are recognized if the argument is a mapping. +

+
url +
URL to redirect to +
status +
the three-digit status code to use (e.g. 301) +
internal +
either YES or NO (default); if set to YES, then the server performs an internal redirect and return the content at the redirected URL +
+

+
+
Example. Redirect all HTTP to HTTPS permanently (except for the files under RSS)
+
hosts:
+    "example.com:80":
+        paths:
+            "/":
+                redirect:
+                    status: 301
+                    url:    "https://example.com/"
+            "/rss":
+                file.dir: /path/to/rss
+
+
+ + + +
+
Level:
+
path
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/reproxy_directives.html b/web/server/h2o/libh2o/doc/configure/reproxy_directives.html new file mode 100644 index 000000000..760770ce6 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/reproxy_directives.html @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + +Reproxy Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Reproxy Directives +

+ + +

+This document describes the configuration directives of the reproxy handler. +

+ + + +
+
Description:
+
+

+A boolean flag (ON or OFF) indicating if the server should recognize the X-Reproxy-URL header sent from upstream servers. + +

+ +

+If H2O recognizes the header, it fetches the contents of the resource specified by the header, and sends the contents as the response to the client. +If the status code associated with the X-Reproxy-URL header is 307 or 308, then the method of the original request is used to obtain the specified resource. +Otherwise, the request method is changed to GET. +

+

+For example, an upstream server may send an URL pointing to a large image using the X-Reproxy-URL header stored on a distributed file system, and let H2O fetch and return the content to the client, instead of fetching the image by itself. +Doing so would reduce the load on the application server. +

+ +
+
Level:
+
global, host, path, extension
+
Default:
+
reproxy: OFF
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/status_directives.html b/web/server/h2o/libh2o/doc/configure/status_directives.html new file mode 100644 index 000000000..255810667 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/status_directives.html @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + +Status Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Status Directives +

+ + +

+The status handler exposes the current states of the HTTP server. +This document describes the configuration directives of the handler. +

+ +
+
since v2.0
+

"status"

+
+ +
+
Description:
+
+

+If the argument is ON, the directive registers the status handler to the current path. + +

+ +

+Access to the handler should be restricted, considering the fact that the status includes the details of in-flight HTTP requests. +The example below uses Basic authentication. +

+
+
Example. Exposing status with Basic authentication
+
paths:
+  /server-status:
+    mruby.handler: |
+      require "htpasswd.rb"
+      Htpasswd.new("/path/to/.htpasswd", "status")
+    status: ON
+
+
+ +

+The information returned by the /json handler can be filtered out using the optional show=module1,module2 parameter. +There are currently three modules defined: +

    +
  • requests: displays the requests currently in-flight.
  • +
  • durations: displays durations statistics for requests since server start time in seconds (returns all zeros unless duration-stats is ON).
  • +
  • errors: displays counters for internally generated errors.
  • +
  • main: displays general daemon-wide stats.
  • +
+

+ +
+
Level:
+
path
+
+ +
+
since v2.1
+

"duration-stats"

+
+ +
+
Description:
+
+

+Gather timing stats for requests. +

+ +

+

+If the argument is ON, this directive populates duration statistics in seconds, to be consumed by status handlers. +Enabling this feature has a noticeable CPU and memory impact. +

+

+Note that the time spent while processing a request in a blocking manner (such as opening a file or a mruby handler that does invoke a network operation) will not be reflected to the process_time element of the duration stats due to the fact that the timer being used for measuring the time spent is updated only once per loop. +

+ +
+
Level:
+
global
+
Default:
+
duration-stats: OFF
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/syntax_and_structure.html b/web/server/h2o/libh2o/doc/configure/syntax_and_structure.html new file mode 100644 index 000000000..0d0fd7a28 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/syntax_and_structure.html @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + +Syntax and Structure - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Syntax and Structure +

+ + +

Syntax

+ +

+H2O uses YAML 1.1 as the syntax of its configuration file. +

+ +

Levels of Configuration

+ +

+When using the configuration directives of H2O, it is important to understand that there are four configuration levels: global, host, path, extension. +

+ +

+Global-level configurations affect the entire server. +Host-level configurations affect the configuration for the specific hostname (i.e. corresponds to the <VirtualHost> directive of the Apache HTTP Server). +Path-level configurations only affect the behavior of resources specific to the path. +

+ +

+Extension-level configuration affect how files with certain extensions are being served. +For example, it is possible to map files with .php extension to the FastCGI handler running the php-cgi command. +

+ +

+Consider the following example. +

+ +
hosts:
+  "example.com":
+    listen:
+      port: 443
+      ssl:
+        certificate-file: etc/site1.crt
+        key-file: etc/site1.key
+    paths:
+      "/":
+        file.dir: htdocs/site1
+      "/icons":
+        file.dir: icons
+        expires: 1 day
+  "example.com:80":
+    listen:
+      port: 80
+    paths:
+      "/":
+        redirect: "https://example.com/"
+
+ +

+In the example, two host-level configurations exist (under the hosts mapping), each of them listening to different ports. +The first host listens to port 443 using TLS (i.e. HTTPS) using the specified server certificate and key. +It has two path-level configurations, one for / and the other for /icons, each of them pointing to different local directories containing the files to be served. +The latter also has the expires directive set, so that Cache-Control: max-age=864001 header would be sent. +The second host accepts connections on port 80 (via the plain-text HTTP protocol), and redirects all the requests to the first host using HTTPS. +

+ +

+Certain configuration directives can be used in more than one levels. For example, the listen can be used either at the global level or at the host level. +Expires can be used at all levels. +On the other hand file.dir can only be used at the path level. +

+ +

Path-level configuration

+ +

+Values of the path-level configuration define the action(s) to be taken when the server processes a request that prefix-matches to the configured paths. +Each entry of the mapping associated to the paths is evaluated in the order they appear. +

+ +

+Consider the following example. +When receiving a request for https://example.com/foo, the file handler is first executed trying to serve a file named /path/to/doc-root/foo as the response. +In case the file does not exist, then the FastCGI handler is invoked. +

+ +
hosts:
+  "example.com":
+    listen:
+      port: 443
+      ssl:
+        certificate-file: etc/site1.crt
+        key-file: etc/site1.key
+    paths:
+      "/":
+        file.dir: /path/to/doc-root
+        fastcgi.connect:
+          port: /path/to/fcgi.sock
+          type: unix
+
+ +

+Starting from version 2.1, it is also possible to define the path-level configuration as a sequence of mappings instead of a single mapping. +The following example is identical to the previous one. +Notice the dashes placed before the handler directives. +

+ +
hosts:
+  "example.com":
+    listen:
+      port: 443
+      ssl:
+        certificate-file: etc/site1.crt
+        key-file: etc/site1.key
+    paths:
+      "/":
+        - file.dir: /path/to/doc-root
+        - fastcgi.connect:
+            port: /path/to/fcgi.sock
+            type: unix
+
+ +

Using YAML Alias

+ +

+H2O resolves YAML aliases before processing the configuration file. +Therefore, it is possible to use an alias to reduce the redundancy of the configuration file. +For example, the following configuration reuses the first paths element (that is given an anchor named default_paths) in the following definitions. + +

hosts:
+  "example.com":
+    listen:
+      port: 443
+      ssl:
+        certificate-file: /path/to/example.com.crt
+        key-file:         /path/to/example.com.crt
+    paths: &default_paths
+      "/":
+        file.dir: /path/to/doc-root
+  "example.org":
+    listen:
+      port: 443
+      ssl:
+        certificate-file: /path/to/example.org.crt
+        key-file:         /path/to/example.org.crt
+    paths: *default_paths
+
+ +

Using YAML Merge

+ +

+Since version 2.0, H2O recognizes Merge Key Language-Independent Type for YAML™ Version 1.1. +Users can use the feature to merge an existing mapping against another. +The following example reuses the TLS configuration of example.com in example.org. +

+ +
hosts:
+  "example.com":
+    listen:
+      port: 443
+      ssl: &default_ssl
+        minimum-version: TLSv1.2
+        cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
+        certificate-file: /path/to/example.com.crt
+        key-file:         /path/to/example.com.crt
+    paths:
+      ...
+  "example.org":
+    listen:
+      port: 443
+      ssl:
+        <<: *default_ssl
+        certificate-file: /path/to/example.org.crt
+        key-file:         /path/to/example.org.crt
+    paths:
+      ...
+
+ +

Including Files

+ +

+Starting from version 2.1, it is possible to include a YAML file from the configuration file using !file custom YAML tag. +The following example extracts the TLS configuration into default_ssl.conf and include it multiple times in h2o.conf. +

+ +
+
Example. default_ssl.conf
+
minimum-version: TLSv1.2
+cipher-suite: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
+certificate-file: /path/to/example.com.crt
+key-file:         /path/to/example.com.crt
+
+
+ + +
+
Example. h2o.conf
+
hosts:
+  "example.com":
+    listen:
+      port: 443
+      ssl: !file default_ssl.conf
+    paths:
+      ...
+  "example.org":
+    listen:
+      port: 443
+      ssl:
+        <<: !file default_ssl.conf
+        certificate-file: /path/to/example.org.crt
+        key-file:         /path/to/example.org.crt
+    paths:
+      ...
+
+
+ + + + +
+

Notes:

+
    +
  1. 1 day is equivalent to 86400 seconds
  2. +
+
+ +
+ + + diff --git a/web/server/h2o/libh2o/doc/configure/throttle_response_directives.html b/web/server/h2o/libh2o/doc/configure/throttle_response_directives.html new file mode 100644 index 000000000..a61c767f5 --- /dev/null +++ b/web/server/h2o/libh2o/doc/configure/throttle_response_directives.html @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + +Throttle Response Directives - Configure - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Configure > +Throttle Response Directives +

+ + +

+The throttle response handler performs per response traffic throttling, when an X-Traffic header exists in the response headers. +

+

+The value of X-Traffic header should be an integer that represents the speed you want in bytes per second. This header CAN be set with header.add so that traffic for static assets can also be easily throttled. +

+

+The following are the configuration directives recognized by the handler. +

+ +
+
since v2.1
+

"throttle-response"

+
+ +
+
Description:
+
+

+Enables traffic throttle per HTTP response. + +

+ +

+If the argument is ON, the traffic per response is throttled as long as a legal X-Traffic header exists. +If the argument is OFF, traffic throttle per response is disabled. +

+
+
Example. Enabling traffic throttle per response with static file configuration
+
# enable throttle
+throttle-response: ON
+
+# an example host configuration that throttle traffic to ~100KB/s
+hosts:
+  default:
+    paths:
+      /:
+        file.dir: /path/to/assets
+        header.add: "X-Traffic: 100000"
+
+
+ + +
+
Level:
+
global, host, path, extension
+
Default:
+
throttle-response: OFF
+
+ + + + +
+ + + diff --git a/web/server/h2o/libh2o/doc/faq.html b/web/server/h2o/libh2o/doc/faq.html new file mode 100644 index 000000000..8ea1f17e2 --- /dev/null +++ b/web/server/h2o/libh2o/doc/faq.html @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + +Frequently Asked Questions - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Frequently Asked Questions +

+ + +

What are the license terms?

+ +
+H2O is licensed under the MIT license. +
+
+Portions of the software use following libraries that are also licensed under the MIT license: khash.h, PicoHTTPParser, libyaml. +
+ +
+Depending on how H2O is configured, the software links against OpenSSL or LibreSSL, both of which are dual-licensed under the OpenSSL License and the original SSLeay license. +
+ +

Are there any design documents?

+ +
+Please refer to the main developer's presentation slides at the HTTP/2 conference, and his weblog. +
+ +

How do I use H2O as a library?

+ +
+

+Aside from the standalone server, H2O can also be used as a software library. +The name of the library is libh2o. +

+

+To build H2O as a library you will need to install the following dependencies: +

+In case the dependencies are installed under a non-standard path, PKG_CONFIG_PATH configuration variable can be used for specifying their paths. For example, the following snippet builds libh2o using the libraries installed in their respective paths. +

+ +
% PKG_CONFIG_PATH=/usr/local/libuv-1.4/lib/pkgconfig:/usr/local/openssl-1.0.2a/lib/pkgconfig cmake .
+% make libh2o
+
+ +

+For more information, please refer to the GitHub issues tagged as libh2o. +

+
+ +

I have a problem. Where should I look for answers?

+ +
+Please refer to the GitHub issues tagged as FAQ. +
+ + + +
+

Notes:

+
    +
  1. libh2o cannot be linked against the bundled LibreSSL; see issue #290
  2. +
+
+ +
+ + + diff --git a/web/server/h2o/libh2o/doc/index.html b/web/server/h2o/libh2o/doc/index.html new file mode 100644 index 000000000..f71f712df --- /dev/null +++ b/web/server/h2o/libh2o/doc/index.html @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + +H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ + + +
+

+H2O is a new generation HTTP server that provides quicker response to users with less CPU utilization when compared to older generation of web servers. +Designed from ground-up, the server takes full advantage of HTTP/2 features including prioritized content serving and server push, promising outstanding experience to the visitors of your web site. +

+ + +
+Explanation of the benchmark charts can be found in the benchmarks page. +

+ +

+
+ +

Key Features

+ + + + + +
+

Notes:

+
    +
  1. chacha20-poly1305: see Do the ChaCha: better mobile performance with cryptography
  2. +
+
+ +
+ + + diff --git a/web/server/h2o/libh2o/doc/install.html b/web/server/h2o/libh2o/doc/install.html new file mode 100644 index 000000000..a42acef28 --- /dev/null +++ b/web/server/h2o/libh2o/doc/install.html @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + +Install - H2O - the optimized HTTP/2 server + + +
+
+ +

+H2O +

+

the optimized HTTP/1.x, HTTP/2 server

+ + +
+ +
+ +
+
+
+Powered by Oktavia +
+
+ + +
+ + + + + + + + + + + + +
+ +

+Install +

+ + +

Installing a Binary Package

+ +

+Thanks to others, H2O is provided as a binary package on some environments. +Therefore you may try to at first install the software using your favorite packaging system, and then resort to installing from source as described below. +

+ +

+At the time being, following packages are known to be actively maintained1: +

+

+ +

Installing from Source

+ +

+Download a release version from the releases page or clone the master branch from the source repository, and build it using CMake2. +

+ +
% cmake -DWITH_BUNDLED_SSL=on .
+% make
+% sudo make install
+
+ +

+When complete, H2O will be installed under /usr/local. +

+ +

+Start the installed server using the example configuration to confirm that it actually works (note: without the use of -m option the server runs as a foreground process; press Ctrl-C to stop). +

+ +
% /usr/local/bin/h2o -c examples/h2o/h2o.conf
+
+ +

+The example configuration starts a server that listens to port 8080 (HTTP) and port 8081 (HTTPS). Try to access the ports using the protocols respectively (note: when accessing via HTTPS it is likely that you would see hostname mismatch errors reported by the web browsers). +

+ +

+When complete, proceed to Configure section for how to setup the server. +

+ +

CMake Options

+ +

+Following list shows the interesting arguments recognized by CMake. + +

+
-DCMAKE_INSTALL_PREFIX=directory
+
+This option specifies the directory to which H2O will be installed (default: /usr/local). +
+
-DWITH_BUNDLED_SSL=on|off
+
+This option instructs whether or not to use LibreSSL being bundled (default: off if OpenSSL version >= 1.0.2 is found, on if otherwise). Read the section below for comparison between OpenSSL and LibreSSL. +
+
-DWITH_MRUBY=on|off
+
+This option instructs whether or not to build the standalone server with support for scripting using mruby. +It is turned on by default if the prerequisites (bison, ruby and the development files3) are found. +
+

+ +

Installing from Source, using OpenSSL

+ +

+Generally speaking, we believe that using LibreSSL is a better choice for running H2O, since LibreSSL not only is considered to be more secure than OpenSSL but also provides support for new ciphersuites such as chacha20-poly1305 which is the preferred method of Google Chrome4. However, it is also true that LibreSSL is slower than OpenSSL on some benchmarks. So if you are interested in benchmark numbers, using OpenSSL is a reasonable choice. +

+ +

+The difficulty in using OpenSSL is that the HTTP/2 specification requires the use of an extension to the TLS protocol named ALPN, which has only been supported since OpenSSL 1.0.25. Therefore it is highly likely that you would need to manually install or upgrade OpenSSL on your system. +

+ +

+Once you have installed OpenSSL 1.0.2, it is possible to build H2O that links against the library. As an safeguard it is advised to use -DWITH_BUNDLED_SSL set to off, so that the server would not accidentally link against the bundled LibreSSL. +CMake will search for OpenSSL by looking at the default search paths. +

+ +
% cmake -DWITH_BUNDLED_SSL=off
+% make
+% sudo make install
+
+ +

+Two ways exist to specify the directory in which CMake should search for OpenSSL. +The preferred approach is to use the PKG_CONFIG_PATH environment variable. +

+ +
% PKG_CONFIG_PATH=/usr/local/openssl-1.0.2/lib/pkgconfig cmake -DWITH_BUNDLED_SSL=off
+% make
+% sudo make install
+
+ +

+In case your OpenSSL installation does not have the lib/pkgconfig directory, you may use OPENSSL_ROOT_DIR environment variable to specify the root directory of the OpenSSL being installed. However, it is likely that CMake version 3.1.2 or above is be required when using this approach6. +

+ +
% OPENSSL_ROOT_DIR=/usr/local/openssl-1.0.2 cmake -DWITH_BUNDLED_SSL=off
+% make
+% sudo make install
+
+ + + +
+

Notes:

+
    +
  1. Please open a new issue on Github if you want a new package to get added.
  2. +
  3. CMake is a popular build tool that can be found as a binary package on most operating systems.
  4. +
  5. mkmf - a program for building ruby extensions is required. In many distributions, the program is packaged as part of ruby-dev or ruby-devel package.
  6. +
  7. ref: Do the ChaCha: better mobile performance with cryptography
  8. +
  9. It is possible to build H2O using prior versions of OpenSSL, but some (if not all) web browsers are known for not using HTTP/2 when connecting to servers configured as such.
  10. +
  11. ref: h2o issue #277, CMake issue 0015386
  12. +
+
+ +
+ + + diff --git a/web/server/h2o/libh2o/doc/search/jquery-1.9.1.min.js b/web/server/h2o/libh2o/doc/search/jquery-1.9.1.min.js new file mode 100644 index 000000000..006e95310 --- /dev/null +++ b/web/server/h2o/libh2o/doc/search/jquery-1.9.1.min.js @@ -0,0 +1,5 @@ +/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license +//@ sourceMappingURL=jquery.min.map +*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
a",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="
t
",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; +return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="
",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X
","
"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) +}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("