From owner-dev-commits-ports-all@freebsd.org Mon Jul 12 10:00:53 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8F7465ACC5; Mon, 12 Jul 2021 10:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GNfR95YPWz4j8N; Mon, 12 Jul 2021 10:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A703E4E49; Mon, 12 Jul 2021 10:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16CA0rca048079; Mon, 12 Jul 2021 10:00:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16CA0rvc048078; Mon, 12 Jul 2021 10:00:53 GMT (envelope-from git) Date: Mon, 12 Jul 2021 10:00:53 GMT Message-Id: <202107121000.16CA0rvc048078@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Renato Botelho Subject: git: 9aaa558bcc27 - main - www/pear-HTTP_Request2: Import fix from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: garga X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9aaa558bcc2753749a9a4abbf7cc21448d1c1b0c Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 10:00:53 -0000 The branch main has been updated by garga: URL: https://cgit.FreeBSD.org/ports/commit/?id=9aaa558bcc2753749a9a4abbf7cc21448d1c1b0c commit 9aaa558bcc2753749a9a4abbf7cc21448d1c1b0c Author: Renato Botelho AuthorDate: 2021-07-02 13:47:09 +0000 Commit: Renato Botelho CommitDate: 2021-07-12 09:59:28 +0000 www/pear-HTTP_Request2: Import fix from upstream pfSense users reported a communication error on code that uses HTTP_Request2 after we moved to most recent version. After reporting the issue to upstream they came up with a fix that confirmed working. This change adds upstream fix and while here, I also changed USES order to make portlint happy and added LICENSE. [1] https://redmine.pfsense.org/issues/12048 Obtained from: pfSense Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31000 --- www/pear-HTTP_Request2/Makefile | 10 +++-- .../files/patch-HTTP_Request2_SocketWrapper.php | 48 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/www/pear-HTTP_Request2/Makefile b/www/pear-HTTP_Request2/Makefile index 9f773de12c87..f344a9db4727 100644 --- a/www/pear-HTTP_Request2/Makefile +++ b/www/pear-HTTP_Request2/Makefile @@ -1,23 +1,27 @@ # Created by: Wen Heping PORTNAME= HTTP_Request2 -PORTVERSION= 2.4.2 +DISTVERSION= 2.4.2 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= www pear MAINTAINER= sunpoet@FreeBSD.org COMMENT= PEAR classes providing an easy way to perform HTTP requests +LICENSE= BSD3CLAUSE +LICENSE_FILE= ${WRKSRC}/docs/LICENSE + BUILD_DEPENDS= ${PEARDIR}/Net/URL2.php:net/pear-Net_URL2@${PHP_FLAVOR} RUN_DEPENDS= ${PEARDIR}/Net/URL2.php:net/pear-Net_URL2@${PHP_FLAVOR} +USES= pear + OPTIONS_DEFINE= CURL FILEINFO ZLIB CURL_DESC= PHP CURL extension support FILEINFO_DESC= PHP FILEINFO extension support ZLIB_DESC= PECL ZLIB support -USES= pear - CURL_USES= php CURL_USE= PHP=curl FILEINFO_USES= php diff --git a/www/pear-HTTP_Request2/files/patch-HTTP_Request2_SocketWrapper.php b/www/pear-HTTP_Request2/files/patch-HTTP_Request2_SocketWrapper.php new file mode 100644 index 000000000000..772670d4eb23 --- /dev/null +++ b/www/pear-HTTP_Request2/files/patch-HTTP_Request2_SocketWrapper.php @@ -0,0 +1,48 @@ +From 63e6f932ab4004f0c09a080d370861d0323b6d33 Mon Sep 17 00:00:00 2001 +From: Alexey Borzov +Date: Fri, 25 Jun 2021 15:05:27 +0300 +Subject: [PATCH] Attempt to fix #23 or at least be more verbose + +--- HTTP/Request2/SocketWrapper.php.orig 2020-09-24 22:12:37 UTC ++++ HTTP/Request2/SocketWrapper.php +@@ -228,23 +228,31 @@ class HTTP_Request2_SocketWrapper + public function write($data) + { + $totalWritten = 0; +- while (strlen($data)) { ++ while (strlen($data) && !$this->eof()) { + $written = 0; ++ $error = null; + $timeouts = $this->_getTimeoutsForStreamSelect(); + +- $r = []; ++ $r = null; + $w = [$this->socket]; +- $e = []; ++ $e = null; + if (stream_select($r, $w, $e, $timeouts[0], $timeouts[1])) { +- // Notice: fwrite(): send of #### bytes failed with errno=10035 +- // A non-blocking socket operation could not be completed immediately. +- $written = @fwrite($this->socket, $data); ++ set_error_handler(static function ($errNo, $errStr) use (&$error) { ++ if (0 !== (E_NOTICE | E_WARNING) & $errNo) { ++ $error = $errStr; ++ } ++ }); ++ $written = fwrite($this->socket, $data); ++ restore_error_handler(); + } + $this->checkTimeout(); + +- // http://www.php.net/manual/en/function.fwrite.php#96951 +- if (0 === (int)$written) { +- throw new HTTP_Request2_MessageException('Error writing request'); ++ // php_sockop_write() defined in /main/streams/xp_socket.c may return zero written bytes for non-blocking ++ // sockets in case of transient errors. These writes will not have notices raised and should be retried ++ if (false === $written || 0 === $written && null !== $error) { ++ throw new HTTP_Request2_MessageException( ++ 'Error writing request' . (null === $error ? '' : ': ' . $error) ++ ); + } + $data = substr($data, $written); + $totalWritten += $written;