HttpClient - Trouble Shooting HttpClient
Author: Adrian Sutton

##### Overview

- Features
- News
- Status
- Download
- Wiki
- User Guide
  - Authentication Guide
  - Character Encodings
  - Cookies
  - Exception Handling
  - Logging Guide
  - Methods
  - Optimization Guide
  - Preference Architecture
  - Redirects Handling
  - Sample Code
  - SSL Guide
  - Threading
  - Trouble Shooting
  - Tutorial
- Developer Guide

##### Project Documentation

- About
- Project Info
- Project Reports
- Development Process

##### Legend

- External Link
- Opens in a new window

## Introduction

This document outlines some of the techniques that often help when trying to track down a problem in HttpClient. Please try the suggestions on this page before emailing the user or dev lists with questions. If none of these things help, please provide the information they provide to help the developers track down the problem.

## Things To Try

1. Try connecting with a normal browser and make sure the server gives the right response.
2. If you're using a proxy server try without it if possible.
3. Try the same code on a different server (preferably running different server software).
4. Check that your code matches the general pattern for using HttpClient as described in the tutorial.
5. Set the `User-Agent` request header to masquerade HttpClient as a popular browser such as IE or Firefox. Certain web sites are optimized to work with just one or a number of specific browser applications. These sites frequently reject requests originating from user agents they do not recognize. For example, setting the `User-Agent` request header to `Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)` would deceive the target server into believing that the request was issues by Microsoft Internet Explorer 6.0 on Windows 2000.
6. Set the logging level to debug and check the output for the cause of the problem.
7. Enable the wire trace and follow the communication between the client and server to determine where the problem is occurring.
8. Consult the "Known limitations and problems" section of the SSL Guide and the Authentication Guide to see if this is a known problem and follow the instructions given in these resources
9. Use telnet or netcat to manually send the request to the server. This is particularly useful once you think you know what the problem is and you want to easily test that changing what HttpClient sends will fix it.
10. Use netcat in listen mode to act as the server and check how HttpClient handles various responses.
11. Try updating to the latest nightly build of HttpClient. Bugs happen and they are generally fixed pretty quickly so testing against the latest build is often worthwhile.

## Asking For Help

If you've tried the things above and still can't work out how to fix the problem, it might be time to contact the mailing list for support. All questions, bug reports etc should be directed to the HttpClient user list.

When you do send off the email, please include as much detail as you can, particularly inlined wire trace logs as there is almost nothing we can do to help without them. If you are seeing exceptions being thrown, the full stack trace is essential to tracking down the problem. Any of the information you gained from the "things to try" section above are probably worth mentioning.

## Reporting Bugs

If you're fairly certain that the problem is a bug in HttpClient, log it in JIRA. Make sure you spend some time searching the existing bugs to make sure it hasn't already been logged. If you're unsure about whether or not to log something in JIRA, it's probably worth bringing it up on the developer mailing list to clarify the situation.