* HTTP Proxy: Get mime type right for .ico
* DataHelper: Cleanup
This commit is contained in:
@ -843,6 +843,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
|||||||
String type;
|
String type;
|
||||||
if (filename.endsWith(".css"))
|
if (filename.endsWith(".css"))
|
||||||
type = "text/css";
|
type = "text/css";
|
||||||
|
else if (filename.endsWith(".ico"))
|
||||||
|
type = "image/x-icon";
|
||||||
else if (filename.endsWith(".png"))
|
else if (filename.endsWith(".png"))
|
||||||
type = "image/png";
|
type = "image/png";
|
||||||
else if (filename.endsWith(".jpg"))
|
else if (filename.endsWith(".jpg"))
|
||||||
|
@ -521,7 +521,8 @@ public class DataHelper {
|
|||||||
/** Write out a string to the stream as specified by the I2P data structure spec. Note that the max
|
/** Write out a string to the stream as specified by the I2P data structure spec. Note that the max
|
||||||
* size for a string allowed by the spec is 255 bytes.
|
* size for a string allowed by the spec is 255 bytes.
|
||||||
*
|
*
|
||||||
* WARNING - this method destroys the encoding
|
* WARNING - this method destroys the encoding, and therefore violates
|
||||||
|
* the data structure spec.
|
||||||
*
|
*
|
||||||
* @param out stream to write string
|
* @param out stream to write string
|
||||||
* @param string string to write out: null strings are perfectly valid, but strings of excess length will
|
* @param string string to write out: null strings are perfectly valid, but strings of excess length will
|
||||||
@ -537,7 +538,7 @@ public class DataHelper {
|
|||||||
int len = string.length();
|
int len = string.length();
|
||||||
if (len > 255)
|
if (len > 255)
|
||||||
throw new DataFormatException("The I2P data spec limits strings to 255 bytes or less, but this is "
|
throw new DataFormatException("The I2P data spec limits strings to 255 bytes or less, but this is "
|
||||||
+ string.length() + " [" + string + "]");
|
+ len + " [" + string + "]");
|
||||||
writeLong(out, 1, len);
|
writeLong(out, 1, len);
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
out.write((byte)(string.charAt(i) & 0xFF));
|
out.write((byte)(string.charAt(i) & 0xFF));
|
||||||
@ -566,7 +567,7 @@ public class DataHelper {
|
|||||||
int len = raw.length;
|
int len = raw.length;
|
||||||
if (len > 255)
|
if (len > 255)
|
||||||
throw new DataFormatException("The I2P data spec limits strings to 255 bytes or less, but this is "
|
throw new DataFormatException("The I2P data spec limits strings to 255 bytes or less, but this is "
|
||||||
+ string.length() + " [" + string + "]");
|
+ len + " [" + string + "]");
|
||||||
writeLong(out, 1, len);
|
writeLong(out, 1, len);
|
||||||
out.write(raw);
|
out.write(raw);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user