From modules-dev-return-5239-archive-asf-public=cust-asf.ponee.io@httpd.apache.org Tue May 14 18:54:27 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 659AD180675 for ; Tue, 14 May 2019 20:54:27 +0200 (CEST) Received: (qmail 31342 invoked by uid 500); 14 May 2019 18:54:26 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 31296 invoked by uid 99); 14 May 2019 18:54:26 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2019 18:54:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 5DDB2C61B0 for ; Tue, 14 May 2019 18:54:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.19 X-Spam-Level: X-Spam-Status: No, score=-0.19 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id xSsZPyreqs7X for ; Tue, 14 May 2019 18:54:23 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id E2F1B5F283 for ; Tue, 14 May 2019 18:54:23 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id n25so147614wmk.4 for ; Tue, 14 May 2019 11:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=+8o6uFDhMYjD+0+bB07WSSqhc85mKj93w1pyLxNj0OQ=; b=EicGOoeZOeYhOHeJxo90HDwi/V/NznXSudFmNF3Q6OjFjD8512eYNO10L5ELdQfdzJ qH0m6apfdL8VltcbVnG52vRBcpjD67SMt2SfpUWCxxYm7WLDqcwoJq608Di2lzuEwPWB NQBfJ7/jcXCPxaHo6rtfKg/Jl6StpGxb9KF1bAr16Nxit1hdVaOfrjttNZ29wMEWrJmo y0+a63dyl93Lusb3HvcXxhP9eE3qw93hDnQ25qFRq3jhmQdNReDqgrq9UqpgT4GKe7dG kycXCTYxM4Aejjs9Ss/osCWCp6118cxOLu7yvjpYWv0dBooPZD6RXlIA4w+hIpGa93rU nXww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+8o6uFDhMYjD+0+bB07WSSqhc85mKj93w1pyLxNj0OQ=; b=pSNVNUWRg1ElhiIzGmiR6qrX8e6f2yufvHHNnAtwHROvA78zkSp+wxTA2hBlGZ1Snm KPtaRVU5Eg8hAqVTHSv0zLMy/PJbWjdRoY30wCPzks1ByI4szH/5PLIq0Gg57fIhmJB+ T5Uk8KxVegpa5nyDbcR1aJPHozc3hmL9SCTG3HCdDBE+tAixTJZ1QwI2RDHNdm+iV1He jO4GcaYZDh+SwrPlh5Dxmma7BqCDch+5GnwSF5u0w1aXFVYiOZoi9QLM7YFXVkOezx6r S3N1QsEj+aSpnGj34d74zvLwcJCrs2M55rgINwjlHan1zEW82Sh2e/EnprlUFCgBkjZc TOIQ== X-Gm-Message-State: APjAAAWXPuSFAzgwrrlXRzBQ5+D/oR6yyCz2pPBXN/5IfYgsH2NGWm0a GyQMOO8UmDsD3IJzCVdiHLLWdPOt X-Google-Smtp-Source: APXvYqx+mvw8hjsniIHHnFRnFSD8GUqGIpXTOxjqmBKsZMc0PpaLLN4PTuPg/Ye+OHhw58GOnAU/SQ== X-Received: by 2002:a1c:9c42:: with SMTP id f63mr6379020wme.23.1557860063343; Tue, 14 May 2019 11:54:23 -0700 (PDT) Received: from ?IPv6:2a01:e35:8b73:8dd0:762f:68ff:fee5:8d8? ([2a01:e35:8b73:8dd0:762f:68ff:fee5:8d8]) by smtp.googlemail.com with ESMTPSA id l127sm3794713wml.40.2019.05.14.11.54.21 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 11:54:21 -0700 (PDT) Subject: Re: request_rec.unparsed_uri missing scheme and host. parsed_uri missing most fields To: modules-dev@httpd.apache.org References: From: Sorin Manolache Message-ID: Date: Tue, 14 May 2019 20:54:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit On 14/05/2019 20.35, Paul Callahan wrote: > Hello, > I'm having trouble getting the full uri of a request from request_rec. > The comment string for request_rec.unparsed_uri makes it sound like it > should have the entire url, e.g. http:://hostname/path?etc. > > But it only has the path and the query parameters. > > The parsed_uri struct is populated with port, path and query paramters. > Everything else (scheme, hostname, username, password, etc) is null. > > I set a breakpoint in "apr_uri_parse()" and verified the incoming *uri > field only has the path and query parameters. > > Is this expected? How can I get the full URI? Hello, Yes, it is expected. When the client (meaning a program, not a human) makes a request it sends the following first line over the network connection: GET /path?arg1=val1&arg2=val2 HTTP/1.1 (I assume here that it uses the version 1.1 of the HTTP protocol.) In HTTP/1.1 a "Host" header must be present (it is not present in HTTP/1.0 but there is little HTTP/1.0 traffic nowadays) So you might get GET /path?arg1=val1&arg2=val2 HTTP/1.1 Host: www.example.com A browser will decompose the address http://www.example.com/path?arg1=val1&arg2=val2 that you type in its address bar and generate the two text lines shown above. But the server will not receive the string http://www.example.com/path?arg1=val1&arg2=val2 Moreover, http:// or https:// are not sent by the client. It's the server (apache) that determines (reconstructs) the scheme (i.e. http:// or https://) from the port and transport protocol (SSL/TLS or plain text) used by the request. The HTTP RFC (https://tools.ietf.org/html/rfc7230) has more details. Especially section 5.3 might be of interest to you. HTH, Sorin