コード例 #1
0
        public static HTTPRequest HttpCallback(HTTPResponse response)
        {
            SpiderRequest request   = response.request.Addition as SpiderRequest;
            var           sResponse = new SpiderResponse(request, response);

            sResponse = RunResponseMiddleware(currentSpider._ResponseMiddleware, sResponse);
            if (sResponse == null)
            {
                return(null);
            }
            else
            {
                var n = request.callback(sResponse);
                if (!isRunning)
                {
                    return(null);
                }
                if (n == null)
                {
                    return(null);
                }
                n = RunRequestMiddleware(currentSpider._RequestMiddleware, n);
                return(response.MakeRequest(n.method, n.Url, n, HttpCallback, n.Cookie, n.AdditionHeader, n.PostData));
            }
        }
コード例 #2
0
 static SpiderResponse RunResponseMiddleware(List <ResponseMiddlewareBase> middlewareList, SpiderResponse response)
 {
     foreach (var item in middlewareList)
     {
         response = item.Process(response);
         if (response == null)
         {
             return(null);
         }
     }
     return(response);
 }
コード例 #3
0
 abstract public SpiderRequest Start(SpiderResponse response);