View Single Post
Old 10-15-2004, 08:48 AM   #5
jbartel
Knows Where the Search Button Is
 
Join Date: Sep 2004
Posts: 17
Default

I assume you are trying to do Basic Authentication (not NTLM/Digest). If so, I found 3 things:

1. With a WAP gateway, it only works if you leave the username/password as plaintext (base64 encoding does not work).
2. With IDEN (6510/7510) or MDS you need to base64 encode the username/password string
3. On the 3.6 OS when using WAP, some http headers get dropped on a http POST if the post data is over a certain size (I think the size is ~38 bytes if I remember correctly).

Here is the code I am using for basic authentication which works:
Code:
private static String AUTHORIZATION           = "Authorization";
private static String BASIC                   = "Basic";


private void addAuthorizationSettingsxxx40;String username, String password, HttpConnection connectionxxx41;
xxx123;
	ifxxx40; username.lengthxxx40;xxx41; > 0 && password.lengthxxx40;xxx41; > 0 xxx41;
	xxx123;
		//Base64 encode only for IDEN, use plaintext with WAP        
        	ifxxx40; RadioInfo.getNetworkTypexxx40;xxx41; == RadioInfo.NETWORK_IDEN xxx41; 
		xxx123; 
			encoded = encodeUsernamePasswordxxx40;username, passwordxxx41;; 
		xxx125; else 
		xxx123; 
			encoded = username + "xxx58;" + password; 
		xxx125;
        	ifxxx40; encoded.lengthxxx40;xxx41; > 0 xxx41;
        	xxx123;
        		connection.setRequestPropertyxxx40;AUTHORIZATION, BASIC + " " + encodedxxx41;;
        	xxx125;
	xxx125;
xxx125;
The encodeUsernamePassword function just creates a new String with the username and password separated by a ":" (i.e. username:password), and base64 encodes that string.
Offline