Browser closes TCP Connection before entire requested page is sent from the server

RESOLVED INVALID

Status

()

Core
Networking: HTTP
RESOLVED INVALID
5 years ago
2 years ago

People

(Reporter: powerlogicmthgk, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments, 2 obsolete attachments)

(Reporter)

Description

5 years ago
Created attachment 722884 [details]
Wireshark - filter ip.addr == 157.198.184.85

I have a web page that contains an anchor tag that requests a web page from our server.  When selecting the link, the browser requests the page, and the server begins to send it.  However, the browser closes the TCP connection before the server has sent the entire web page.  This does not occur with other web browsers.
(Reporter)

Comment 1

5 years ago
Created attachment 722885 [details]
Wireshark - filter ip.addr == 157.198.184.85 (Good example)
(Reporter)

Comment 2

5 years ago
I wireshark packet captures I uploaded do not download as the same file.  Is there a better way to attach files to this thread?
my wireshark (1.8.2) or tcpdump can't interpret your captures. (unknown file format)

but even if they could, it wouldn't help a lot. I'm sure it would show what you say in comment 0, but without a URL I can't really determine what is going on.

Do you have  URL that demonstrates the problem?

What does the browser show (an error, a truncated page, ???)

Closing the connection early isn't necessarily a problem from our pov. Perhaps we just learned we don't care what the rest of the response looks like. (redirects for example, we generally don't care about their body.)
(Reporter)

Comment 4

5 years ago
I'm not sure what happened with the wireshark files when I uploaded them, because I can't open them when I download them.  If you like, I can email them to you.

Anyway, I do not have a URL available because the web server is in a power meter that is still under development.  But, I can give you the source (it's quite simple).

The main page, is an html5 page that loads information into an iframe onhashchange.  This works fine.  However, there is one actual link on the page (where the href is requesting a file from the server, instead of just changing the hash value and letting the onhashchange event javascript request the page).

Anyway, here is the source for the main page and the page that causes the scenario in this "bug" ("logout.shtml").  I will attach it as well, but I'm putting it here in case it doesn't upload correctly (like the wireshark files).

******* index.shtml ***** (after server parse)

<!DOCTYPE html>
<!-- Copyright 2009-2013 Schneider Electric. All Rights Reserved. -->
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PowerLogic&trade;&nbsp;PM5500</title>
	<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />

<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<style type="text/css">
    body, html
    {
        font-family: Arial, Helvetica, sans-serif;
        margin: 0;
        padding: 0;
        background-color: #fff;
    }
    div#logo
    {
        position: absolute;
        top: 10px;
        left: 10px;
        width: 100%;
        height: 64px;
    }
    div#banner
    {
        position: absolute;
        top: 0;
        left: 200px;
        width: 80%;
        height: 60px;
        background-color: rgb(0,155,62);
        color: rgb(255,255,255);
    }
    div.menu
    {
        position: absolute;
        margin: 0;
        padding: 0;
        width: 80%;
        left: 200px;
        top: 57px;
        color: #ccc;
        background-color: #888;
        z-index: 10;
    }
    ul.menu
    {
        margin: 0;
        list-style: none;
    }
    ul.menu li
    {
        margin: 1em;
        padding: 1em;
        display: inline;
        text-align: left;
    }
    a
    {
        color: #fff;
        text-decoration: none;
    }
    div#banner a
    {
        margin: 0 1em 0 1em;
    }
    div#banner a:hover
    {
        color: rgb(0,149,48);
        background-color: rgb(255,255,255);
    }
    div.megamenu
    {
        position: absolute;
        background-color: #666;
        left: 200px;
        top: 74px;
        width: 80%;
        -moz-border-radius: 0 0 1em 1em;
        -webkit-border-radius: 0 0 1em 1em;
        border-radius: 0 0 1em 1em;
        z-index: 2;
    }
    div.megamenu ul
    {
        list-style: none;
        margin: 1ex 5px 1ex 5px;
        padding-left: 0;
    }
    div.megamenu h3
    {
        color: #fff;
        text-decoration: underline;
        margin: 9pt 0 0 0;
    }
    div.megamenu a:hover
    {
        color: #888;
    }
    .col_1
    {
        float: left;
        position: relative;
        margin-left: 5px;
        margin-right: 5px;
        width: 260px;
    }
    #content
    {
        position: fixed;
        top: 124px;
        bottom: 40px;
        margin: 0px 0px 0px 200px;
        width: 80%;
        height: auto;
        padding-left: 5px;
        padding-right: 12px;
        color: #000000;
        border-left: 0;
        overflow: auto;
        text-align: center;
    }
    #user
    {
        position: fixed;
        width: 15%;
        height: 40px;
        top: auto;
        left: 85%;
        bottom: 0;
        border: 0;
        text-align: center;
    }
    #copyright
    {
        position: fixed;
        width: 50%;
        height: 40px;
        top: auto;
        left: 25%;
        bottom: 0;
        margin-left: 10px;
        border-top: 0;
        text-align: center;
    }
    #version
    {
        position: fixed;
        width: 15%;
        height: 40px;
        top: auto;
        left: 0;
        bottom: 0;
        border: 0;
        text-align: center;
    }
</style>
<script type="text/javascript" src="/jquery.js"></script>
<script type="text/javascript">
    window.onhashchange = function () {
        if (document.readyState == 'complete') {
            var mainFrame = document.getElementById("pageContent");
            switch (location.hash) {

                case '#powerQuality':
                    mainFrame.src = "/power_quality.shtml";
                    break;

                case '#ioStatus':
                    mainFrame.src = "/i_o_status.shtml";
                    break;

                case '#meterDiagnostics':
                    mainFrame.src = "/meter_diagnostics.shtml";
                    break;

                case '#commsDiagnostics':
                    mainFrame.src = "/comms_diagnostics.shtml";
                    break;

                case '#readRegisters':
                    mainFrame.src = "/read_registers.shtml";
                    break;

                case '#maintLog':
                case '#alarmLog':
                case '#dataLog':
                case '#activeAlarms':
                    mainFrame.src = "/modbus_time_tagged_events.shtml";
                    try {
                        mainFrame.Enable_view();
                    }
                    catch (e) { }
                    break;

                case '#datapush':
                    mainFrame.src = "/setup_push.shtml";
                    break;

                case '#ethernet':
                    mainFrame.src = "/ethernet_tcpip.shtml";
                    break;

                case '#users':
                    mainFrame.src = "/password_administration.shtml";
                    break;

                case '#setupGauges':
                    mainFrame.src = "/gauges_range_setup.shtml";
                    break;

                case '#home':
                case '#':
                case '#realTimeData':
                default:
                    mainFrame.src = "/basic.shtml";
                    break;

            };
        }
        else { // Wait 50ms and try again
            window.setTimeout(window.onhashchange, 50);
        }
    };

      window.onload = function () {
          if (location.hash == "") {
              location.hash = "#realTimeData";
          }
          window.onhashchange();
      };
      window.onunload = function () {
          location.hash = "";
      }
    </script>
<div id="logo">
    <img src="/logo_se.png" alt="Schneider Electric" />
</div>
<div id="banner"><span style="font-family:'Arial'; font-weight: bold; font-size:24pt; color:white;">&nbsp;PowerLogic&trade;&nbsp;PM5500</span>
    <br />
    <a href="#home" id="home">Home</a>
    <a href="/logout.shtml" id="logout" target="_parent">Logout</a>
</div>
<div class="menu">
    <ul class="menu">
        <li><a href="#" class="tab" id="monitoring">Monitoring</a></li>
        <li>Control</li>
        <li><a href="#" class="tab" id="diagnostics">Diagnostics</a></li>
        <li><a href="#" class="tab" id="maintenance">Maintenance</a></li>
        <li><a href="#" class="tab" id="setup">Setup</a></li>
    </ul>
</div>
<div id="megamonitoring" class="megamenu">
    <div class="col_1">
        <ul>
            <li><a href="#realTimeData">Basic Readings</a></li>
            <li><a href="#powerQuality">Power Quality</a></li>
            <li><a href="#activeAlarms">Active Alarms</a></li>
            <li><a href="#alarmLog">Alarm History</a></li>
            <li><a href="#ioStatus">Inputs/Outputs</a></li>
            <li><a href="#dataLog">Data Log</a></li>
        </ul>
    </div>
</div>
<div id="megadiagnostics" class="megamenu">
    <div class="col_1">
        <ul>
            <li><a href="#meterDiagnostics">Meter</a></li>
            <li><a href="#commsDiagnostics">Communications</a></li>
        </ul>
    </div>
</div>
<div id="megamaintenance" class="megamenu">
    <div class="col_1">
        <ul>
            <li><a href="#readRegisters">Registers</a></li>
            <li><a href="#maintLog">Maintenance Log</a></li>
        </ul>
        </div>
    </div>
<div id="megasetup" class="megamenu">
    <div class="col_1">
        <ul>
            <li><a href="#ethernet">Ethernet</a></li>
            <li><a href="#users">User</a></li>
            <li><a href="#datapush">Device Log Export</a></li>
        </ul>
    </div>
</div>
<div id="content" style="-webkit-overflow-scrolling: touch;"><iframe id="pageContent" style="width:100%; height:95%; -webkit-overflow-scrolling: touch;" seamless="seamless"></iframe></div>
<div id="version">Firmware Version:&nbsp;0.0.0</div>
<div id="copyright">Copyright 2005-2013 Schneider Electric. All Rights Reserved.</div>
<div id="user">User:&nbsp;user1</div>
<script type="text/javascript">
    var victim_timeout = null;
    var victim_id = null;
    $(document).ready(function () {
        $("div.megamenu").hide();
    });
    function disappear_me() {
        if (victim_id) {
            victim_id.fadeOut();
            victim_id = null
        }
        $("a.tab").css("background-color", "#888");
        if (victim_timeout) {
            victim_timeout = null;
        }
    }
    $("a.tab").mouseover(function () {
        $("a.tab").css("background-color", "#888");
        $("div.megamenu").hide();
        $(this).css("background-color", "#666");
        $("div#mega" + this.id).show();
        if (victim_timeout) {
            clearTimeout(victim_timeout);
            victim_timeout = null;
        }
    });
    $("div.megamenu").mouseover(function () {
        if (victim_timeout) {
            clearTimeout(victim_timeout);
            victim_timeout = null;
        }
    });
    $("div.megamenu").mouseout(function () {
        if (!victim_timeout) {
            victim_timeout = setTimeout(disappear_me, 1000);
            victim_id = $("div#" + this.id);
        }
    });
    $("div.megamenu").click(function () {
        if (!victim_timeout) {
            victim_timeout = setTimeout(disappear_me, 1000);
            victim_id = $("div#" + this.id);
        }
    });
</script>
</html>
***** end index.shtml *****

***** logout.shtml *******

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<!-- Copyright 2005-2013 Schneider Electric. All Rights Reserved. --> 
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
	<title>Logout</title>
        <link rel="stylesheet" type="text/css" href="/egx.css" />
	<style type="text/css">
                body { font-size: 12pt; }
	</style>
	
	<script type="text/javascript">
                var xmlhttp = null;
	        function indicate_logout_succeeded(tmp){
			tmp.innerHTML="Log Out Successful -- <a href=\"/\">Click here to login<"+"/a>";
		}
	        function indicate_logout_failed(tmp){
			tmp.innerHTML="Log Out Failed -- Please close browser window";
		}
                function my_handler(e) {
                        xmlhttp.abort();
                }
		function OnLoad(){
			tmp=document.getElementById("txt");
			if (ieVer() > 5.5){
				var CmdRes=document.execCommand("ClearAuthenticationCache");
				if (CmdRes == false){
					window.close();
					indicate_logout_failed(tmp);
				}
				else{
					indicate_logout_succeeded(tmp);
				}
			} else if (navigator.userAgent.indexOf("Gecko/") > -1) {
				// workaround due to Mozilla Bug ID 287957
				// https://bugzilla.mozilla.org/show_bug.cgi?id=287957
				try {
					xmlhttp = createXMLObject();
					xmlhttp.open("GET",".force_logout_offer_login_non_ie",true,"logout","logout");
                                        setTimeout("my_handler();", 10);
					xmlhttp.send("");
					indicate_logout_succeeded(tmp);
				} catch(e) {
					indicate_logout_failed(tmp);
				}
			} else if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
				try {
					var xmlhttp = createXMLObject();
					xmlhttp.open("GET",".force_logout_offer_login_non_ie",true,"logout","logout");
					xmlhttp.send("");
                                        setTimeout("xmlhttp.abort();", 250);
					indicate_logout_succeeded(tmp);
				} catch(e) {
					indicate_logout_failed(tmp);
				}
			} else {
				indicate_logout_failed(tmp);
			}
		}
		function ieVer(){
			var ua=window.navigator.userAgent;
			if (ua.indexOf("Opera") > 0)
				return 0;
			var msie=ua.indexOf("MSIE ");
			if (msie > 0)
				return (ua.substring(msie+5,msie+8));
			else
				return 0;
		}
		function createXMLObject() {
		  try {
		    if (window.XMLHttpRequest) {
		      xmlhttp = new XMLHttpRequest();
		    } else if (window.ActiveXObject) {
		      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	// code for IE
		    }
		  } catch (e) {
		    xmlhttp=false
		  }
		  return xmlhttp;
		}
	</script>
</head>
	<body style="background-color: #FFFFFF" onload="return OnLoad()">
		<p style="text-align: center">&nbsp;</p>
		<p style="text-align: center">&nbsp;</p>
		<p style="text-align: center">&nbsp;</p>
		<p style="text-align: center">&nbsp;</p>
		<p style="text-align: center">&nbsp;</p>
		<p style="text-align: center">&nbsp;</p>
		<p style="text-align: center" id="txt" class="white"></p>

</body></html>
******* end logout.shtml ********

Let me know if you would like the wireshark pcap files via email.

Thanks
(Reporter)

Comment 5

5 years ago
Sorry, to answer your question.... What happens after the connection is closed, is Firefox requests '/' from the server and the main page is loaded again.
(Reporter)

Comment 6

5 years ago
Created attachment 723081 [details]
index.shtml - links to logout.shtml (which causes this issue)
(Reporter)

Comment 7

5 years ago
Created attachment 723082 [details]
logout.shtml
(Reporter)

Comment 8

5 years ago
Created attachment 723083 [details]
Firefox Logout Wireshark filter ip.addr == 157.198.184.85

Attempt to upload again (set content type manually)
Attachment #722884 - Attachment is obsolete: true
(Reporter)

Comment 9

5 years ago
Created attachment 723084 [details]
Wireshark - filter ip.addr == 157.198.184.85 (Good example)
Attachment #722885 - Attachment is obsolete: true
thanks for filing the bug - it is WFM at this time. The only thing I can guess is that your response headers contained an empty date header and we were throwing an error based on that. It works ok now. please reopen if there is something else that you feel should be done.

HTTP/1.1 200 OK
Date: 
Server: HyperX/1.0 ( ThreadX ) 
Content-Type: text/html;
Content-Length: 3119
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Cache-Control: no-cache
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.