title: http post including file fails on site with password protection
body: <p>My Android app makes two HTTP POSTS to my website, one a simple POST with a return value, the second a POST with an attached file.</p>
  
  <p>Without password protection it works fine.
  When I add password protection to that directory on my server (with .htaccess editor), the first POST is successful, but the second one fails with clientProtocolException.
  Both calls are to php scripts in the same client folder.
  I'm using com.loopj.android.http.AsyncHttpClient
  Here's the relevant code:
  First call:</p>
  
  <pre><code>PersistentCookieStore myCookieStore = new PersistentCookieStore(mContext);
  mClient.setCookieStore(myCookieStore);
      mClient.setBasicAuth("userId","password");
      mClient.post(url, new AsyncHttpResponseHandler() {              
                  @Override
                  public void onSuccess(String response) {
  </code></pre>
  
  <p>Second call:</p>
  
  <pre><code>        RequestParams mParams = new RequestParams();            
          mParams.put("trackFile", new ByteArrayInputStream(arr));
          mParams.put("fileName",logDate ); 
          mParams.put("version", VERSION);
          String url = WEB_URL + "sendFile.php";
          AsyncHttpClient mClient = new AsyncHttpClient();
          PersistentCookieStore myCookieStore = new PersistentCookieStore(mContext);
          mClient.setCookieStore(myCookieStore);
          mClient.setBasicAuth("userId","password");
          mClient.post(url, mParams, new AsyncHttpResponseHandler() {
                  @Override
                  public void onSuccess(String response) {
  </code></pre>
  
  <p>Definitely works with no password protection and fails on second call returning</p>
  
  <p>org.apache.http.client.clientProtocolException </p>
  
  <p>in the onFailure function.
  I have concluded that the problem lies with the attached file :</p>
  
  <pre><code>mParams.put("trackFile", new ByteArrayInputStream(arr)); 
  </code></pre>
  
  <p>but can't get any further.</p>