HTTPSernder: Wrong Basic64 content in Authorization
----------------------------------------------------
Key: AXIS-2599
URL: http://issues.apache.org/jira/browse/AXIS-2599
Project: Apache Axis
Issue Type: Bug
Components: Basic Architecture
Affects Versions: 1.4
Environment: z/OS (MVS)
JDK 1.4.2
Axis 1.4
Reporter: Thomas Klemmensen
When we add credentials in the URL we send to AXIS we get some problems with
the encoding.
The URL looks something like this:
http://USERID:[EMAIL PROTECTED]/someprojekt/services/TheService
When class HTTPSender retrieve the userid (USERID) then it does the following:
if (userID != null) {
StringBuffer tmpBuf = new StringBuffer();
tmpBuf.append(userID).append(":").append((passwd == null) ? "" :
passwd);
otherHeaders.append(HTTPConstants.HEADER_AUTHORIZATION).append(": Basic
").append(Base64.encode(tmpBuf.toString().getBytes())).append("\r\n");
}
But when we execute we recieve the following error from our service-provider:
[Thu Dec 00 00:00:00 2006] [error] [client 4.3.2.1] user àëòäÆëéözêüôôëêüôôû
not found: /someprojekt/services/TheService
It seems as if we don't use the same encoding.
Looking in to the method String.getBytes() it seems the method uses the value
from java.encoding which should be:
EBCDIC: Denmark (cp277)
As we look around the class HTTPSender we can see that almost everytime someone
gets a byte-array from a String or makes a String from a byte-array they are
using the constant:
HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING (public static final String
HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";)
We have tried to put the value inside the existing code so it looks like this:
if (userID != null) {
StringBuffer tmpBuf = new StringBuffer();
tmpBuf.append(userID).append(":").append((passwd == null) ? "" :
passwd);
otherHeaders.append(HTTPConstants.HEADER_AUTHORIZATION)
.append(": Basic ")
.append(Base64.encode(tmpBuf.toString().getBytes(HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING)))
.append("\r\n");
}
This seems to work. But we actually don't know if it's a BUG in the first place.
But we hope it is and that is solved in later versions? Otherwise we would very
much appreciate if someone could help with another workaround to our problem.
In advance, Thanx.
Thomas
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]