使用Java中的http中的client发起请求,在请求中添加header,当请求的链接为http时,header可以设置成功,但是使用https时,header却无法添加到头部
URLConnection conn = url.openConnection(proxy);
String headerkey = "waht i want to add ";
String s = "";
byte[] ss =s.getBytes();
String psaa =new String(Base64.encodeBase64((ss),false));
System.out.print(psaa+"\n");
String headerValue = "Basic " + psaa;
conn.setRequestProperty(headerkey, headerValue);
请问这是啥原因?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
业精于勤,荒于嬉;行成于思,毁于随。