Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B5DD9200CDD for ; Mon, 7 Aug 2017 18:53:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B4629165A56; Mon, 7 Aug 2017 16:53:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 06698165A54 for ; Mon, 7 Aug 2017 18:53:37 +0200 (CEST) Received: (qmail 85528 invoked by uid 500); 7 Aug 2017 16:53:37 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 85518 invoked by uid 99); 7 Aug 2017 16:53:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Aug 2017 16:53:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 539271807E4 for ; Mon, 7 Aug 2017 16:53:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.301 X-Spam-Level: X-Spam-Status: No, score=-2.301 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id KAWX3pZWELDV for ; Mon, 7 Aug 2017 16:53:29 +0000 (UTC) Received: from unix.inter-corporate.com (unix.inter-corporate.com [65.110.3.188]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 08F4260D17 for ; Mon, 7 Aug 2017 16:53:26 +0000 (UTC) Received: by unix.inter-corporate.com (Postfix, from userid 1006) id D42CA6898372; Mon, 7 Aug 2017 09:53:16 -0700 (PDT) X-Envelope-To: modperl@perl.apache.org Received: from [10.88.0.6] (unknown [96.53.47.42]) (Authenticated sender: randolf.modperl.pl) by unix.inter-corporate.com (Postfix) with ESMTPA id BD0E66898036 for ; Mon, 7 Aug 2017 09:53:16 -0700 (PDT) (envelope-from randolf@modperl.pl) From: "Randolf Richardson" Organization: Inter-Corporate Computer & Network Services To: modperl@perl.apache.org Date: Mon, 07 Aug 2017 09:53:16 -0700 MIME-Version: 1.0 Subject: Re: about request route ($r->path_info) Reply-to: randolf@modperl.pl Message-ID: <59889AFC.10527.6C1B2826@randolf.modperl.pl> Priority: normal In-reply-to: <1502104698.1926373.1065460240.52E83CEE@webmail.messagingengine.com> References: <1502104698.1926373.1065460240.52E83CEE@webmail.messagingengine.com> X-mailer: Pegasus Mail for Windows (4.72.572) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body archived-at: Mon, 07 Aug 2017 16:53:38 -0000 In your "httpd.conf" file (for your VirtualHost if you're using virtual hosts) you'll need to add this line: AcceptPathInfo On Then you may find the documentation surrounding $r->path_info to be of particular interest, which you can read about here: https://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_path_info_ I use this to implement simple URIs on sites that look like "/profile/29862938728" instead of "/profile?id=29862938728" to make it easier for users to share links. Based on your question, it seems to me that you're wanting to know how to do something like this. Of course, you'll need to write your own Perl code to handle these requests, and I suspect that's likely what you're wanting to do. One thing I find very helpful in having done this myself is the use of the 404 response code when the data is wrong (e.g., the profile ID number does not exist in the database) because then the web server just passes everything along to whatever I have configured separately for the 404 handler (this is important because it properly communicates to search engine spiders and other automated systems that the page doesn't exist and should be ignored). > Hi, > > for this like request: > curl http://dns-api.org/AAAA/dns-api.org > > in Dancer we could write: > > get '/:type/:domain/?' => sub { > > my $rtype = params->{ 'type' }; > my $domain = params->{ 'domain' }; > > > But in a MP handler, how could we get the similiar result, treating > request path as GET/POST arguments? > thanks. > Randolf Richardson - randolf@inter-corporate.com Inter-Corporate Computer & Network Services, Inc. Beautiful British Columbia, Canada http://www.inter-corporate.com/