FULL PRODUCT VERSION :
jre 1.6.0_18 b-01 and run program below in Eclipse
6 Update 20
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2
EXTRA RELEVANT SYSTEM CONFIGURATION :
Apache Tomcat 6.0.20 used for http server
A DESCRIPTION OF THE PROBLEM :
Extra packet generated for http request/response from java client. When requesting a file under 1460 bytes via url request noticed while using wireshark network sniffer two packets being sent/received. When using FireFox 3.5 only one packet was sent/received. The web server used is Tomcat 6.0.20.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. download Wireshark or some other sniffer.
2. Start capture
3. Execute java test program requesting the small file.
4. Stop capture and review packets sent/received
5. Repeat with FireFox and send request for the same file
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
One TCP packet for request/response
ACTUAL -
Two TCP packets with request/response
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class PacketTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String req1 = "http://www.myuniportal.com/packettest.html"; //file 337 bytes
try {
// Construct data
String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
// Send data
URL url = new URL(req1);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
// Process line...
System.out.println("Http Response Line:" + line);
}
wr.close();
rd.close();
} catch (Exception e) {
}
}
}
---------- END SOURCE ----------
jre 1.6.0_18 b-01 and run program below in Eclipse
6 Update 20
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2
EXTRA RELEVANT SYSTEM CONFIGURATION :
Apache Tomcat 6.0.20 used for http server
A DESCRIPTION OF THE PROBLEM :
Extra packet generated for http request/response from java client. When requesting a file under 1460 bytes via url request noticed while using wireshark network sniffer two packets being sent/received. When using FireFox 3.5 only one packet was sent/received. The web server used is Tomcat 6.0.20.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. download Wireshark or some other sniffer.
2. Start capture
3. Execute java test program requesting the small file.
4. Stop capture and review packets sent/received
5. Repeat with FireFox and send request for the same file
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
One TCP packet for request/response
ACTUAL -
Two TCP packets with request/response
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class PacketTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String req1 = "http://www.myuniportal.com/packettest.html"; //file 337 bytes
try {
// Construct data
String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
// Send data
URL url = new URL(req1);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
// Process line...
System.out.println("Http Response Line:" + line);
}
wr.close();
rd.close();
} catch (Exception e) {
}
}
}
---------- END SOURCE ----------