From:             struman at nuparadigm dot com
Operating system: Windows XP
PHP version:      4.3.0
PHP Bug Type:     Sockets related
Bug description:  Wierd fsockopen problem

Apache 2.0.42 with SAPI module

Default install with sockets module.

When connecting to a java Servlet from PHP. Servlet always reports that
port 80 is the port that it is being connected too.

I can telnet to 127.0.0.1 8080 and issue
GET /TestServlet
HTTP/1.0
Host: 127.0.0.1

And the Servlet reports the correct port.

Also reports the correct port when browing URL with Web Browser.

Only in PHP does the port default to 80.

My Guess it that sin_port is being set incorrectly.

-- Test Code  PHP --
$fp = fsockopen("127.0.0.1", 8080, $fsockopen_errnum, $fsockopen_errstr,
$fsockopen_timeout);
$sHeader = "GET " . "/TestServlet";
$sHeader .= " HTTP/1.0\r\n";
$sHeader .= "Host: 127.0.0.1\r\n\r\n";
fputs($fp, $sHeader);

-- Servlet Code --
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
System.out.println("Serverport="+request.getServerPort());
}


-- 
Edit bug report at http://bugs.php.net/?id=22808&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22808&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22808&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22808&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22808&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22808&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22808&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22808&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22808&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22808&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22808&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22808&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22808&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22808&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22808&r=gnused

Reply via email to