[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit AuthorizationRequiredException.java,1.1,1
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-04-02 19:35:50
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv3720/src/com/meterware/httpunit
Modified Files:
AuthorizationRequiredException.java
Log Message:
Handle authentication headers w/o scheme specification
Index: AuthorizationRequiredException.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/AuthorizationRequiredException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AuthorizationRequiredException.java 2000/09/01 14:54:03 1.1
+++ AuthorizationRequiredException.java 2001/04/02 19:35:46 1.2
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000, Russell Gold
+* Copyright (c) 2000-2001, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -31,15 +31,20 @@
AuthorizationRequiredException( String wwwAuthenticateHeader ) throws IOException {
int i = wwwAuthenticateHeader.indexOf( ' ' );
- _scheme = wwwAuthenticateHeader.substring( 0, i );
- _params = wwwAuthenticateHeader.substring( i+1 );
+ if (i < 0) { // non-conforming header
+ _scheme = "Basic";
+ _params = wwwAuthenticationHeader;
+ } else {
+ _scheme = wwwAuthenticateHeader.substring( 0, i );
+ _params = wwwAuthenticateHeader.substring( i+1 );
+ }
_properties = new Properties();
_properties.load( new ByteArrayInputStream( _params.getBytes() ) );
}
public String getMessage() {
- return _scheme + " authorization required: " + _params;
+ return _scheme + " authentication required: " + _params;
}
|