Add TEXTPLAIN in HttpHeaders Remove all coding/decoding Attribute using URL scheme for name and attribute Add text/plain to contant-type
This commit is contained in:
parent
128bbe3225
commit
c230afaed1
@ -780,7 +780,8 @@ public class HttpPostRequestDecoder {
|
|||||||
Attribute nameAttribute = currentFieldAttributes.get(HttpPostBodyUtil.NAME);
|
Attribute nameAttribute = currentFieldAttributes.get(HttpPostBodyUtil.NAME);
|
||||||
if (currentAttribute == null) {
|
if (currentAttribute == null) {
|
||||||
try {
|
try {
|
||||||
currentAttribute = factory.createAttribute(request, nameAttribute.getValue());
|
currentAttribute = factory.createAttribute(request,
|
||||||
|
decodeAttribute(nameAttribute.getValue(), charset));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new ErrorDataDecoderException(e);
|
throw new ErrorDataDecoderException(e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -954,7 +955,8 @@ public class HttpPostRequestDecoder {
|
|||||||
String[] values = StringUtil.split(contents[i], '=');
|
String[] values = StringUtil.split(contents[i], '=');
|
||||||
Attribute attribute;
|
Attribute attribute;
|
||||||
try {
|
try {
|
||||||
attribute = factory.createAttribute(request, values[0].trim(),
|
attribute = factory.createAttribute(request,
|
||||||
|
decodeAttribute(values[0].trim(), charset),
|
||||||
decodeAttribute(cleanString(values[1]), charset));
|
decodeAttribute(cleanString(values[1]), charset));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new ErrorDataDecoderException(e);
|
throw new ErrorDataDecoderException(e);
|
||||||
@ -1014,7 +1016,8 @@ public class HttpPostRequestDecoder {
|
|||||||
} else {
|
} else {
|
||||||
Attribute attribute;
|
Attribute attribute;
|
||||||
try {
|
try {
|
||||||
attribute = factory.createAttribute(request, contents[0].trim(),
|
attribute = factory.createAttribute(request,
|
||||||
|
decodeAttribute(contents[0].trim(), charset),
|
||||||
decodeAttribute(cleanString(contents[i]), charset));
|
decodeAttribute(cleanString(contents[i]), charset));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new ErrorDataDecoderException(e);
|
throw new ErrorDataDecoderException(e);
|
||||||
@ -1115,8 +1118,10 @@ public class HttpPostRequestDecoder {
|
|||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
currentFileUpload = factory.createFileUpload(request, nameAttribute.getValue(),
|
currentFileUpload = factory.createFileUpload(request,
|
||||||
filenameAttribute.getValue(), contentTypeAttribute.getValue(), mechanism.value(), localCharset,
|
decodeAttribute(nameAttribute.getValue(), charset),
|
||||||
|
decodeAttribute(filenameAttribute.getValue(), charset),
|
||||||
|
contentTypeAttribute.getValue(), mechanism.value(), localCharset,
|
||||||
size);
|
size);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new ErrorDataDecoderException(e);
|
throw new ErrorDataDecoderException(e);
|
||||||
|
@ -486,7 +486,9 @@ public class HttpPostRequestEncoder implements ChunkedMessageInput<HttpContent>
|
|||||||
Charset localcharset = attribute.getCharset();
|
Charset localcharset = attribute.getCharset();
|
||||||
if (localcharset != null) {
|
if (localcharset != null) {
|
||||||
// Content-Type: charset=charset
|
// Content-Type: charset=charset
|
||||||
internal.addValue(HttpHeaders.Names.CONTENT_TYPE + ": " + HttpHeaders.Values.CHARSET + '='
|
internal.addValue(HttpHeaders.Names.CONTENT_TYPE + ": " +
|
||||||
|
HttpPostBodyUtil.DEFAULT_TEXT_CONTENT_TYPE + "; " +
|
||||||
|
HttpHeaders.Values.CHARSET + '='
|
||||||
+ localcharset + "\r\n");
|
+ localcharset + "\r\n");
|
||||||
}
|
}
|
||||||
// CRLF between body header and data
|
// CRLF between body header and data
|
||||||
|
Loading…
Reference in New Issue
Block a user