summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorAaron M. Renn <arenn@urbanophile.com>1998-07-24 01:59:33 +0000
committerAaron M. Renn <arenn@urbanophile.com>1998-07-24 01:59:33 +0000
commitfd46acf9993eadb56b15cc3683606f7c22523f7d (patch)
treea1d582d033c3150c0bc27fe2bb56f32bb596ef4e /gnu
parent6d2040fa504d7320efe4e62f359839726fb19afa (diff)
downloadclasspath-fd46acf9993eadb56b15cc3683606f7c22523f7d.tar.gz
Copyright notice update
Diffstat (limited to 'gnu')
-rw-r--r--gnu/java/net/content/text/plain.java16
-rw-r--r--gnu/java/net/http/Handler.java16
-rw-r--r--gnu/java/net/http/HttpURLConnection.java82
3 files changed, 45 insertions, 69 deletions
diff --git a/gnu/java/net/content/text/plain.java b/gnu/java/net/content/text/plain.java
index 405ad1a4a..412320322 100644
--- a/gnu/java/net/content/text/plain.java
+++ b/gnu/java/net/content/text/plain.java
@@ -1,19 +1,21 @@
/*************************************************************************
/* plain.java -- Content Handler for text/plain type
/*
-/* Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com)
+/* Copyright (c) 1998 Free Software Foundation, Inc.
+/* Written by Aaron M. Renn (arenn@urbanophile.com)
/*
-/* This program is free software; you can redistribute it and/or modify
+/* This library is free software; you can redistribute it and/or modify
/* it under the terms of the GNU Library General Public License as published
-/* by the Free Software Foundation, version 2. (see COPYING.LIB)
+/* by the Free Software Foundation, either version 2 of the License, or
+/* (at your option) any later verion.
/*
-/* This program is distributed in the hope that it will be useful, but
+/* This library is distributed in the hope that it will be useful, but
/* WITHOUT ANY WARRANTY; without even the implied warranty of
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
+/* GNU Library General Public License for more details.
/*
-/* You should have received a copy of the GNU General Public License
-/* along with this program; if not, write to the Free Software Foundation
+/* You should have received a copy of the GNU Library General Public License
+/* along with this library; if not, write to the Free Software Foundation
/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
/*************************************************************************/
diff --git a/gnu/java/net/http/Handler.java b/gnu/java/net/http/Handler.java
index e3d9b2ed5..1c3bcb36d 100644
--- a/gnu/java/net/http/Handler.java
+++ b/gnu/java/net/http/Handler.java
@@ -1,19 +1,21 @@
/*************************************************************************
/* Handler.java -- HTTP protocol handler for java.net
/*
-/* Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com)
+/* Copyright (c) 1998 Free Software Foundation, Inc.
+/* Written by Aaron M. Renn (arenn@urbanophile.com)
/*
-/* This program is free software; you can redistribute it and/or modify
+/* This library is free software; you can redistribute it and/or modify
/* it under the terms of the GNU Library General Public License as published
-/* by the Free Software Foundation, version 2. (see COPYING.LIB)
+/* by the Free Software Foundation, either version 2 of the License, or
+/* (at your option) any later verion.
/*
-/* This program is distributed in the hope that it will be useful, but
+/* This library is distributed in the hope that it will be useful, but
/* WITHOUT ANY WARRANTY; without even the implied warranty of
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
+/* GNU Library General Public License for more details.
/*
-/* You should have received a copy of the GNU General Public License
-/* along with this program; if not, write to the Free Software Foundation
+/* You should have received a copy of the GNU Library General Public License
+/* along with this library; if not, write to the Free Software Foundation
/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
/*************************************************************************/
diff --git a/gnu/java/net/http/HttpURLConnection.java b/gnu/java/net/http/HttpURLConnection.java
index b0e4e92d9..7a78291a2 100644
--- a/gnu/java/net/http/HttpURLConnection.java
+++ b/gnu/java/net/http/HttpURLConnection.java
@@ -1,19 +1,21 @@
/*************************************************************************
/* HttpURLConnection.java -- URLConnection class for HTTP protocol
/*
-/* Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com)
+/* Copyright (c) 1998 Free Software Foundation, Inc.
+/* Written by Aaron M. Renn (arenn@urbanophile.com)
/*
-/* This program is free software; you can redistribute it and/or modify
+/* This library is free software; you can redistribute it and/or modify
/* it under the terms of the GNU Library General Public License as published
-/* by the Free Software Foundation, version 2. (see COPYING.LIB)
+/* by the Free Software Foundation, either version 2 of the License, or
+/* (at your option) any later verion.
/*
-/* This program is distributed in the hope that it will be useful, but
+/* This library is distributed in the hope that it will be useful, but
/* WITHOUT ANY WARRANTY; without even the implied warranty of
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/* GNU General Public License for more details.
+/* GNU Library General Public License for more details.
/*
-/* You should have received a copy of the GNU General Public License
-/* along with this program; if not, write to the Free Software Foundation
+/* You should have received a copy of the GNU Library General Public License
+/* along with this library; if not, write to the Free Software Foundation
/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
/*************************************************************************/
@@ -24,7 +26,6 @@ import java.net.URLConnection;
import java.net.Socket;
import java.net.ProtocolException;
import java.io.InputStream;
-import java.io.PushbackInputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
@@ -56,7 +57,7 @@ protected Socket socket;
/**
* The InputStream for this connection
*/
-protected PushbackInputStream in_stream;
+protected InputStream in_stream;
/**
* The OutputStream for this connection
@@ -68,6 +69,11 @@ protected OutputStream out_stream;
*/
protected PrintWriter out_writer;
+/**
+ * The InputStreamReader for this connection (used internally)
+ */
+protected InputStreamReader in_reader;
+
/*************************************************************************/
/*
@@ -100,53 +106,20 @@ readLine() throws IOException
{
StringBuffer sb = new StringBuffer("");
- byte[] buf = new byte[512];
- boolean check_eol = false;
+ byte[] buf = new byte[1];
for (;;)
{
- int bytes_read = in_stream.read(buf);
- if (bytes_read == -1)
+ int read = in_stream.read(buf, 0, 1);
+ if (read == -1)
throw new IOException("Premature end of input");
- // Check to see if we still have a possible end of header match
- // from last time.
- if (check_eol)
- {
- if (buf[0] == '\n')
- {
- in_stream.unread(buf, 1, bytes_read - 1);
- return(sb.toString());
- }
- else
- sb.append('\r');
- }
-
- check_eol = false;
- for (int i = 0; i < bytes_read; i++)
- {
- // Ok, we possibly have end of line
- if (buf[i] == '\r')
- {
- if (i == (bytes_read - 1))
- check_eol = true;
- else if (buf[i+1] == '\n')
- {
- if (i > 0)
- sb.append(new String(buf, 0, i));
-
- if (bytes_read > 2)
- in_stream.unread(buf, i + 2, ((bytes_read - i) - 2));
-
- return(sb.toString());
- }
- }
- }
-
- if (check_eol)
- sb.append(new String(buf, 0, bytes_read - 1));
- else
- sb.append(new String(buf));
+ if (buf[0] == '\r')
+ continue;
+ if (buf[0] == '\n')
+ break;
+ sb.append((char)buf[0]);
}
+ return(sb.toString());
}
/*************************************************************************/
@@ -155,7 +128,7 @@ readLine() throws IOException
* Connects to the remote host, sends the request, and parses the reply
* code and header information returned
*/
-public synchronized void
+public void
connect() throws IOException
{
// Connect up
@@ -165,8 +138,9 @@ connect() throws IOException
socket = new Socket(url.getHost(), url.getPort());
out_stream = socket.getOutputStream();
- in_stream = new PushbackInputStream(socket.getInputStream(),1024);
+ in_stream = socket.getInputStream();
+ in_reader = new InputStreamReader(in_stream);
out_writer = new PrintWriter(new OutputStreamWriter(out_stream));
// Send the request
@@ -273,8 +247,6 @@ connect() throws IOException
headerKeys.addElement(key.toLowerCase());
headerValues.addElement(value);
}
-
- connected = true;
}
/*************************************************************************/