No worries, will do ;-) I'm also surprised, but I suspect it's not widely used so who knows. I've never used it myself.
Brett On Mon, May 9, 2011 at 9:15 PM, Guillaume Rischard <[email protected]>wrote: > Hi Brett, > > Thanks! If this breaks everything, you can say it's my fault :). I still > can't believe the code that was in there never could have worked in the > first place. > > Cheers, > > Guillaume > > On 9 May 2011, at 12:22, Brett Henderson wrote: > > Hi Guillaume, > > Thanks for the patch! > > I haven't used this task myself and haven't tested to see if your change > works, however I've applied the patch ;-) It's a fairly simple isolated > change though so fingers crossed it's all okay :-) > > Cheers, > Brett > > On Tue, Apr 19, 2011 at 9:44 PM, Guillaume Rischard < > [email protected]> wrote: > >> Hi everyone, >> >> The --upload-xml-change feature can't log into the API server. The problem >> seems to come from the conversion of the username:password to Base64. >> >> When running >> >> osmosis -v 9 --rxc file="yourOsmChange.osm" --upload-xml-change user=you >> password=secret >> >> , instead of uploading the changes, osmosis sends an incorrect >> username:password string and receives a 401 Authentication required error. >> >> When comparing osmosis and wget tcpdumps, I see that the http credentials >> they send are different. Wget's credentials string base64-decodes back to my >> username:password, while osmosis's string doesn't at all. >> >> The problem comes from the base64 conversion that is being done by the >> apache common codecs library. httpCon.setRequestProperty() expects a String, >> but gets a byte[] back from encodeBase64. This patch calls >> encodeBase64String which returns a String instead. >> >> I wonder whether there's something I'm missing. How could it even work in >> the first place? I haven't been able to compile osmosis (the unit tests fail >> without a database), but encodeBase64String produces right-looking >> credentials for me in test code. >> >> What do you think? >> >> Cheers, >> >> Guillaume >> >> Index: xml/src/org/openstreetmap/osmosis/xml/v0_6/XmlChangeUploader.java >> =================================================================== >> --- xml/src/org/openstreetmap/osmosis/xml/v0_6/XmlChangeUploader.java >> (revision 25864) >> +++ xml/src/org/openstreetmap/osmosis/xml/v0_6/XmlChangeUploader.java >> (working copy) >> @@ -125,7 +125,7 @@ >> // we do not use Authenticator.setDefault() >> // here to stay thread-safe. >> httpCon.setRequestProperty("Authorization", "Basic " >> - + Base64.encodeBase64( >> + + Base64.encodeBase64String( >> (this.myUserName + ":" >> + this.myPassword).getBytes("UTF8"))); >> >> @@ -207,7 +207,7 @@ >> >> // we do not use Authenticator.setDefault() here to stay >> thread-safe. >> httpCon.setRequestProperty("Authorization", "Basic " >> - + Base64.encodeBase64( >> + + Base64.encodeBase64String( >> (this.myUserName + ":" >> + this.myPassword).getBytes("UTF8"))); >> >> @@ -251,7 +251,7 @@ >> >> // we do not use Authenticator.setDefault() here to stay >> thread-safe. >> httpCon.setRequestProperty("Authorization", "Basic " >> - + Base64.encodeBase64( >> + + Base64.encodeBase64String( >> (this.myUserName + ":" >> + this.myPassword).getBytes("UTF8"))); >> >> >> >> _______________________________________________ >> osmosis-dev mailing list >> [email protected] >> http://lists.openstreetmap.org/listinfo/osmosis-dev >> > > >
_______________________________________________ osmosis-dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/osmosis-dev

