{"action":"opened","issue":{"url":"https://api.github.com/repos/CrawlScript/WebCollector/issues/35","repository_url":"https://api.github.com/repos/CrawlScript/WebCollector","labels_url":"https://api.github.com/repos/CrawlScript/WebCollector/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/CrawlScript/WebCollector/issues/35/comments","events_url":"https://api.github.com/repos/CrawlScript/WebCollector/issues/35/events","html_url":"https://github.com/CrawlScript/WebCollector/issues/35","id":143800997,"number":35,"title":"最新版的有在重定向时set cookie吗？","user":{"login":"zemochen","id":5241928,"avatar_url":"https://avatars.githubusercontent.com/u/5241928?v=3","gravatar_id":"","url":"https://api.github.com/users/zemochen","html_url":"https://github.com/zemochen","followers_url":"https://api.github.com/users/zemochen/followers","following_url":"https://api.github.com/users/zemochen/following{/other_user}","gists_url":"https://api.github.com/users/zemochen/gists{/gist_id}","starred_url":"https://api.github.com/users/zemochen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zemochen/subscriptions","organizations_url":"https://api.github.com/users/zemochen/orgs","repos_url":"https://api.github.com/users/zemochen/repos","events_url":"https://api.github.com/users/zemochen/events{/privacy}","received_events_url":"https://api.github.com/users/zemochen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-27T11:37:56Z","updated_at":"2016-03-27T11:37:56Z","closed_at":null,"body":"我用的不是最新版的，最近遇到重定向逻辑问题，场景如下：\r\n模拟登陆，自动获取授权码，目标网页登陆（简称：A）后会重定向到用户首页（简称：B），同事给一个set-cookie的请求头，重定向到B时，如果没有把set-cookie中的cookie放入到“Cookie”中，就会造成一直反复重定向。\r\n\r\n所以我在httpRequest.getResponse()中加入如下代码：\r\n`\r\nString newCookie = con.getHeaderField(\"Set-Cookie\");\r\n if (StringUtils.isNotBlank(newCookie)) {\r\n      this.setCookie(newCookie);\r\n      response.addHeader(\"Cookie\", newCookie);\r\n      this.crawlDatum.putMetaData(\"Cookie\", newCookie);\r\n}\r\n`\r\n\r\n这样就避免登陆成功因为没有setCookie导致重定向后又重定向会登陆页面的死循环，同时可以在后面的crawl中继续使用这个Cookie,知道新的“set-cookie”出现。\r\n如果需要的话我可以吧重写的httpRequest给你你review一下，或者我push到我的fork中."}}