4 HttpApp
\82Ì
\83N
\83\8d\81[
\83\93\82â
\82»
\82Ì
\91¼
\8eG
\97p
\8aÖ
\90\94
8 //==================================================
10 //==================================================
14 procedure ExtractHttpFields(
15 const chrSep : TSysCharSet;
16 const chrWhite : TSysCharSet;
17 const strValue : string;
18 var strResult : TStringList;
19 unknownFlag : boolean = false
23 const strValue : string
27 const strValue : string
31 const strValue : string
35 const strValue : string
39 const filename, mask : string
42 //
\83\81\83^
\83L
\83\83\83\89\83N
\83^
\82ð
\90³
\8bK
\95\
\8c»
\88µ
\82¢
\82É
\82È
\82ç
\82È
\82¢
\82æ
\82¤
\82É
\92u
\8a·
43 function RegExpEncode(
47 //==================================================
49 //==================================================
50 kYofKanji : TSysCharSet = [#$80..#$A0, #$E0..#$ff];
52 //==================================================
54 //==================================================
56 //
\82Æ
\82è
\82 \82¦
\82¸
\82Ì
\91ã
\97p
\95i
\82È
\82Ì
\82Å chrWhite
\82ð
\8dl
\97¶
\82µ
\82Ä
\82¢
\82È
\82¢
\82±
\82Æ
\82É
\92\8d\88Ó
\81I
\81I
\81I
57 procedure ExtractHttpFields(
58 const chrSep : TSysCharSet;
59 const chrWhite : TSysCharSet;
60 const strValue : string;
61 var strResult : TStringList;
62 unknownFlag : boolean = false
65 last, p, strLen : Integer;
68 strLen := Length( strValue );
75 if strValue[ p ] in chrSep then
77 strResult.Add( Copy( strValue, last, p - last ) );
86 strResult.Add( Copy( strValue, last, strLen - last + 1 ) );
91 const strValue : string
99 strLen := Length( strValue );
105 case strValue[ i ] of
108 strResult := strResult + '&';
112 strResult := strResult + '<';
116 strResult := strResult + '>';
120 strResult := strResult + '"';
124 if strValue[ i ] in kYofKanji then
126 strResult := strResult + strValue[ i ];
129 strResult := strResult + strValue[ i ];
142 const strValue : string
148 strResult := StringReplace( strValue, '<', '<', [rfReplaceAll] );
149 strResult := StringReplace( strResult, '>', '>', [rfReplaceAll] );
150 strResult := StringReplace( strResult, '"', '"', [rfReplaceAll] );
151 strResult := StringReplace( strResult, '&', '&', [rfReplaceAll] );
158 const strValue : string
166 kHexCode : array [0..15] of char = (
167 '0', '1', '2', '3', '4', '5', '6', '7',
168 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' );
171 strLen := Length( strValue );
177 case strValue[ i ] of
178 '0' .. '9', 'a' .. 'z', 'A' .. 'Z', '*', '-', '.', '@', '_':
180 strResult := strResult + strValue[ i ];
184 b := Integer( strValue[ i ] );
185 strResult := strResult + '%'
186 + kHexCode[ b div $10 ]
187 + kHexCode[ b mod $10 ];
203 mov ecx, eax // ecx = (ch - 'a')
205 cmp ecx, 26 // edx = ecx < 26 (
\8f¬
\95¶
\8e\9a\82È
\82ç
\83t
\83\8b\83r
\83b
\83g)
207 and edx, $20 // edx &= 0x20 (
\8f¬
\95¶
\8e\9a\82È
\82ç 0x20)
208 xor eax, edx // eax ^= edx
212 const strValue : string
221 strLen := Length( strValue );
227 if '%' = strValue[ i ] then begin
229 if strValue[ i ] in ['a' .. 'z', 'A' .. 'Z'] then
230 b := (toupper( Longword( strValue[ i ] ) ) - 55) shl 4
232 b := (Byte( strValue[ i ] ) - Byte( '0' )) shl 4;
234 if strValue[ i ] in ['a' .. 'z', 'A' .. 'Z'] then
235 b := b or (toupper( Longword( strValue[ i ] ) ) - 55)
237 b := b or (Byte( strValue[ i ] ) - Byte( '0' ));
239 strResult := strResult + Char( Byte( b ) );
241 strResult := strResult + strValue[ i ];
252 //
\82Æ
\82è
\82 \82¦
\82¸
\82Ì
\91ã
\97p
\95i
\82È
\82Ì
\82Å []
\82ð
\8eg
\82Á
\82½
\90³
\8bK
\95\
\8c»
\82ð
\8dl
\97¶
\82µ
\82Ä
\82¢
\82È
\82¢
\82±
\82Æ
\82É
\92\8d\88Ó
\81I
\81I
\81I
253 function MatchesMask(
254 const filename, mask : string
257 pName, pMask : Integer;
258 ptrName, ptrMask : PChar;
259 nameLen, maskLen : Integer;
261 delimiterPos : Integer;
264 nameLen := Length( filename );
265 maskLen := Length( mask );
266 ptrName := PChar( filename );
267 ptrMask := PChar( mask );
270 delimiterPos := Pos( '\', string( ptrName + pName ) );
271 while delimiterPos > 0 do
273 pName := pName + delimiterPos;
274 delimiterPos := Pos( '\', string( ptrName + pName ) );
277 while (pMask < maskLen) and (pName < nameLen) do
280 case ptrMask[ pMask ] of
283 //
\82±
\82Ì 1
\8e\9a\82Í
\89½
\82à
\82µ
\82È
\82¢
288 // mask
\82ð
\91\96\8d¸
\82µ
\90Ø
\82Á
\82½
\82ç
\8fI
\97¹
289 if pMask >= maskLen then
295 // *
\82Ì
\8e\9f\82Ì
\95¶
\8e\9a\82ª
\97\88\82é
\82Ü
\82Å
\94ò
\82Î
\82·
296 chrUpMask := upcase( ptrMask[ pMask ] );
297 while chrUpMask <> UpCase( ptrName[ pName ] ) do
300 if pName >= nameLen then
307 // *
\82Ì
\8e\9f\82Ì
\95¶
\8e\9a\82ª
\8c©
\82Â
\82©
\82ç
\82È
\82©
\82Á
\82½
\82ç
\8fI
\97¹
308 if chrUpMask <> UpCase( ptrName[ pName ] ) then
319 //
\82±
\82Ì 1
\95¶
\8e\9a\82ª
\88á
\82Á
\82½
\82ç
\8fI
\97¹
320 if UpCase( ptrMask[ pMask ] ) <> UpCase( ptrName[ pName ] ) then
329 //
\8e\9f\82Ì
\95¶
\8e\9a\82Ö
335 if (pMask >= maskLen) and (pName >= nameLen) then
343 //
\83\81\83^
\83L
\83\83\83\89\83N
\83^
\82ð
\90³
\8bK
\95\
\8c»
\88µ
\82¢
\82É
\82È
\82ç
\82È
\82¢
\82æ
\82¤
\82É
\92u
\8a·
344 function RegExpEncode(
351 strResult := StringReplace( text, '\', '\\', [rfReplaceAll] );
352 strResult := StringReplace( strResult, '[', '\[', [rfReplaceAll] );
353 strResult := StringReplace( strResult, ']', '\]', [rfReplaceAll] );
354 strResult := StringReplace( strResult, '(', '\(', [rfReplaceAll] );
355 strResult := StringReplace( strResult, ')', '\)', [rfReplaceAll] );
356 strResult := StringReplace( strResult, '[', '\[', [rfReplaceAll] );
357 strResult := StringReplace( strResult, ']', '\]', [rfReplaceAll] );
358 strResult := StringReplace( strResult, '*', '\*', [rfReplaceAll] );
359 strResult := StringReplace( strResult, '?', '\?', [rfReplaceAll] );
360 strResult := StringReplace( strResult, '.', '\.', [rfReplaceAll] );
361 strResult := StringReplace( strResult, '+', '\+', [rfReplaceAll] );
362 strResult := StringReplace( strResult, '|', '\|', [rfReplaceAll] );
363 strResult := StringReplace( strResult, '^', '\^', [rfReplaceAll] );
364 strResult := StringReplace( strResult, '$', '\$', [rfReplaceAll] );