You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Andrew Hyatt <ah...@intraspect.com> on 2002/09/19 18:22:52 UTC

[HttpClient] URI request fix and multiple method fix

There are two bugs in HttpClient I've noticed.  One is the simple
matter that the HTTP request is escaped.  It should not be.  THe
fix for this:

Index: HttpMethodBase.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
retrieving revision 1.55
diff -r1.55 HttpMethodBase.java
1205,1206c1205
<         buf.append((null == reqPath)
<                    ? "/" : URIUtil.encode(reqPath, URIUtil.pathSafe()));
---
>         buf.append(null == reqPath ? "/" : reqPath);

The next is that you cannot execute two methods in a row (to the same
url, with different parameters, say), instead you had to close
and create a new HttpClient.  THe solution is simple, we just have to
make sure our session is closed before we open a new one.  The
patch is:

Index: HttpClient.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
retrieving revision 1.54
diff -r1.54 HttpClient.java
192c192
< 
---
>         
196a197,204
>         
>         // Stop the old session before creating a new one
>         try {
>             endSession();
>         } catch (IOException e) {
>             log.error("HttpClient.startSession: error closing the old session before starting the new one");
>         } 
> 


BTW, for some reason I cannot subscribe to any of the jakarta lists.
So if you want to communicate with me, it would be most reliable to
mail me back at this address.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>