diff --git a/spider-flow-core/src/main/java/org/spiderflow/core/executor/shape/RequestExecutor.java b/spider-flow-core/src/main/java/org/spiderflow/core/executor/shape/RequestExecutor.java index 84ebaed..f939f65 100644 --- a/spider-flow-core/src/main/java/org/spiderflow/core/executor/shape/RequestExecutor.java +++ b/spider-flow-core/src/main/java/org/spiderflow/core/executor/shape/RequestExecutor.java @@ -23,6 +23,8 @@ import org.spiderflow.model.SpiderNode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; + /** * 请求执行器 * @author Administrator @@ -79,6 +81,12 @@ public class RequestExecutor implements ShapeExecutor,Grammerable{ return "request"; } + @PostConstruct + void init(){ + //允许设置被限制的请求头 + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + } + @Override public void execute(SpiderNode node, SpiderContext context, Map variables) { String sleepCondition = node.getStringJsonValue(SLEEP);