title: Scrapy: cannot change url of request object in process_request of DownloadMiddleware
body: <p>I am trying to build a download milddleware of scrapy which can change the url of request object. But I cannot get it work with process_request, as the download page is still the original url one. my code is as follows:</p>
  
  <pre><code>#middlewares.py
  class UrlModifyMiddleware(object):
      def process_request(self, request, spider):
          original_url = request.url
          m_url = 'http://whatsmyuseragent.com/'
          request.url = m_url
          #request = request.replace(url=relay_url)
  </code></pre>
  
  <p>The code for spider:</p>
  
  <pre><code>#spider/test_spider.py
  from scrapy.contrib.spiders import CrawlSpider
  from scrapy.http import Request
  
  class TestSpider(CrawlSpider):
      name = "urltest"
      start_url = "http://www.icanhazip.com/"
  
      def start_requests(self):
          yield Request(self.start_url,callback=self.parse_start) 
  
      def parse_start(self,response):
          html_page = response.body
          open('test.html', 'wb').write(html_page)
  </code></pre>
  
  <p>In settings.py I set:</p>
  
  <pre><code>DOWNLOADER_MIDDLEWARES = {
      'official_index.middlewares.UrlModifyMiddleware': 100,
  }
  </code></pre>