MESSAGE
DATE | 2020-12-22 |
FROM | Mithun Bhattacharya
|
SUBJECT | Re: [Hangout - NYLXS] Confused about two development utils
|
From hangout-bounces-at-nylxs.com Fri Jan 1 11:10:18 2021 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www2.mrbrklyn.com (www2.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 25489164050; Fri, 1 Jan 2021 11:10:18 -0500 (EST) X-Original-To: hangout-at-www2.mrbrklyn.com Delivered-To: hangout-at-www2.mrbrklyn.com Received: by mrbrklyn.com (Postfix, from userid 1000) id 2EAB8164034; Fri, 1 Jan 2021 11:08:56 -0500 (EST) Resent-From: Ruben Safir Resent-Date: Fri, 1 Jan 2021 11:08:56 -0500 Resent-Message-ID: <20210101160856.GA15013-at-www2.mrbrklyn.com> Resent-To: hangout-at-mrbrklyn.com X-Original-To: ruben-at-mrbrklyn.com Delivered-To: ruben-at-mrbrklyn.com Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by mrbrklyn.com (Postfix) with ESMTP id BA72F164000 for ; Tue, 22 Dec 2020 20:08:36 -0500 (EST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id 5C66D47188 for ; Wed, 23 Dec 2020 01:08:36 +0000 (UTC) Received: (qmail 70816 invoked by uid 500); 23 Dec 2020 01:08:35 -0000 Mailing-List: contact modperl-help-at-perl.apache.org; run by ezmlm Precedence: bulk Delivered-To: mailing list modperl-at-perl.apache.org Received: (qmail 70805 invoked by uid 99); 23 Dec 2020 01:08:34 -0000 Received: from spamproc1-he-fi.apache.org (HELO spamproc1-he-fi.apache.org) (95.217.134.168) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Dec 2020 01:08:34 +0000 Received: from localhost (localhost [127.0.0.1]) by spamproc1-he-fi.apache.org (ASF Mail Server at spamproc1-he-fi.apache.org) with ESMTP id 29364C049E for ; Wed, 23 Dec 2020 01:08:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamproc1-he-fi.apache.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.2, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamproc1-he-fi.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-ec2-va.apache.org ([116.203.227.195]) by localhost (spamproc1-he-fi.apache.org [95.217.134.168]) (amavisd-new, port 10024) with ESMTP id OurUuH5AhQMs for ; Wed, 23 Dec 2020 01:08:33 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.222.50; helo=mail-ua1-f50.google.com; envelope-from=mithnb-at-gmail.com; receiver= Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) by mx1-ec2-va.apache.org (ASF Mail Server at mx1-ec2-va.apache.org) with ESMTPS id CA9CBBCC20 for ; Wed, 23 Dec 2020 01:08:32 +0000 (UTC) Received: by mail-ua1-f50.google.com with SMTP id t15so4952954ual.6 for ; Tue, 22 Dec 2020 17:08:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=VC03JgNq3qhnjXHnafl1aghPQAKNAJDnL2JlYVzLUVM=; b=B/DHRkCWG9tFuZv2SGvDkPbSo6a5IVq3bhKQ10gTI4RjPP38W0RVxfX8zU1gL+8rYM /JyerVbi+dGV3S8rlaaz8TBbcycdpPQIpQKqcBmzL/Bjppnm5SwApPHyZCcgaXBMdNgg iWn6mkoAENGwlO1YFJvWGnZLebYap7gU43VD/2h2n1MfQ3AzKFSm3qd7ZZMa/sEI0koS ZimB+AboRRgLvqFCW7X5qcOHTRWivXU74QwvNkBk3iYANqHhvKE+paMyp/kowxa2Vvf6 LutkCNmXHkg6+t7+nEMYdleX+L+/VrYcSeC40TyVadbWsbHC+tH8E+H8lQJub4mLczsd kM/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=VC03JgNq3qhnjXHnafl1aghPQAKNAJDnL2JlYVzLUVM=; b=dO2yYpesnRruq0OPCFZ3kgZjIsCOmMmj2M+Vh6e6pF0r+hA5hk6BbSmG7IkT4xspzk w8Myo3h3Unl3P6hndqLtZ85RRmUnAuQDGIOrU1cPhbt0ouZcd8DV43tarMx3ePJqPCQm /QRxbTjr3aLk6oAA3Udq7hAEbDOlzmMe156ZhtSao4I3xajwrGdntyVQDwle/l4+IhkM C30sFCb+onT72LneDoJt2F0ViHqEVDtWVVrDGquV0X0/FjLR/TkdrugEur94bxSxrRFs E7u2DgBJ8zrwZfuPgvJ0pzdg7LgzXKO3E7nD+L2JZjXKdYF325YjcghY9CyYyumU6ZKX T1Rw== X-Gm-Message-State: AOAM5313/kwIs47J1gwyGykRzz7UGT4n+xSNXDU2Uwzc9NCKfmsndkjh QJomocMMitFrhVydGNVpJw0Olcec9ObIfFU8nAh7gZQk X-Google-Smtp-Source: ABdhPJyGpfOKfNoHZNuzpTJRzieafsUeIRU6DK7I/wiH355DE1TgONXfTXrzrU6rhc/rl2XYg6rrc5RHsT5lUtnxIfs= X-Received: by 2002:ab0:6703:: with SMTP id q3mr17008862uam.93.1608685706528; Tue, 22 Dec 2020 17:08:26 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Mithun Bhattacharya Date: Tue, 22 Dec 2020 19:08:15 -0600 Message-ID: To: mod_perl list Subject: Re: [Hangout - NYLXS] Confused about two development utils X-BeenThere: hangout-at-nylxs.com X-Mailman-Version: 2.1.30rc1 List-Id: NYLXS Tech Talk and Politics List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1502146583==" Errors-To: hangout-bounces-at-nylxs.com Sender: "Hangout"
--===============1502146583== Content-Type: multipart/alternative; boundary="00000000000017cb6a05b71754bb"
--00000000000017cb6a05b71754bb Content-Type: text/plain; charset="UTF-8"
Replying to the DL.
On Tue, Dec 22, 2020 at 7:07 PM Mithun Bhattacharya wrote:
> $r->connection->client_ip would report your proxy server if you have a > reverse proxy setup - this is not a common use case though. > > DNS lookup would usually be an expensive process and you are supposed to > be nice to other services so cache it for the TTL of the PTR record. > > On Tue, Dec 22, 2020 at 6:44 PM Matthias Peng > wrote: > >> I am a newbie to mp development stack. >> After one day of work, I have made a simple handler, which returns the >> client's address and its PTR record. >> The demo: >> https://myhostnames.com/ >> >> The code shown below: >> >> package MyHostname; >> >> >> use strict; >> >> use Net::DNS; >> >> use Apache2::RequestRec (); >> >> use Apache2::RequestIO (); >> >> use Apache2::Connection (); >> >> use APR::Table (); >> >> use Apache2::Const -compile => qw(OK FORBIDDEN); >> >> >> >> sub handler { >> >> >> my $r = shift; >> >> my $ip = $r->headers_in->{'CF-Connecting-IP'} || >> $r->connection->client_ip; >> >> >> my $host = dns_query($ip) || ""; >> >> >> $r->content_type('text/plain; charset=utf-8'); >> >> $r->print("Your IP: $ip, Hostname: $host"); >> >> >> return Apache2::Const::OK; >> >> } >> >> >> >> sub dns_query { >> >> my $ip = shift; >> >> my $resolver = Net::DNS::Resolver->new(); >> >> my $reply = $resolver->query($ip, 'PTR'); >> >> >> if ($reply) { >> >> for my $rr ($reply->answer) { >> >> return $rr->rdstring; # we need only one >> >> } >> >> } >> >> >> return; >> >> } >> >> >> >> 1; >> >> >> >> Can anyone give your review? Thanks in advance. >> >> >> Matthias >> >> >> >> >> On Tue, Dec 22, 2020 at 1:49 PM Matthias Peng >> wrote: >> >>> Hello >>> >>> I am developing a simple mp2 application. >>> I looked for the installation for mp2 utils, and found this two: >>> >>> libapache2-mod-perl2 >>> >>> libapache2-mod-apreq2 >>> >>> >>> what're their relations? Should I install both, or only the first one? >>> >>> >>> Thanks. >>> >>
--00000000000017cb6a05b71754bb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Replying to the DL.
iv dir=3D"ltr" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 7:07 PM Mithun = Bhattacharya <mithnb-at-gmail.com&g= t; wrote:
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">ir=3D"ltr">$r->connection->client_ip would report your proxy server i= f you have a reverse proxy setup - this is not a common use case though. >
DNS lookup would usually be an expensive process and y= ou are supposed to be nice=C2=A0to=C2=A0other services so cache it for the = TTL of the PTR record.
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin= g-left:1ex">I am a newbie to mp development stack. Aft= er=C2=A0one day of work, I have made a simple handler, which returns the cl= ient's address and its PTR record. The demo:
The code shown below: =3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family= :Menlo;font-size:11px">
gatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11= px">package MyHostname; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use strict; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Net::DNS; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestRec (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestIO (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Connection (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use APR::Table (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Const -compile =3D> qw(OK FORBIDDEN); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub handler { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $r =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D $r->headers_in->{'CF-= Connecting-IP'} ||=C2=A0 $r->connection->client_ip;<= /span> normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $host =3D dns_query($ip) || ""= ;; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->content_type('text/plain; chars= et=3Dutf-8'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->print("Your IP: $ip, Hostname:= $host"); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return Apache2::Const::OK; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub dns_query { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $resolver =3D Net::DNS::Resolver->ne= w(); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $reply =3D $resolver->query($ip, = 9;PTR'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 if ($reply) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 for my $rr ($reply->answe= r) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return $rr->= ;rdstring;=C2=A0 # we need only one normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">1; variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no= rmal;font-family:Menlo;color:rgb(0,0,0)">res:no-common-ligatures">
-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-siz= e:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">
margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-= stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rg= b(0,0,0)">Can an= yone give your review? Thanks in advance. font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:nor= mal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><= span style=3D"font-variant-ligatures:no-common-ligatures">
style=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:no= rmal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menl= o;color:rgb(0,0,0)">es">Matthias ont-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-heigh= t:normal;font-family:Menlo;color:rgb(0,0,0)">gatures:no-common-ligatures">
lass=3D"gmail_quote"> te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px = solid rgb(204,204,204);padding-left:1ex">Hello iv> I am developing a simple mp2 application. I looked for th= e installation for mp2 utils, and found this two:
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">libapache2-mod-perl2 meric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:1= 1px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">ont-variant-ligatures:no-common-ligatures">
east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;fon= t-family:Menlo;color:rgb(0,0,0)">ommon-ligatures">libapache2-mod-apreq2 t-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal= ;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">n style=3D"font-variant-ligatures:no-common-ligatures">
yle=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:norma= l;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;c= olor:rgb(0,0,0)">>what're their=C2=A0relations? Should=C2=A0I install both, or only the = first one? t-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:= normal;font-family:Menlo;color:rgb(0,0,0)">tures:no-common-ligatures">
nt-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-s= ize:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">Thanks. iv>
--00000000000017cb6a05b71754bb--
--===============1502146583== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Hangout mailing list Hangout-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/hangout
--===============1502146583==--
--===============1502146583== Content-Type: multipart/alternative; boundary="00000000000017cb6a05b71754bb"
--00000000000017cb6a05b71754bb Content-Type: text/plain; charset="UTF-8"
Replying to the DL.
On Tue, Dec 22, 2020 at 7:07 PM Mithun Bhattacharya wrote:
> $r->connection->client_ip would report your proxy server if you have a > reverse proxy setup - this is not a common use case though. > > DNS lookup would usually be an expensive process and you are supposed to > be nice to other services so cache it for the TTL of the PTR record. > > On Tue, Dec 22, 2020 at 6:44 PM Matthias Peng > wrote: > >> I am a newbie to mp development stack. >> After one day of work, I have made a simple handler, which returns the >> client's address and its PTR record. >> The demo: >> https://myhostnames.com/ >> >> The code shown below: >> >> package MyHostname; >> >> >> use strict; >> >> use Net::DNS; >> >> use Apache2::RequestRec (); >> >> use Apache2::RequestIO (); >> >> use Apache2::Connection (); >> >> use APR::Table (); >> >> use Apache2::Const -compile => qw(OK FORBIDDEN); >> >> >> >> sub handler { >> >> >> my $r = shift; >> >> my $ip = $r->headers_in->{'CF-Connecting-IP'} || >> $r->connection->client_ip; >> >> >> my $host = dns_query($ip) || ""; >> >> >> $r->content_type('text/plain; charset=utf-8'); >> >> $r->print("Your IP: $ip, Hostname: $host"); >> >> >> return Apache2::Const::OK; >> >> } >> >> >> >> sub dns_query { >> >> my $ip = shift; >> >> my $resolver = Net::DNS::Resolver->new(); >> >> my $reply = $resolver->query($ip, 'PTR'); >> >> >> if ($reply) { >> >> for my $rr ($reply->answer) { >> >> return $rr->rdstring; # we need only one >> >> } >> >> } >> >> >> return; >> >> } >> >> >> >> 1; >> >> >> >> Can anyone give your review? Thanks in advance. >> >> >> Matthias >> >> >> >> >> On Tue, Dec 22, 2020 at 1:49 PM Matthias Peng >> wrote: >> >>> Hello >>> >>> I am developing a simple mp2 application. >>> I looked for the installation for mp2 utils, and found this two: >>> >>> libapache2-mod-perl2 >>> >>> libapache2-mod-apreq2 >>> >>> >>> what're their relations? Should I install both, or only the first one? >>> >>> >>> Thanks. >>> >>
--00000000000017cb6a05b71754bb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Replying to the DL.
iv dir=3D"ltr" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 7:07 PM Mithun = Bhattacharya <mithnb-at-gmail.com&g= t; wrote:
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">ir=3D"ltr">$r->connection->client_ip would report your proxy server i= f you have a reverse proxy setup - this is not a common use case though. >
DNS lookup would usually be an expensive process and y= ou are supposed to be nice=C2=A0to=C2=A0other services so cache it for the = TTL of the PTR record.
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin= g-left:1ex">I am a newbie to mp development stack. Aft= er=C2=A0one day of work, I have made a simple handler, which returns the cl= ient's address and its PTR record. The demo:
The code shown below: =3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family= :Menlo;font-size:11px">
gatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11= px">package MyHostname; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use strict; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Net::DNS; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestRec (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::RequestIO (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Connection (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use APR::Table (); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">use Apache2::Const -compile =3D> qw(OK FORBIDDEN); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub handler { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $r =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D $r->headers_in->{'CF-= Connecting-IP'} ||=C2=A0 $r->connection->client_ip;<= /span> normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $host =3D dns_query($ip) || ""= ;; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->content_type('text/plain; chars= et=3Dutf-8'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 $r->print("Your IP: $ip, Hostname:= $host"); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return Apache2::Const::OK; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">sub dns_query { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $ip =3D shift; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $resolver =3D Net::DNS::Resolver->ne= w(); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 my $reply =3D $resolver->query($ip, = 9;PTR'); normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 if ($reply) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 for my $rr ($reply->answe= r) { normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return $rr->= ;rdstring;=C2=A0 # we need only one normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 =C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 } normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">=C2=A0 =C2=A0 return; normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">} normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0);min-height:13px">:no-common-ligatures">
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">1; variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no= rmal;font-family:Menlo;color:rgb(0,0,0)">res:no-common-ligatures">
-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-siz= e:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">
margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-= stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rg= b(0,0,0)">Can an= yone give your review? Thanks in advance. font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:nor= mal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><= span style=3D"font-variant-ligatures:no-common-ligatures">
style=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:no= rmal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menl= o;color:rgb(0,0,0)">es">Matthias ont-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-heigh= t:normal;font-family:Menlo;color:rgb(0,0,0)">gatures:no-common-ligatures">
lass=3D"gmail_quote"> te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px = solid rgb(204,204,204);padding-left:1ex">Hello iv> I am developing a simple mp2 application. I looked for th= e installation for mp2 utils, and found this two:
normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Me= nlo;color:rgb(0,0,0)">ures">libapache2-mod-perl2 meric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:1= 1px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">ont-variant-ligatures:no-common-ligatures">
east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;fon= t-family:Menlo;color:rgb(0,0,0)">ommon-ligatures">libapache2-mod-apreq2 t-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal= ;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">n style=3D"font-variant-ligatures:no-common-ligatures">
yle=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:norma= l;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;c= olor:rgb(0,0,0)">>what're their=C2=A0relations? Should=C2=A0I install both, or only the = first one? t-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:= normal;font-family:Menlo;color:rgb(0,0,0)">tures:no-common-ligatures">
nt-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-s= ize:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">=3D"font-variant-ligatures:no-common-ligatures">Thanks. iv>
--00000000000017cb6a05b71754bb--
--===============1502146583== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Hangout mailing list Hangout-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/hangout
--===============1502146583==--
|
|