public void parseHeadersIntoKV(Buf buf, BufRanges headers, KeyValueRanges headersKV, KeyValueRanges cookies, RapidoidHelper helper) { BufRange cookie = helper.ranges5.ranges[0]; for (int i = 0; i < headers.count; i++) { BufRange hdr = headers.ranges[i]; int ind = headersKV.add(); BufRange key = headersKV.keys[ind]; BufRange val = headersKV.values[ind]; assert !hdr.isEmpty(); boolean split = BytesUtil.split(buf.bytes(), hdr, COL, key, val, true); U.must(split, "Invalid HTTP header!"); if (cookies != null && BytesUtil.matches(buf.bytes(), key, COOKIE, false)) { headersKV.count--; // don't include cookies in headers do { BytesUtil.split(buf.bytes(), val, SEMI_COL, cookie, val, true); int cind = cookies.add(); BytesUtil.split(buf.bytes(), cookie, EQ, cookies.keys[cind], cookies.values[cind], true); } while (!val.isEmpty()); } } }
private void parseURLEncodedKV(Buf buf, KeyValueRanges params, BufRange body) { int pos = buf.position(); int limit = buf.limit(); buf.position(body.start); buf.limit(body.limit()); while (buf.hasRemaining()) { int ind = params.add(); int which = buf.scanTo(EQ, AMP, params.keys[ind], false); if (which == 1) { buf.scanTo(AMP, params.values[ind], false); } } buf.position(pos); buf.limit(limit); }
int ind = data.add(); data.keys[ind].assign(name); data.values[ind].assign(partBody);
public void parseHeadersIntoKV(Buf buf, BufRanges headers, KeyValueRanges headersKV, KeyValueRanges cookies, RapidoidHelper helper) { BufRange cookie = helper.ranges5.ranges[0]; for (int i = 0; i < headers.count; i++) { BufRange hdr = headers.ranges[i]; int ind = headersKV.add(); BufRange key = headersKV.keys[ind]; BufRange val = headersKV.values[ind]; assert !hdr.isEmpty(); boolean split = BytesUtil.split(buf.bytes(), hdr, COL, key, val, true); U.must(split, "Invalid HTTP header!"); if (cookies != null && BytesUtil.matches(buf.bytes(), key, COOKIE, false)) { headersKV.count--; // don't include cookies in headers do { BytesUtil.split(buf.bytes(), val, SEMI_COL, cookie, val, true); int cind = cookies.add(); BytesUtil.split(buf.bytes(), cookie, EQ, cookies.keys[cind], cookies.values[cind], true); } while (!val.isEmpty()); } } }
private void parseURLEncodedKV(Buf buf, KeyValueRanges params, BufRange body) { int pos = buf.position(); int limit = buf.limit(); buf.position(body.start); buf.limit(body.limit()); while (buf.hasRemaining()) { int ind = params.add(); int which = buf.scanTo(EQ, AMP, params.keys[ind], false); if (which == 1) { buf.scanTo(AMP, params.values[ind], false); } } buf.position(pos); buf.limit(limit); }
int ind = data.add(); data.keys[ind].assign(name); data.values[ind].assign(partBody);