|
@@ -443,6 +443,12 @@ function DecodeURLElement(const S: UnicodeString): UnicodeString;
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
|
|
+{$IFDEF FPC_DOTTEDUNITS}
|
|
|
|
+uses System.StrUtils;
|
|
|
|
+{$ELSE}
|
|
|
|
+uses StrUtils;
|
|
|
|
+{$ENDIF}
|
|
|
|
+
|
|
resourcestring
|
|
resourcestring
|
|
SErrInvalidProtocol = 'Invalid protocol : "%s"';
|
|
SErrInvalidProtocol = 'Invalid protocol : "%s"';
|
|
SErrReadingSocket = 'Error reading data from socket';
|
|
SErrReadingSocket = 'Error reading data from socket';
|
|
@@ -1023,7 +1029,7 @@ Var
|
|
|
|
|
|
begin
|
|
begin
|
|
S:=Uppercase(GetNextWord(AStatusLine));
|
|
S:=Uppercase(GetNextWord(AStatusLine));
|
|
- If (Copy(S,1,5)<>'HTTP/') then
|
|
|
|
|
|
+ If StartsStr('HTTP/',S) then
|
|
Raise EHTTPClient.CreateFmt(SErrInvalidProtocolVersion,[S]);
|
|
Raise EHTTPClient.CreateFmt(SErrInvalidProtocolVersion,[S]);
|
|
System.Delete(S,1,5);
|
|
System.Delete(S,1,5);
|
|
FServerHTTPVersion:=S;
|
|
FServerHTTPVersion:=S;
|
|
@@ -1071,7 +1077,7 @@ begin
|
|
if ReadString(S) and (S<>'') then
|
|
if ReadString(S) and (S<>'') then
|
|
begin
|
|
begin
|
|
ResponseHeaders.Add(S);
|
|
ResponseHeaders.Add(S);
|
|
- If (LowerCase(Copy(S,1,Length(SetCookie)))=SetCookie) then
|
|
|
|
|
|
+ If StartsText(SetCookie,S) then
|
|
DoCookies(S);
|
|
DoCookies(S);
|
|
end
|
|
end
|
|
Until (S='') or Terminated;
|
|
Until (S='') or Terminated;
|
|
@@ -1117,7 +1123,7 @@ begin
|
|
While (Result=-1) and (I<FResponseHeaders.Count) do
|
|
While (Result=-1) and (I<FResponseHeaders.Count) do
|
|
begin
|
|
begin
|
|
S:=Trim(LowerCase(FResponseHeaders[i]));
|
|
S:=Trim(LowerCase(FResponseHeaders[i]));
|
|
- If (Copy(S,1,Length(Cl))=Cl) then
|
|
|
|
|
|
+ If StartsStr(Cl,S) then
|
|
begin
|
|
begin
|
|
System.Delete(S,1,Length(CL));
|
|
System.Delete(S,1,Length(CL));
|
|
Result:=StrToInt64Def(Trim(S),-1);
|
|
Result:=StrToInt64Def(Trim(S),-1);
|
|
@@ -1141,7 +1147,7 @@ begin
|
|
While (I<FResponseHeaders.Count) do
|
|
While (I<FResponseHeaders.Count) do
|
|
begin
|
|
begin
|
|
S:=Trim(LowerCase(FResponseHeaders[i]));
|
|
S:=Trim(LowerCase(FResponseHeaders[i]));
|
|
- If (Copy(S,1,Length(Cl))=Cl) then
|
|
|
|
|
|
+ If StartsStr(Cl,S) then
|
|
begin
|
|
begin
|
|
System.Delete(S,1,Length(CL));
|
|
System.Delete(S,1,Length(CL));
|
|
Result:=Trim(S);
|
|
Result:=Trim(S);
|
|
@@ -1582,7 +1588,7 @@ begin
|
|
H:=LowerCase(Aheader)+':';
|
|
H:=LowerCase(Aheader)+':';
|
|
l:=Length(H);
|
|
l:=Length(H);
|
|
Result:=HTTPHeaders.Count-1;
|
|
Result:=HTTPHeaders.Count-1;
|
|
- While (Result>=0) and ((LowerCase(Copy(HTTPHeaders[Result],1,l)))<>h) do
|
|
|
|
|
|
+ While (Result>=0) and not StartsText(H,HTTPHeaders[Result]) do
|
|
Dec(Result);
|
|
Dec(Result);
|
|
end;
|
|
end;
|
|
|
|
|