Exemple #1
0
        private sRequest buildHttpRequest(HttpRequestWrapper request)
        {
            Uri url = ValidateUrl(request.getParameter(URL_PARAM));

            sRequest req = new sRequest(url);

            req.Container = getContainer(request);
            if (request.getParameter(GADGET_PARAM) != null)
            {
                req.setGadget(Uri.parse(request.getParameter(GADGET_PARAM)));
            }

            // Allow the rewriter to use an externally forced mime type. This is needed
            // allows proper rewriting of <script src="x"/> where x is returned with
            // a content type like text/html which unfortunately happens all too often
            req.RewriteMimeType = request.getParameter(REWRITE_MIME_TYPE_PARAM);

            req.setIgnoreCache(getIgnoreCache(request));
            // If the proxy request specifies a refresh param then we want to force the min TTL for
            // the retrieved entry in the cache regardless of the headers on the content when it
            // is fetched from the original source.
            if (request.getParameter(REFRESH_PARAM) != null)
            {
                int ttl = 0;
                int.TryParse(request.getParameter(REFRESH_PARAM), out ttl);
                req.CacheTtl = ttl;
            }

            return(req);
        }