MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / HttpHeader

Method HttpHeader

src/main/java/core/packetproxy/http/HttpHeader.java:132–150  ·  view source on GitHub ↗
(byte[] rawHttp)

Source from the content-addressed store, hash-verified

130 }
131
132 public HttpHeader(byte[] rawHttp) {
133 newLineSymbol = lookUpNewLineSymbol(rawHttp);
134 String newLineStr = newLineSymbol;
135 // パケットの先頭に改行が含まれているパターンがあるので回避
136 if (Utils.indexOf(rawHttp, 0, newLineSymbol.length(), newLineSymbol.getBytes()) >= 0) {
137
138 rawHttp = ArrayUtils.subarray(rawHttp, newLineSymbol.length(), rawHttp.length);
139 }
140 byte[] headerDelim = (newLineStr + newLineStr).getBytes(StandardCharsets.UTF_8);
141 int headerPos = Utils.indexOf(rawHttp, 0, rawHttp.length, headerDelim);
142 if (headerPos < 0) {
143
144 headerPos = rawHttp.length;
145 }
146 String header = toUTF8(ArrayUtils.subarray(rawHttp, 0, headerPos));
147 List<String> lines = Arrays.asList(header.split(newLineStr));
148 statusLine = lines.get(0);
149 fields = lines.subList(1, lines.size()).stream().map(HeaderField::new).collect(Collectors.toList());
150 }
151
152 public String getStatusline() {
153 return statusLine;

Callers

nothing calls this directly

Calls 10

lookUpNewLineSymbolMethod · 0.95
indexOfMethod · 0.95
toUTF8Method · 0.95
lengthMethod · 0.80
toListMethod · 0.80
getBytesMethod · 0.65
getMethod · 0.45
mapMethod · 0.45
streamMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected