Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7678755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:43:13+00:00 2026-05-31T17:43:13+00:00

HttpGet request = new HttpGet(https://192.168.1.140:8732/…); I wonder why I can only send successfully for

  • 0
HttpGet request = new HttpGet("https://192.168.1.140:8732/...);

I wonder why I can only send successfully for custom headers : UserName and AuthToken if I do the following:

    request.setHeader("User-Agent", "android_client");
    request.setHeader("Host", "192.168.1.140:8732");
    request.addHeader("UserName", mUserName);
    request.addHeader("AuthToken", mAuthorizationToken);

Why is that this code NOT sending the UserName but AuthToken only? When the two bottom lines are reversed.

    request.setHeader("User-Agent", "android_client");
    request.setHeader("Host", "192.168.1.140:8732");
    request.addHeader("AuthToken", mAuthorizationToken);
    request.addHeader("UserName", mUserName);

Why is this code failing with 400 error code, invalid hostname when I don’t specific the host

//  request.setHeader("User-Agent", "android_client");
//  request.setHeader("Host", "192.168.1.140:8732");
    request.addHeader("UserName", mUserName);
    request.addHeader("AuthToken", mAuthorizationToken);

If I don’t need to send the UserName and AuthToken, I don’t really need to set the Host and it works just fine with the code commented out like following

//  request.setHeader("User-Agent", "android_client");
//  request.setHeader("Host", "192.168.1.140:8732");

Though I don’t think that it is related, I want to disclose that I am using self-signed certificate for these http call from android following this blog. Looking forward to the divine revelation for my poor http soul …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:43:15+00:00Added an answer on May 31, 2026 at 5:43 pm

    It is a fluke. I couldn’t reproduce it anymore. I have been working with the working solution and left it for a while working on different project. I come back and take a look with wire /context logging at oleg suggestion with the help of How to enable logging for apache commons HttpClient on Android I couldn’t reproduce the problem anymore. The power of the logging has scared the problem away. Will update if the problem occurs again and if I find out the cause.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My HttpClient, HttpPost, or HttpGet method is only working once. I can successfully log
My application should send a https GET request. Every time I get an exception
I'm trying to instantiate an HttpGet Object so that I can send a get
I am trying to send a cookie along with my HttpGet request, but everytime
I have the following REST get Request that works successfully: The result is a
I am making an HTTP get request to a website for an android application
Is there a way to perform an HTTP GET request within a Visual Basic
What's the maximum length of an HTTP GET request? Is there a response error
Is it possible to pass parameters with an HTTP get request? If so, how
What is the best way to make an HTTP GET request in Ruby with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.