lighttpd base.h 代码阅读笔记 (不断完善中。。。)
sock_addr : union , 此联合是一个能处理IPV4和IPV6和UNIX域套接字的结构。类似于 struct sockaddr 结构体。一般此联合用于存储连接双方的IP地址。
request : typedef struct {…} request , lighttpd存储远程请求的结构体。在一个请求处理完成之前些结构体一直存活,生命周期是在一次请求。此结构体放在下面要说明的 server结构中。结构体成员说明:
[code type="c"]
typedef struct {
/** HEADER */
/* the request-line */
buffer *request; //请求原始数据缓冲区
buffer *uri; //请求地址:
buffer *orig_uri; //这与上面的地址的区别是什么呢?大多数时候都相同。在什么时候不相同呢?
http_method_t http_method; //请求方法:为 GET POST , HEAD
http_version_t http_version; //请求版本:1.0 , 1.1
buffer *request_line; //指的是request头信息中的第一行,GET /path/xxx.html HTTP/1.1这行。
/* strings to the header */
buffer *http_host; /* not alloced */
const char *http_range;
const char *http_content_type;
const char *http_if_modified_since;
const char *http_if_none_match;
array *headers; //这个我猜着应该是把request的缓冲区块分割为多行了吧
/* CONTENT */
size_t content_length; /* returned by strtoul() */ //这个是在POST方法时才有的吧。
/* internal representation */
int accept_encoding;
/* internal */
buffer *pathinfo; //URL重写信息
} request;
[/code]
posted on 2010-06-18 21:28 drswinghead 阅读(98) 评论(0) 编辑 收藏 举报