title: Django: 400 bad request syntax - what does this message mean?
body: <p>I am using django to build a simple website. When you type the base address (which for now is <code>127.0.0.1:8000/</code>), I use django to show a view which does some checks and redirects you based on your user privileges. (If you have admin privileges, you go to <code>/admin</code>, if you don't you go to <code>/home</code>, and if you aren't logged in you go to <code>/login</code>.)</p>
  
  <p>When I make that HTTP request, I get redirected <em>as I should</em> but I also see the following two errors in my django log:</p>
  
  <ol>
  <li>code 400, message Bad request syntax <code>('\x16\x03\x01\x00\x95\x01\x00\x00\x91\x03\x01N\xaa\x9c\x08\x96\x7f\x92\xe9Z\x925\xcaY4\xa6\xa5\xab\xf2\x16\xfaT\x89\xe7\x8a\xc3\x99J)6\xfb\xc44\x00\x00H\xc0')</code></li>
  <li><code>"??N????Z?5?Y4?????T??ÙJ)6??4H?" 400 -</code></li>
  </ol>
  
  <p>I translated the hex in the first one to be (spaces added for legibility): <code>SYN ETX NUL NUL U SOH NUL NUL Q ETX NUL N 170 156 X r 246 STX 141 214 ? 143 EOT FS j 142 223 s 241 220 &lt; 185 \ \ m 242 &amp;</code></p>
  
  <p>I can certainly see why the server wouldn't like that as a request, but I have no idea where it's coming from.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks very much.</p>
  
  <p>==============</p>
  
  <p>Here is the code for the view:</p>
  
  <pre><code>def index(request):
      user = request.user
      admin_courses = []
  
      if (user.is_authenticated()):
          u_id = user.getUserId()
          my_enrollment = Enrollment.objects.filter(user_id=u_id)
          admin_enrollment = my_enrollment.filter(type="ADMIN")
          for enr in admin_enrollment:
              course = Course.objects.get(id=enr.getCourseId())
              admin_courses.append(course)
          if (len(admin_courses)&gt;0):
              return HttpResponseRedirect('/admin')
          else:
              return HttpResponseRedirect('/home')
      return HttpResponseRedirect('/login')
  </code></pre>