MCPcopy Create free account
hub / github.com/c0ny1/captcha-killer / updateContentLength

Method updateContentLength

src/main/java/utils/HttpClient.java:167–187  ·  view source on GitHub ↗

更新请求包的Content-Length头 注意:不更新该头部,可能会导致服务端无法获取完整的请求信息。 @return

()

Source from the content-addressed store, hash-verified

165 * @return
166 */
167 public void updateContentLength(){
168 /**
169 * 在处理GET数据包时,要注意包结果严格来讲最后要有两个\r\n。有的web服务器对数据包要求比较严格,可能会导致请求识别。
170 * 该问题曾出现在请求某网站的验证码时,返回了403状态。
171 */
172 if(method.equals("POST")) {
173 int length = data.length();
174 headers.put("Content-Length", String.valueOf(length));
175 String reqLine = String.format("%s %s %s",method,path,httpversion);
176 reqLine += "\r\n";
177 for(Map.Entry<String,String> header:headers.entrySet()){
178 String line = String.format("%s: %s",header.getKey(),header.getValue());
179 reqLine += line;
180 reqLine += "\r\n";
181 }
182
183 reqLine += "\r\n";
184 reqLine += data;
185 this.raw = reqLine;
186 }
187 }
188
189
190 public byte[] doReust(){

Callers 1

HttpClientMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected