php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22808 Wierd fsockopen problem
Submitted: 2003-03-20 16:21 UTC Modified: 2003-03-20 16:31 UTC
From: struman at nuparadigm dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 4.3.0 OS: Windows XP
Private report: No CVE-ID: None
 [2003-03-20 16:21 UTC] struman at nuparadigm dot com
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());
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-20 16:31 UTC] struman at nuparadigm dot com
I am able to reproduce the problem with acouple of other client libraries.. not a PHP issue.. Sorry
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Mar 30 13:01:25 2020 UTC