#23220 [Fbk->NoF]: fgets() causes warning while reading data via SSL channel (HTTPS)

From: Date: Wed, 15 Oct 2003 00:32:14 +0000
Subject: #23220 [Fbk->NoF]: fgets() causes warning while reading data via SSL channel (HTTPS)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-49029@lists.php.net to get a copy of this message
ID: 23220 Updated by: sniper@php.net Reported By: storozhilov at mail dot ru -Status: Feedback +Status: No Feedback Bug Type: Filesystem function related Operating System: FreeBSD 4.8 PHP Version: 4-STABLE-200307070330 Assigned To: wez New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2003-10-08 07:30:39] wez@php.net Could you try the next stable snapshot (due in a few minutes)? I comitted a fix for a different bug that might make a difference to this one. If it hasn't fixed it, could you post an https:// URL that reproduces the problem, so that I can investigate further? ------------------------------------------------------------------------ [2003-09-24 11:36:55] chris dot edwards at obinet dot com Getting the exact same error. Same OS, same version of PHP. Changing the length of the string offered no changes. I still get: SSL: fatal protocol error I'm getting this for fread() and fgets(). ------------------------------------------------------------------------ [2003-08-21 20:25:22] info at splendense dot nl Using '$buff = fgets ($f, 355);' does not give any error, however 356 does for me (php 4.3.2 solaris). My script seems to work fine but maybe a response string greater than 355 chars will not work?!? ------------------------------------------------------------------------ [2003-08-21 20:18:33] scottm at spamcop dot net I've not verified this patch will work and I'll hopefully test it tomorrow. I believe it is reaching the end of the file and nr_bytes is returning 0 and this is being caught by an if statement which should be looking for -1. --- network.c Thu Aug 21 21:06:43 2003 +++ network.c.patched Thu Aug 21 21:13:09 2003 @@ -1011,13 +1011,14 @@ do { nr_bytes = SSL_read(sock->ssl_handle, buf, count); - if (nr_bytes <= 0) { + if (nr_bytes < 0) { retry = handle_ssl_error(stream, nr_bytes TSRMLS_CC); if (retry == 0 && !SSL_pending(sock->ssl_handle)) { stream->eof = 1; } } else { - /* we got the data */ + /* we got the data */ + stream->eof = 1; break; } } while (retry); ------------------------------------------------------------------------ [2003-08-05 09:43:36] uk at access dot lv php4.3.2 configured with-openssl if ($f = fopen('https://site', 'r')) { while (!feof($f)) { $buff = fgets ($f, 1024); echo $buff; } } fclose ($f); Warning: fgets(): SSL: fatal protocol error if i read just some bits then no error. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/23220 -- Edit this bug report at http://bugs.php.net/?id=23220&edit=1

« previous php.bugs (#49029) next »