title: Squid-style external redirector for polipo doesn't work
body: <p>I am trying to write a trivial squid-style redirector for polipo http proxy, as specified <a href="http://www.pps.jussieu.fr/~jch/software/polipo/manual/External-redirectors.html#External-redirectors" rel="nofollow">in the documentation</a>.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#!/usr/bin/python
  
  # based on
  # http://gofedora.com/how-to-write-custom-redirector-rewritor-plugin-squid-python/
  
  import sys
  
  def modify_url(line):
      l = line.split(" ")
      old_url = l[0]
      new_url = "\n"
      if "experts-exchange" in old_url:
          new_url = "http://127.0.0.1/" + new_url
      return new_url
  
  while True:
      line = sys.stdin.readline().strip()
      new_url = modify_url(line)
      sys.stdout.write(new_url)
      sys.stdout.flush()
  </code></pre>
  
  <p>When running polipo with this redirector and trying to access <a href="http://www.experts-exchange.com/" rel="nofollow">http://www.experts-exchange.com/</a>, I get the following error:</p>
  
  <pre><code>500 Couldn't test for forbidden URL: Redirector error
  </code></pre>
  
  <p>Actually, I get the same error when trying to access any URL, which makes me think it's a problem with my redirector code.</p>
  
  <p>The output in polipo's log doesn't provide more hints, all I see there is:</p>
  
  <pre><code>Redirector returned incomplete reply.
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Edit: I have fixed modify_url() to return a value, because it did not. I'm still getting the same error.</p>