google-code-export / typica

Automatically exported from code.google.com/p/typica
Apache License 2.0
1 stars 1 forks source link

runInstances - userData not base64 encoded #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When constructing the URL the userData is not base64 encoded.
The following patch fixes this issue:

--- Jec2.java.orig      2007-06-13 14:44:05.000000000 +0200
+++ Jec2.java   2007-06-17 02:48:15.000000000 +0200
@@ -386,7 +386,7 @@
                params.put("MinCount", ""+minCount);
                params.put("MaxCount", ""+maxCount);
                if (userData != null && !userData.trim().equals("")) {
-                       params.put("UserData", userData);
+                       params.put("UserData",
Base64Coder.encodeString(userData));
                }
                if (publicAddr) {
                        params.put("AddressingType", "public");

Original issue reported on code.google.com by xnix...@gmail.com on 17 Jun 2007 at 1:09

GoogleCodeExporter commented 9 years ago
This is as designed. The runInstances method was designed to behave just like 
the
Amazon SOAP client. I realize that having to do the encoding is inconvenient.
Perhaps, what I should do is offer the option. On the other hand, if I just 
started
encoding the data, and documenting the fact, that might be just as well. There 
really
isn't any harm for the users who are doing their own encoding because it will be
encoded twice. I realize there is some expansion when it is encoded, but 
hopefully
that won't be much of an issue.

Original comment by dkavan...@gmail.com on 17 Jun 2007 at 2:53

GoogleCodeExporter commented 9 years ago
I would definitely put in at least an option. I think the normal use case is 
just
inputting a String of user data and typica should abstract as much as possible 
from
the underlying protocol. In the more rare cases that somebody wants to upload 
binary data
the existing method could be used, where a user has to encode it himself or you 
could
offer another Method that takes an array of bytes as userData input and 
base64encode
that.

Original comment by xnix...@gmail.com on 17 Jun 2007 at 7:29

GoogleCodeExporter commented 9 years ago
In reading the developer docs, base64 is required, so I think I'll make
runInstances() alway encode the data. If the user also encodes it, no harm done,
unless the data is already near the limit (expansion in base64 is 1:1.33)

Original comment by dkavan...@gmail.com on 18 Jun 2007 at 5:36

GoogleCodeExporter commented 9 years ago

Original comment by dkavan...@gmail.com on 18 Jun 2007 at 5:40