static void fillPost(Env env, ArrayValue postArray, ArrayValue files, InputStream @is, string contentType, string encoding, int contentLength, bool addSlashesToValues, bool isAllowUploads) { long maxPostSize = env.getIniBytes("post_max_size", 0); try { if (encoding == null) { encoding = env.getHttpInputEncoding(); } if (contentType != null && contentType.startsWith("multipart/form-data")) { string boundary = getBoundary(contentType); ReadStream rs = new ReadStream(new VfsStream(@is, null)); if (boundary == null) { env.warning(L.l("multipart/form-data POST @is missing boundary")); return; } MultipartStream ms = new MultipartStream(rs, boundary); if (encoding != null) { ms.setEncoding(encoding); } readMultipartStream(env, ms, postArray, files, addSlashesToValues, isAllowUploads); rs.close(); if (rs.getLength() > maxPostSize) { env.warning(L.l("POST length of {0} exceeds max size of {1}", rs.getLength(), maxPostSize)); postArray.clear(); files.clear(); return; } } else { StringValue bb = env.createBinaryBuilder(); bb.appendReadAll(@is, Integer.MAX_VALUE); if (bb.length() > maxPostSize) { env.warning(L.l("POST length of {0} exceeds max size of {1}", bb.length(), maxPostSize)); return; } env.setInputData(bb); if (contentType != null && contentType.startsWith("application/x-www-form-urlencoded")) { StringUtility.parseStr(env, bb, postArray, true, encoding, true); } } } catch (IOException e) { env.warning(e); } }
/** * Clears the array */ public override void clear() { _array.clear(); }