[4930] in java-interest
Java POST to CGI
daemon@ATHENA.MIT.EDU (Jill Shermer)
Mon Jan 22 21:51:51 1996
Date: Mon, 22 Jan 1996 17:19:03 -0800
From: jshermer@BASISinc.com (Jill Shermer)
To: java-interest@java.sun.com
Hi,
I am having trouble POSTing to a cgi script from an applet, on the origin server. I receive the WWW-Authentication: realm = blah, when I first try to
POST with the following:
I open connections, data in/out streams, this part goes fine.
Then I write into the stream...
d.writeBytes("POST /dir1/cgibin/cgi_script HTTP/1.0\r\n");
d.writeBytes("Content-type: text/html\r\n");
d.writeBytes("Content-length: data.length()\r\n");
d.writeBytes("\r\n");
d.writeBytes(data);
I listen for response from the server, and I am told to send authorization
credentials for the realm I am interested in.
I then close my streams and socket connections.
I get credentials via the java applets widgets I create.
Building my authorization field, complete with base64 encoding,
I send
the same strings into the stream as above, with the additional
authorization string which is sent immediately after my POST request
string is sent.
With this algorithm, I end up timing out after the data (entity body)
is sent the second time. Eventually, control is returned to my applet,
and the streams/sockets are closed.
I have entered my cgi script in the .www-acl file, and am part of
the trusted users group. My password is in the cern-httpd password
files.
Must I use NCAPI to do the authentication if I am using Netscape2.0b5?
Or should I be able to do this direct from my Java applet?
-Jill
jshermer@basisinc.com
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com