Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

ngx_http_process_header_line function in source code (no replies)

$
0
0
Hi,
I'm browsing through the source code of the project, and looked at ngx_http_request.c where the function ngx_http_process_header_line() creates a pointer to a pointer to a large struct(ngx_http_request_t) containing a smaller one(ngx_http_headers_in_t), containing yet another one.

ngx_http_process_header_line(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset) {
ph = (ngx_table_elt_t **) ((char *) &r->headers_in + offset);
// ... then check if ph is NULL, and if so point it to h
}


Why is it done in this way? It seems quite complex and error prone, doesen't it?
Is there any reason something like this wasn't done instead?

(where range are ONE of those structures in headers_in that are a ngx_table_elt_t)
if(r->headers_in->range == NULL) {
r->headers_in->range = h;
}

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>