You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ib...@apache.org on 2004/01/21 16:40:33 UTC

cvs commit: jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods XMLResponseMethodBase.java

ib          2004/01/21 07:40:32

  Modified:    webdavclient/clientlib/src/java/org/apache/webdav/lib/methods
                        XMLResponseMethodBase.java
  Log:
  Workaround for buggy servers sending a 200 in reply to a PROPFIND request
  
  Revision  Changes    Path
  1.2       +15 -10    jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/XMLResponseMethodBase.java
  
  Index: XMLResponseMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/XMLResponseMethodBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLResponseMethodBase.java	9 Jan 2004 09:56:03 -0000	1.1
  +++ XMLResponseMethodBase.java	21 Jan 2004 15:40:32 -0000	1.2
  @@ -76,6 +76,7 @@
   import org.apache.commons.httpclient.HttpConnection;
   import org.apache.commons.httpclient.HttpException;
   import org.apache.commons.httpclient.HttpState;
  +import org.apache.commons.httpclient.HttpStatus;
   import org.apache.util.DOMUtils;
   import org.apache.util.DOMWriter;
   import org.apache.util.WebdavStatus;
  @@ -283,14 +284,15 @@
        */
       public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
           throws IOException, HttpException {
  -        try
  -        {
  -            if (getStatusLine().getStatusCode() == WebdavStatus.SC_MULTI_STATUS ) {
  +        // Also accept OK sent by buggy servers in reply to a PROPFIND.
  +        if (getStatusCode() == WebdavStatus.SC_MULTI_STATUS
  +            || this instanceof PropFindMethod
  +                && getStatusCode() == HttpStatus.SC_OK) {
  +            try {
                   parseXMLResponse(input);
  -            }
  -        }
  -        catch (IOException e) {
  +            } catch (IOException e) {
                   // FIX ME:  provide a way to deliver non xml data
  +            }
           }
       }
   
  @@ -345,7 +347,10 @@
               responseHashtable = new Hashtable();
               int status = getStatusLine().getStatusCode();
   
  -            if (status == WebdavStatus.SC_MULTI_STATUS) {
  +            // Also accept OK sent by buggy servers in reply to a PROPFIND.
  +            if (status == WebdavStatus.SC_MULTI_STATUS
  +                || this instanceof PropFindMethod
  +                    && status == HttpStatus.SC_OK) {
   
                   Element multistatus =
                       getResponseDocument().getDocumentElement();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org