You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Sean Qiu (JIRA)" <ji...@apache.org> on 2009/01/04 04:31:45 UTC
[jira] Assigned: (HARMONY-6036) [classlib] [luni] HttpURLConnection
does not have the "Accept" header
[ https://issues.apache.org/jira/browse/HARMONY-6036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean Qiu reassigned HARMONY-6036:
---------------------------------
Assignee: Sean Qiu
> [classlib] [luni] HttpURLConnection does not have the "Accept" header
> ---------------------------------------------------------------------
>
> Key: HARMONY-6036
> URL: https://issues.apache.org/jira/browse/HARMONY-6036
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M8
> Reporter: Kevin Zhou
> Assignee: Sean Qiu
> Fix For: 5.0M9
>
> Attachments: HARMONY-6036.diff
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Start server [1], conduct HeaderTest [2] on HARMONY and RI.
> They prints out the following headers. Thereinto, RI has the "Accept" header, while HARMONY doesn't.
> On RI:
> GET / HTTP/1.1
> User-Agent: Java/1.6.0_07
> Host: 127.0.0.1:8030
> Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
> Connection: keep-alive
> On HARMONY:
> GET / HTTP/1.1
> User-Agent: Java/1.6.0_07
> Host: 127.0.0.1:8030
> Connection: keep-alive
> [1] Server
> public class MockServer {
> public static void main(String[] args) {
> MockServer server = new MockServer();
> server.await();
> }
> public void await() {
> ServerSocket serverSocket = null;
> int port = 8030;
> try {
> serverSocket = new ServerSocket(port, 1, InetAddress
> .getByName("127.0.0.1"));
> } catch (IOException e) {
> e.printStackTrace();
> System.exit(1);
> }
> // Loop waiting for a request
> while (true) {
> Socket socket = null;
> InputStream input = null;
> OutputStream output = null;
> try {
> socket = serverSocket.accept();
> input = socket.getInputStream();
> output = socket.getOutputStream();
> Scanner in = new Scanner(input);
> PrintWriter out = new PrintWriter(output, true);
> while (in.hasNextLine()) {
> String line = in.nextLine();
> System.out.println(line);
> }
> // Close the socket
> socket.close();
> // check if the previous URI is a shutdown command
> } catch (IOException e) {
> e.printStackTrace();
> continue;
> }
> }
> }
> }
> [2] HeaderTest
> public class HeaderTest {
> public static void main(String[] args) throws IOException {
> URL url = new URL("http://127.0.0.1:8030");
> URLConnection conn = url.openConnection();
> conn.connect();
> System.out.println(conn.getLastModified());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.