.
: http://www.arcetri.astro.it/manual/ja/mod/mod_proxy_ajp.html
: Mon Jan 21 19:44:30 2013 : Fri Feb 28 07:50:49 2014 : IBM-866 : |
Apache HTTP ²î î¦Á 2.2
: | mod_proxy AJP
²î¦î |
---|---|
µîµ: | Extension |
¦î: | proxy_ajp_module |
îµ: | mod_proxy_ajp.c |
¦î mod_proxy
Apache JServ Protocol version 1.3
( AJP13)
²î
AJP13
ɑ
mod_proxy
mod_proxy_ajp
²î
²î§íʵ îÁ§²îî Áî͑١
AJP13
îÁµ
îÁµԑ
²î²îÁ TCP §Á
ͧ²îÁ
TCP ՐµèµÁµ²
§Á
µ§Áɒ² §Áµ §Áîֵ §Á
²îÁ§Á§Áʴ :
§Áɵµ²Áߡ (
HTTP ) (ՇՐÁî)
µ
µ (content-length > 0)
ߡۇ
µ²îÁ ¨î¦²îȨ
¨î¦Րî µÁµ
XDR µ Ր ( 4 Á)
îî: ÁÁ ÁÁ XDR ه sys/socket (C ) Ѯǡֵ
4 î: byte, boolean, integer, string
1 = true
, 0 = false
(C ) ۴ɑ
0 2^16 (32768)
ےՐ 2
strlen
µсÁÁ
ۦ
Java
ԑServlet Áǡ
ʵ C îۦ²î
\0 C îî
Áµۦ
'\0' C î
²¡
8 * 1024 (8K)
է
Áî
²îÁǡ 0x1234
Á²î AB
(ASCII î A
ASCII î B) îէ ()
îէ 2^16
î 8K
(Server->Container) | |||||
Byte | 0 | 1 | 2 | 3 | 4...(n+3) |
Contents | 0x12 | 0x34 | îէ (n) | Data |
(Container->Server) | |||||
Byte | 0 | 1 | 2 | 3 | 4...(n+3) |
Contents | A | B | îէ (n) | Data |
î¨î¦Áî
²îÁµ
(0x1234
է)
µî
²î¨î¦²îÁǡ
î | | с |
2 | Forward Request | µ²î |
7 | Shutdown | ²îÁÁ |
8 | Ping | ²îÁȴ (¨Áî¡) |
10 | CPing | ²îÁ CPong ́ |
none | Data | ²¡ (2 ) î |
ߡ¨µ§Á
§ÁµÁ Shutdown
Data
Forward Request
ۇ²î
²îÁ²î¨î¦ :
î | | с |
3 | Send Body Chunk | ²îÁ²î (´)Á |
4 | Send Headers | ²îÁ²î (´) µÁµ |
5 | End Response | µÁµ (µ²) ͐ |
6 | Get Body Chunk | µî |
9 | CPong | CPing µ |
¨î¦Ր
²îÁ¨î¦ Forward Request :
AJP13_FORWARD_REQUEST := prefix_code (byte) 0x02 = JK_AJP13_FORWARD_REQUEST method (byte) protocol (string) req_uri (string) remote_addr (string) remote_host (string) server_name (string) server_port (integer) is_ssl (boolean) num_headers (integer) request_headers *(req_header_name req_header_value) attributes *(attribut_name attribute_value) request_terminator (byte) OxFF
request_headers
:
req_header_name := sc_req_header_name | (string) [see below for how this is parsed] sc_req_header_name := 0xA0xx (integer) req_header_value := (string)
§Á :
attribute_name := sc_a_name | (sc_a_req_attribute string) attribute_value := (string)
content-length
Á
µ 2 Prefix î
HTTP 1 Áî :
Command Name | Code |
OPTIONS | 1 |
GET | 2 |
HEAD | 3 |
POST | 4 |
PUT | 5 |
DELETE | 6 |
TRACE | 7 |
PROPFIND | 8 |
PROPPATCH | 9 |
MKCOL | 10 |
COPY | 11 |
MOVE | 12 |
LOCK | 13 |
UNLOCK | 14 |
ACL | 15 |
REPORT | 16 |
VERSION-CONTROL | 17 |
CHECKIN | 18 |
CHECKOUT | 19 |
UNCHECKOUT | 20 |
SEARCH | 21 |
MKWORKSPACE | 22 |
UPDATE | 23 |
LABEL | 24 |
MERGE | 25 |
BASELINE_CONTROL | 26 |
MKACTIVITY | 27 |
ajp13 î¦Á
µ
request_headers
:
Ր num_headers
Áî
req_header_name
/ req_header_value
ʵՇՐÁî
ߡ (է
µ)
sc_req_header_name
î
(̡) :
î | î | |
accept | 0xA001 | SC_REQ_ACCEPT |
accept-charset | 0xA002 | SC_REQ_ACCEPT_CHARSET |
accept-encoding | 0xA003 | SC_REQ_ACCEPT_ENCODING |
accept-language | 0xA004 | SC_REQ_ACCEPT_LANGUAGE |
authorization | 0xA005 | SC_REQ_AUTHORIZATION |
connection | 0xA006 | SC_REQ_CONNECTION |
content-type | 0xA007 | SC_REQ_CONTENT_TYPE |
content-length | 0xA008 | SC_REQ_CONTENT_LENGTH |
cookie | 0xA009 | SC_REQ_COOKIE |
cookie2 | 0xA00A | SC_REQ_COOKIE2 |
host | 0xA00B | SC_REQ_HOST |
pragma | 0xA00C | SC_REQ_PRAGMA |
referer | 0xA00D | SC_REQ_REFERER |
user-agent | 0xA00E | SC_REQ_USER_AGENT |
Java î 2 ՇՐ
͐ '0xA0'
Áµ 0xA0
2 էՇՐ
է 0x9999 (==0xA000 -1)
content-length
®µ ( POST
µ)
ۇµî
?
µ ( ?context
)
í 1 î
(C î
)
§Áµɵî
î :
Information | Code Value | Note |
?context | 0x01 | |
?servlet_path | 0x02 | |
?remote_user | 0x03 | |
?auth_type | 0x04 | |
?query_string | 0x05 | |
?jvm_route | 0x06 | |
?ssl_cert | 0x07 | |
?ssl_cipher | 0x08 | |
?ssl_session | 0x09 | |
?req_attribute | 0x0A | Name (the name of the attribute follows) |
?ssl_key_size | 0x0B | |
are_done | 0xFF | request_terminator |
context
servlet_path
Ϭ C
î¨ Java î
î (î
)
ϒî
§Á
remote_user
auth_type
HTTP îî´î´
( Basic, Digest)
query_string
, ssl_cert
,
ssl_cipher
, ssl_session
HTTP HTTPS
jvm_route
µî¨§Á²î
îÁµՐ²îɵ Tomcat ÁµÁµ
î´¨§Áí
ߡreq_attribute
î 0x0A
ԑ
îۇ
ҐՐֵ
0xFF
ǡϧµ
Á²î¨î¦:
AJP13_SEND_BODY_CHUNK := prefix_code 3 chunk_length (integer) chunk *(byte) AJP13_SEND_HEADERS := prefix_code 4 http_status_code (integer) http_status_msg (string) num_headers (integer) response_headers *(res_header_name header_value) res_header_name := sc_res_header_name | (string) [see below for how this is parsed] sc_res_header_name := 0xA0 (byte) header_value := (string) AJP13_END_RESPONSE := prefix_code 5 reuse (boolean) AJP13_GET_BODY_CHUNK := prefix_code 6 requested_length (integer)
Áߡî´ۇ
µîµî¨î¦ HTTP (
200
OK
)µÁµ
µֵÁî
îֵ header_encoding
î :
î | |
Content-Type | 0xA001 |
Content-Language | 0xA002 |
Content-Length | 0xA003 |
Date | 0xA004 |
Last-Modified | 0xA005 |
Location | 0xA006 |
Set-Cookie | 0xA007 |
Set-Cookie2 | 0xA008 |
Servlet-Engine | 0xA009 |
Status | 0xA00A |
WWW-Authenticate | 0xA00B |
îۇÁî
µ²reuse
(==1)
Ϭ TCP §Á
µreuse
(C î
1 ) §Á
(²¡
µÁ) Áµ
î²î
request_length
(8186 (8 Kbytes - 6))
ےµî
î (²î
) ²î
îէ 0 (0x12,0x34,0x00,0x00)