Welcome! Log In Create A New Profile

Advanced

Re: [PATCH 2 of 2] HTTP: removed unused r->port_start

Vladimir Homutov via nginx-devel
November 29, 2023 03:22AM
On Tue, Nov 28, 2023 at 05:57:39AM +0300, Maxim Dounin wrote:
> Hello!
>
> On Fri, Nov 10, 2023 at 12:11:55PM +0300, Vladimir Homutov via nginx-devel wrote:
>
> >
> > It is no longer used since the refactoring in 8e5bf1bc87e2 (2008).
>
> Neither r->port_start nor r->port_end were ever used.
>
> The r->port_end is set by the parser, though it was never used by
> the following code (and was never usable, since not copied by the
> ngx_http_alloc_large_header_buffer() without r->port_start set).
>
> The 8e5bf1bc87e2 commit is completely unrelated, it is about
> refactoring of the ngx_parse_inet_url() function, which had a
> local variable named "port_start".

exactly, thanks for noticing.

>
> >
> > diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
> > --- a/src/http/ngx_http_request.c
> > +++ b/src/http/ngx_http_request.c
> > @@ -1744,8 +1744,7 @@ ngx_http_alloc_large_header_buffer(ngx_h
> > }
> > }
> >
> > - if (r->port_start) {
> > - r->port_start = new + (r->port_start - old);
> > + if (r->port_end) {
> > r->port_end = new + (r->port_end - old);
> > }
> >
> > diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
> > --- a/src/http/ngx_http_request.h
> > +++ b/src/http/ngx_http_request.h
> > @@ -597,7 +597,6 @@ struct ngx_http_request_s {
> > u_char *schema_end;
> > u_char *host_start;
> > u_char *host_end;
> > - u_char *port_start;
> > u_char *port_end;
> >
> > unsigned http_minor:16;
>
> I don't think it's a good change. Rather, we should either remove
> both, or (eventually) fix these and provide some valid usage of
> the port as parsed either from the request line or from the Host
> header, similarly to the $host variable.
>

I think that we should remove both, as unused code still needs to be
maintained without any advantage, as this example shows.
Restoring it will be trivial, if ever required.



_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 2 of 2] HTTP: removed unused r->port_start

Vladimir Homutov via nginx-devel 394 November 10, 2023 04:14AM

Re: [PATCH 2 of 2] HTTP: removed unused r->port_start

Maxim Dounin 77 November 27, 2023 09:58PM

Re: [PATCH 2 of 2] HTTP: removed unused r->port_start

Vladimir Homutov via nginx-devel 73 November 29, 2023 03:22AM

Re: [PATCH 2 of 2] HTTP: removed unused r->port_start

Maxim Dounin 92 November 29, 2023 08:14PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 128
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready