Welcome! Log In Create A New Profile

Advanced

Re: Knowing the server port inside Perl code

Maxim Dounin
May 02, 2018 07:10AM
Hello!

On Tue, May 01, 2018 at 08:47:15AM +0200, Ondrej Jombik wrote:

> When using mail module for SMTP and doing auth using Perl code, it might
> be handy to know entry port number. For example 25/TCP, 465/TCP or
> 587/TCP; those are the most used ones.
>
> I thought this would be somewhere among provided headers:
>
> $request->header_in('Auth-Method');
> $request->header_in('Auth-Protocol');
> $request->header_in('Auth-User');
> $request->header_in('Auth-Pass');
> $request->header_in('Auth-Salt');
> $request->header_in('Client-IP');
> $request->header_in('Client-Host');
> [... ...]
>
> However there is nothing like 'Auth-Port', or 'Client-Port' or
> 'Server-Port' or any port.
>
> 'Auth-Protocol' is no help, because we have same protocol running on
> multiple ports; typically 25/TCP is the same as 587/TCP when sending
> e-mails with auth.
>
> So I tried to help myself:
>
> proxy on;
> auth_http_header Auth-Port $server_port;
> auth_http 127.0.0.1:80/auth;
> proxy_pass_error_message on;
>
> - or -
>
> auth_http_header Auth-Port $proxy_port;
>
> But none of those worked.
>
> How I can know entry port number inside Perl code?

If you really want to know server port, you can get one by
configuring different auth_http_header in server{} blocks
listening on different ports.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Knowing the server port inside Perl code

Ondrej Jombik May 01, 2018 02:48AM

Re: Knowing the server port inside Perl code

Maxim Dounin May 02, 2018 07:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 161
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready