cookie被劫持java,java – HttpClient警告:Cookie被拒绝:非法域属性

在使用HttpClient 4.x版本进行GET请求时,遇到一个关于Cookie的警告。首次请求正常,但在第二次请求到不同域名(goklik.co.id)时,收到Cookie非法域属性的警告。警告信息提到Cookie的domain为'mcore.com',而请求的域是'goklik.co.id'。开发者不清楚警告的具体含义以及如何解决Cookie被拒绝的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我使用HttpClient最新版本(4.x)。现在我试图做一个GET请求。

我刚刚发布Get请求。

这是我的代码

public class Poster {

static boolean routing1 = true, routing2 = true;

static int counter1 = 0, counter2 = 0;

DefaultHttpClient oHtp = null;

HttpGet oHGet = null;

HttpResponse oHRes = null;

private void test(String fullAddress) throws Exception {

oHtp = new DefaultHttpClient();

oHGet = new HttpGet(fullAddress);

HttpResponse response = oHtp.execute(oHGet);

System.out.print(response.getStatusLine());

HttpEntity entity = response.getEntity();

if (entity != null) {

entity = new BufferedHttpEntity(entity);

// System.out.println(EntityUtils.toString(entity));

System.out.print("\t entity is retrieved... ");

}

oHtp.getConnectionManager().shutdown();

}

}

我只是很好地执行它。

首先是

new Poster().test("http://123.xl.co.id/profile.php");

第二是

new Poster().test("http://goklik.co.id/");

ya,只有第二个….我得到这个错误信息;

Sep 18, 2011 10:11:30 AM

org.apache.http.client.protocol.ResponseProcessCookies processCookies

WARNING: Cookie rejected: “[version: 0][name: CookiePst][value:

0149=xwGHF7HYDHLHQ84Isp/eSy9vu+Xq6cT12wxg1A==][domain:

.mcore.com][path: /][expiry: Sun Sep 18 10:38:59 ICT 2011]”. Illegal

domain attribute “mcore.com”. Domain of origin: “goklik.co.id”

我意识到Cookie在这里涉及。但我不明白警告是什么意思。而且我也不知道如何解决它(Cookie不被拒绝)。 HOpe有一点点清楚我的想法从你们….:D

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值