2011-11-22 6 views
0

Linux 컴퓨터에 Apache가 설치되어 있고 TCP 연결을 유지 관리하는 HTTP 클라이언트를 작성하여 웹 페이지를 검색하려고합니다. 이 HTTP 요청에 어떤 문제가 있습니까?

내가 먼저 로컬 호스트에 소켓을 열고 다음 머리 그러나

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 

기록하도록하려면, 아파치 나에게이

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> 

그 파일은 아파치처럼 보이는 잘못된 요청 오류를 제공합니다 오류 로그에 다음과 같이 표시됩니다. [Mon Nov 21 15:58:03 2011] [오류] [클라이언트 127.0.0.1] 클라이언트가 기형 호스트 헤더를 보냈습니다.

누군가 나를 도와주세요. 헤더의 문제점은 무엇입니까?

답변

3

호스트이 경우 로컬 호스트 간단해야한다 :

GET/HTTP/1.0 
Host: localhost 
... 
+0

헤이 감사 DV13. 너는 내 하루를 구했다. – Ankit

+0

물론, 문제 없습니다! – DV13

관련 문제