Download EVB-B1 User's Manual

Transcript
EVB-B1 User ’s Manual
proc_http()
Declare & Initialize Local Variables
prog_char* contents
char* name, param
u_int file_len, send_len
http_response = (u_cha*) TX_BUF
Analyze the HTTP request
parse_http_reqeust(&request,buf)
request.Method == METHOD_ERR
METHOD_HEAD
METHOD_GET
Y
Y
METHOD_POST
Y
N
RETURN
Y
Send Reqeust Error Page
send(ERROR_REQUEST_PAGE)
Extract a Name in URI
name = get_http_uri_name(http_request)
RETURN
name == /
Y
name = index.html
N
Find a type of the request
find_http_uri_type(&request.TYPE,name)
N
request.TYPE == PTYPE_CGI
Y
name == NETCONFIG.CGI
Y
N
Y
Processing
name == LCDNLED.CGI
NETCONF.CGI
N
Processing
LCDNLED.CGI
Find a file in the ROMFILE
search_file(name,&content,&file_len)
N
Send Unknown Page
send(ERROR_HTML_PAGE)
Be found the file?
Y
Make the ResonseHead for the request.TYPE
make_http_response_head(http_response,reqeust.TYPE,len)
Send the HTTP Response Header
send(http_response)
N
RETURN
file_len > 0
Y
file_len > TX_RX_MAX_BUF_SIZE
N
send_file = file_len
Y
send_file = TX_RX_MAX_BUF_SIZE -1
Copy content To http_response
Replace System Environment Variables
send_len = replace_sys_env_value()
Y
request.TYPE == PTYPE_HTML
N
Send a HTTP Response Body
send(http_response)
content += send_len
file_len -= send_len
<Fig 3.19: proc_http()>
60
© Copyright 2006 WIZnet Co., Inc. All rights reserved.