[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebClient.java,1.4,1.5 WebConversation.ja
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-04-05 22:16:09
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv20682/src/com/meterware/httpunit
Modified Files:
WebClient.java WebConversation.java WebRequest.java
Log Message:
Use nominal header capitalization
Index: WebClient.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebClient.java 2001/04/03 16:49:08 1.4
+++ WebClient.java 2001/04/05 22:16:07 1.5
@@ -161,11 +161,25 @@
* removes the header from those to be sent.
**/
public void setHeaderField( String fieldName, String fieldValue ) {
+ fieldName = matchPreviousFieldName( fieldName );
if (fieldValue == null) {
- _headers.remove( fieldName.toUpperCase() );
+ _headers.remove( fieldName );
} else {
- _headers.put( fieldName.toUpperCase(), fieldValue );
+ _headers.put( fieldName, fieldValue );
}
+ }
+
+
+ /**
+ * If a matching field name with different case is already known, returns the older name.
+ * Otherwise, returns the specified name.
+ **/
+ private String matchPreviousFieldName( String fieldName ) {
+ for (Enumeration e = _headers.keys(); e.hasMoreElements(); ) {
+ String key = (String) e.nextElement();
+ if (key.equalsIgnoreCase( fieldName )) return key;
+ }
+ return fieldName;
}
Index: WebConversation.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebConversation.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- WebConversation.java 2001/03/23 20:50:41 1.19
+++ WebConversation.java 2001/04/05 22:16:07 1.20
@@ -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
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- WebRequest.java 2001/04/03 16:49:08 1.17
+++ WebRequest.java 2001/04/05 22:16:07 1.18
@@ -267,7 +267,7 @@
void setRequestHeader( String headerName, String headerValue ) {
- _headers.put( headerName.toUpperCase(), headerValue );
+ _headers.put( headerName, headerValue );
}
|