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

  • SEARCH
  • Home
  • 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 6853371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:30:16+00:00 2026-05-27T01:30:16+00:00

I have a Apache installed on my Linux machine and I am trying to

  • 0

I have a Apache installed on my Linux machine and I am trying to write a HTTP client that maintains a TCP connection to retrieve a web-page.

To do that I, first open a socket to localhost and write the following head

GET / HTTP/1.0
Host: http://localhost:80
User-Agent: My-User-Agent 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cache-Control: no-cache
Accept-Language: en;q=0.7,en-us;q=0.3
Connection: close

However, apache gives me a Bad Request error, which looks like this

HTTP/1.1 400 Bad Request
Date: Mon, 21 Nov 2011 23:58:03 GMT
Server: Apache/2.2.20 (Ubuntu)
Vary: Accept-Encoding
Content-Length: 311
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<html><head>
<title>400 Bad Request</title> </head><body> <h1>Bad Request</h1>
<p>Your browser sent a request that this server could not 
understand.<br /> </p> <hr> <address>Apache/2.2.20 (Ubuntu) Server at
http://localhost:80 Port 80</address> </body></html>

The apache error log says this:
[Mon Nov 21 15:58:03 2011] [error] [client 127.0.0.1] Client sent malformed Host header

Can someone please help me with this. What is wrong with the header?

  • 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-27T01:30:17+00:00Added an answer on May 27, 2026 at 1:30 am

    Host should be simple localhost in this case:

    GET / HTTP/1.0
    Host: localhost
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows XP machine that has Apache installed via a VisualSVNServer installation.
I have installed Apache web server on Redhat Linux and able to access the
I have installed PHP, Apache in my Linux server. http://localhost/index.htm displaying correctly. To test
I have two machines I work on: Windows Client (Development Machine) Linux Web Server
I have apache web server installed as frontend and I have j2ee SAP Netweaver
I have just installed CentOS, Apache and PHP. When I visit my site http://example.com/myapp/
I have installed native apache and mysql,php in my linux server. I tried a
I have a linux server running ubuntu 10.10 maverick with apache and php installed,
I have set up a Linux Server and installed Apache and SVN and dav_svn
I have installed sun jdk 1.6 x64 and tomcat in a linux x64 machine

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.