浏览 1k
作为一个nginx初学者,我最近在上手编写一个类似字符串替换filter模块。其中在阅读其他filter模块的过程中,经常会看到 r != r->main 或 r == r->main 这样的代码,如下所示:
if (r == r->main) {
ngx_http_clear_content_length(r);
if (!slcf->last_modified) {
ngx_http_clear_last_modified(r);
ngx_http_clear_etag(r);
} else {
ngx_http_weak_etag(r);
}
}
一直无法明白类似这段代码的逻辑的目的所在,查阅了各种资料也没有找到答案,特在此向各位大佬请教!