private void detectMultipartBoundary(Buf src, BufRange body, BufRange multipartBoundary) { BytesUtil.parseLine(src.bytes(), multipartBoundary, body.start, body.limit()); multipartBoundary.strip(2, 0); }
private boolean parseDisposition(Buf src, BufRange dispoA, BufRange dispoB, BufRange name, BufRange filename) { if (BytesUtil.startsWith(src.bytes(), dispoA, NAME_EQ, false)) { name.assign(dispoA); name.strip(NAME_EQ.length, 0); BytesUtil.trim(src.bytes(), name); name.strip(1, 1); if (BytesUtil.startsWith(src.bytes(), dispoB, FILENAME_EQ, false)) { filename.assign(dispoB); filename.strip(FILENAME_EQ.length, 0); BytesUtil.trim(src.bytes(), filename); filename.strip(1, 1); } else { filename.reset(); } return true; } return false; }
private void checkCharset(Buf src, BufRange contType, BufRange contEnc, BufRange charset, BufRange contentType) { if (contentType != null) { BytesUtil.split(src.bytes(), contentType, SEMI_COL, contType, contEnc, true); if (BytesUtil.startsWith(src.bytes(), contEnc, CHARSET_EQ, false)) { charset.assign(contEnc); charset.strip(CHARSET_EQ.length, 0); BytesUtil.trim(src.bytes(), charset); if (!BytesUtil.matches(src.bytes(), charset, _UTF_8, false) && !BytesUtil.matches(src.bytes(), charset, _ISO_8859_1, false)) { Log.warn("Tipically the UTF-8 and ISO-8859-1 charsets are expected, but received different!", "charset", src.get(charset)); } } } }
disposition.strip(FORM_DATA.length, 0); } else { return;
private void detectMultipartBoundary(Buf src, BufRange body, BufRange multipartBoundary) { BytesUtil.parseLine(src.bytes(), multipartBoundary, body.start, body.limit()); multipartBoundary.strip(2, 0); }
private boolean parseDisposition(Buf src, BufRange dispoA, BufRange dispoB, BufRange name, BufRange filename) { if (BytesUtil.startsWith(src.bytes(), dispoA, NAME_EQ, false)) { name.assign(dispoA); name.strip(NAME_EQ.length, 0); BytesUtil.trim(src.bytes(), name); name.strip(1, 1); if (BytesUtil.startsWith(src.bytes(), dispoB, FILENAME_EQ, false)) { filename.assign(dispoB); filename.strip(FILENAME_EQ.length, 0); BytesUtil.trim(src.bytes(), filename); filename.strip(1, 1); } else { filename.reset(); } return true; } return false; }
private void checkCharset(Buf src, BufRange contType, BufRange contEnc, BufRange charset, BufRange contentType) { if (contentType != null) { BytesUtil.split(src.bytes(), contentType, SEMI_COL, contType, contEnc, true); if (BytesUtil.startsWith(src.bytes(), contEnc, CHARSET_EQ, false)) { charset.assign(contEnc); charset.strip(CHARSET_EQ.length, 0); BytesUtil.trim(src.bytes(), charset); if (!BytesUtil.matches(src.bytes(), charset, _UTF_8, false) && !BytesUtil.matches(src.bytes(), charset, _ISO_8859_1, false)) { Log.warn("Tipically the UTF-8 and ISO-8859-1 charsets are expected, but received different!", "charset", src.get(charset)); } } } }
disposition.strip(FORM_DATA.length, 0); } else { return;