nginx_conf_read_token
2016-08-21 16:32:54 6 举报
AI智能生成
ngx_conf_read_token
作者其他创作
大纲/内容
读取size个字节到缓存
当pos>=last时,缓存处理完成
配置文件处理完成
继续读取配置文件
ch = *b->pos++
逐个字符进行解析
ch=='\n'
conf_file->line++
comment!=0
comment=0
comment==1
continue
quota==1
quota = 0
continue
need_space
default = 0
need_space==1
ch==' '||ch=='\t'||ch==CR||ch==LF
last_space=1
need_space=0
continue
ch==';'
return NGX_OK
ch=='{'
return NGX_CONF_BLOCK_START;
ch==')'
last_space = 1
need_space = 0
last_space
default = 1
last_space==1
ch==' '||ch=='\t'||ch==CR||ch==LF
continue
start = b->pos - 1
ch==';'
retrun NGX_OK
ch=='#'
comment=1
continue;
ch=='{'
return NGX_CONF_BLOCK_START
ch=='}'
return NGX_CONF_BLOCK_DONE
ch=='\\'
quoted=1
last_space=0
continue
ch=='\''
start++
s_quoted=1
last_space=0
continue
ch=='"'
start++
last_space=0
continue
default
此处读取到配置项第一个字符
last_space=0
last_space==0
ch=='{'&&variable==1
continue
variable = 0
ch=='\\'
quoted=1
continue
ch=='$'
variable=1
continue
d_quoted==1&&ch=='"'
d_quoted=0
need_space=1
found=1
s_quoted==1&&ch=='\''
s_quoted=0
need_space=1
found=1
ch == ' ' || ch == '\t' || ch == CR || ch == LF || ch == ';' || ch == '{'
空格、制表符、回车、换行,为读取配置中的一项
分号为读取到完整的配置
大括号为读取到配置块
last_space=1
found=1
found==1
从cf->args数组中取一个ngx_str_t存储数据
根据start和b->pos确定数据存储长度
将数据存储到数组中
对原始数据中的转义字符处理
ch==';'
return NGX_OK
ch=='{'
return NGX_CONF_BLOCK_START
found=0
0 条评论
下一页