Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv5472/src/com/meterware/httpunit
Modified Files:
HttpUnitOptions.java WebClient.java
Log Message:
Send accept-encoding header unless disabled
Index: HttpUnitOptions.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- HttpUnitOptions.java 28 Jan 2002 21:37:05 -0000 1.17
+++ HttpUnitOptions.java 11 Mar 2002 12:34:31 -0000 1.18
@@ -47,6 +47,24 @@
_characterSet = HttpUnitUtils.DEFAULT_CHARACTER_SET;
_contentType = DEFAULT_CONTENT_TYPE;
_postIncludesCharset = false;
+ _acceptGzip = true;
+ }
+
+
+
+ /**
+ * Returns true if any WebClient created will accept GZIP encoding of responses. The default is to accept GZIP encoding.
+ **/
+ public static boolean isAcceptGzip() {
+ return _acceptGzip;
+ }
+
+
+ /**
+ * Specifies whether a WebClient will be initialized to accept GZIP encoded responses. The default is true.
+ */
+ public static void setAcceptGzip( boolean acceptGzip ) {
+ _acceptGzip = acceptGzip;
}
@@ -303,6 +321,8 @@
private static final String DEFAULT_CONTENT_TYPE = "text/plain";
private static final String DEFAULT_CONTENT_HEADER = DEFAULT_CONTENT_TYPE;
+
+ private static boolean _acceptGzip = true;
private static boolean _parserWarningsEnabled;
Index: WebClient.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- WebClient.java 28 Feb 2002 14:30:33 -0000 1.21
+++ WebClient.java 11 Mar 2002 12:34:31 -0000 1.22
@@ -247,6 +247,13 @@
//------------------------------------------ protected members -----------------------------------
+ protected WebClient() {
+ if (HttpUnitOptions.isAcceptGzip()) {
+ setHeaderField( "Accept-Encoding", "gzip" );
+ }
+ }
+
+
/**
* Creates a web response object which represents the response to the specified web request.
**/
|