Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122102 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24920 invoked from network); 3 Jan 2024 15:22:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2024 15:22:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1704295392; bh=c1kSmjJZhUfXIOAa18HXE87KFjS4aeeNjXILMcGmMVE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IRnWh4k85n5/Q3EqGOePHDomhC0+JfQJpxDdffVIJkI2TnYhbVfcCHvjEmKcZmFo/ gfxEaojihv0lCuV5Ac5I/DDBF+CTypconKywSUK60rvyZTfin+CMnO1cFfKquUt0Fr dBoRdE8KMEXR5Eeo/GdkIVVLdIEwbjr3NpTQSlWsJG71gCr0fpTc+tlp3dfSVjHGiy xCKb7e62kgm9X/9ssXYI4Cc1gxKwZAHTze221UQI3Kx7Pvlj/EJus1sT2mCRZsHtNc 3gBge2Y2OweMxfIVu4CBMTke9J8ffbDb75klaPoi0HT00gP+2w3WZ5dBdnR19CGnXi tn3GYW9pVev0A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4E8E8180038 for ; Wed, 3 Jan 2024 07:23:11 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 3 Jan 2024 07:23:10 -0800 (PST) Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-db4364ecd6aso5133960276.2 for ; Wed, 03 Jan 2024 07:22:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704295359; x=1704900159; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=QlAN0OQDeDqDbIItv7wGCDLNwuAPud8751i+SJOq0es=; b=GzW4XrKkW7/pTFjGjm758nlgnXokFiaFaBMVhAvFDSJmBa7RTpr3VKWui6RNy4AwlX NVAZn4ceCNcAGvhzw85j5YqqRIcykIj6F2TwQObiSn0bSuK0epevQTfgbdb5jGuvIIOu voaENvHCDiEMj+9ESFC8jdjVzbFQFtrSFRricY9jGmOvLaZWum2o6CHKcCMo8K/HF9xt PgPHHhkLq76YOiPAkXw6+8u97qr7CWIKGBF4Pv+7y+bJX2vI/DfThHOoU6VCWEt1+42T oB0IXhitkkYcUeW1lR4e9F8GSnFY80CO/jBoRLUJdZlovhGHamc74uDCEDVC5xI+mcCS FJBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704295359; x=1704900159; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QlAN0OQDeDqDbIItv7wGCDLNwuAPud8751i+SJOq0es=; b=jVItSa1OrcF6MAJnxQRYWael0mP0huYBYSDEl9fzq5KUgXrzh/F67Pu8IhM2ThobiO YbAkb9M0gKn0Ffo/INU4eYCp5x7sGf5c/NYYuhSPD0MHQWwDgeza/90nXCHWzDaTULQU Q4AdJns9EMCXjgKW3GWZGsCI5j205MRMcikufoywdLMJamDrJeD7S7XEObPqlSjJLXTX 3wsqDD+ogwrL/0bfdjJ+aAN2eGISc5nGr9GyRXb1yc6GHr5thWic94bu742/f1uBhowh RSgvq0na5WRLtGX/v1+gx0xjafoLk7DfPLQZsBIErpt7X6oFromEAJjSzUlcNCa2Nx/s Ioqg== X-Gm-Message-State: AOJu0YyfPRO4Pa8H5sl3ZK3t+1p+or71cgop+yghGJ1GmUBwG8YXDoNq JAdRn3ID+K1BgexiMf76CFSHTGG1WS533IXDLaU= X-Google-Smtp-Source: AGHT+IGBBbfRySemnLhLgrobvHHuwb7JBezxlVKLtMsU4eQt7INW8ISh00wN9uGV2fen9p+Eeijrtt7TF7r+EpVIM4k= X-Received: by 2002:a25:c751:0:b0:dbe:aab1:b0e2 with SMTP id w78-20020a25c751000000b00dbeaab1b0e2mr254037ybe.126.1704295359167; Wed, 03 Jan 2024 07:22:39 -0800 (PST) MIME-Version: 1.0 References: <8_ddez_Ykz3hKB4zkdYVhxWjHTwlWzYjo4rfojNiWMPF79rHAu2tQ3JMsqwMh8YkZUCVbZp2uZWj0vNBmVkbHFj6kA1_dSY0qD5S_Gb9CG8=@gpb.moe> In-Reply-To: <8_ddez_Ykz3hKB4zkdYVhxWjHTwlWzYjo4rfojNiWMPF79rHAu2tQ3JMsqwMh8YkZUCVbZp2uZWj0vNBmVkbHFj6kA1_dSY0qD5S_Gb9CG8=@gpb.moe> Date: Wed, 3 Jan 2024 16:22:27 +0100 Message-ID: To: "Gina P. Banyard" Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="00000000000079c7fe060e0c2f61" Subject: Re: [PHP-DEV] [RFC] Add http_(get|clear)_last_request_headers() function From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000079c7fe060e0c2f61 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =C5=9Br., 3 sty 2024 o 15:57 Gina P. Banyard napisa=C5= =82(a): > On Wednesday, 3 January 2024 at 14:38, Micha=C5=82 Marcin Brzuchalski < > michal.brzuchalski@gmail.com> wrote: > > Hi Gina, > > =C5=9Br., 3 sty 2024 o 14:41 Gina P. Banyard napisa= =C5=82(a): > > Hello internals, > > I would like to propose an RFC to add the functions > http_get_last_request_headers() and http_clear_last_request_headers() to > PHP to replace the magic variable $http_response_header. > > Link: https://wiki.php.net/rfc/http-last-response-headers > > > I was on the specific documentation page describing this feature Today an= d > was thinking that it is inappropriate as well. > But my thinking was whether it shouldn't be a part of a stream context > instead, something like this: > > $response_headers; > $context =3D stream_context_create([ > 'http' =3D> ['response_headers' =3D> &$response_headers] > ]); > $result =3D file_get_contents('http://example.com/submit.php', false, > $context); > > This way by ref you get a specific HTTP wrapper running under the hood > response headers instead of just the last one. > Any thoughts about that? > > > I don't understand why the response should be part of the context of a > stream. > Especially as I'm not aware of anything within the context that changes > values after a request? > My thinking was like passing as part of the context a placeholder by ref where the headers of requests done in this context are to be populated. This means instead of calling http_get_last_request_headers() as you propose just read them from $response_headers array which got populated during the HTTP call. In general the same to what Aleksander asked. Cheers --00000000000079c7fe060e0c2f61--