2013-07-23 2 views
2

그러나 인디 10의 GET 메서드를 사용하려고하는데 URL 길이가 255자를 초과합니다. 그리고 GET 메서드는 "문자열"매개 변수 만 허용합니다. 이 문제를 해결하기 위해 모든 솔루션 또는 다른 타사 구성 요소가Delphi - Indy TIdHttp.Get 큰 URL 길이로

"String literals may have at most 255 elements"

있습니까 :

body := httpCom.Get('..........wide string.........') 

델파이의 컴파일러

내게 오류를 준다?

+1

중복 가능성 [델파이 방법을 '문자열'리터 이상 255 일? (http://stackoverflow.com/questions/8767899/how-can-delphi- string-literals-be-more-than-255) – bummi

답변

6

하는 문자열 유형하지만 IDE의 문제 없다 , 당신은 이것을 이렇게 쓸 수있다.

Const 
    C_URL = 'A long text with 255 Characters ....to be contionued ...' 
      +'more content....to be contionued ... ' 
      +'more more content....to be contionued ... ' 
      +'enough content'; 
begin 
    IDHTTP1.Get(C_URL); 
end; 

또는

IDHTTP1.Get('A long text with 255 Characters ....to be contionued ...' 
      +'more content....to be contionued ... ' 
      +'more more content....to be contionued ... ' 
      +'enough content'); 
+2

OMG! 효과가 있습니다! Thaaaaanks sooo 많은 친구! – user2611996

3

TIdHTTP은 255 자 제한을 제외하고 URL 길이에 제한을 두지 않습니다. 그러나, HTTP 서버는 마지막에 이러한 제한을 부과 할 수 있으며 그 다음 않는 경우 요청이 RFC 2616 Section 10.4.15 당은 HTTP 414 Request-URI Too Long 오류 코드와 함께 실패한다 :

10.4.15 414 Request-URI Too Long

The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a URI "black hole" of redirection (e.g., a redirected URI prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit security holes present in some servers using fixed-length buffers for reading or manipulating the Request-URI.

+0

서버에서 결과 오류가 표시되지 않습니다. 델파이의 컴파일러는 다음과 같은 오류 메시지를 표시합니다 : "문자열 리터럴에는 최대 255 개의 요소가있을 수 있습니다". 코드 : body : = httpCom.Get ('.......... 와이드 문자열 .........'); – user2611996

+2

질문에 답변을 드릴 수는 없지만 누군가가 Google에 전화를 걸면 예를 들어,이 답변을 게시했다고 생각합니다. [ 'TIdHTTP URL length'] (http://www.google.com/?q=TIdHTTP%20URL%20length) 그러면 질문에 답할 것이고이 게시물은 TIdHTTP 컨트롤과 HTTP 프로토콜 자체의 URL 길이 제한을 설명합니다 . 그리고 그건 내 생각에 괜찮아. – TLama

관련 문제