mORMot and Open Source friends
Check-in [53a1209bdb]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{2666} change default User-Agent for HTTP client classes - as proposed by Eric
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 53a1209bdbf3e3ad8194081249d43308fb1cdad4
User & Date: ab 2016-05-19 08:21:58
Context
2016-05-19
08:56
{2667} fixed Delphi 5 compilation check-in: 540687c402 user: ab tags: trunk
08:21
{2666} change default User-Agent for HTTP client classes - as proposed by Eric check-in: 53a1209bdb user: ab tags: trunk
06:11
{2665} new TCurlHTTP.UseClientCertificate() method check-in: 585d11888a user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynCrtSock.pas.

297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
....
2488
2489
2490
2491
2492
2493
2494
2495









2496
2497
2498
2499
2500
2501
2502
2503
  // THttpRequest.Create() constructor
  HTTP_DEFAULT_RECEIVETIMEOUT = 30000;

type
{$ifdef UNICODE}
  /// define the fastest Unicode string type of the compiler
  SynUnicode = UnicodeString;
  /// define a raw storage string type, used for data buffer management
  SockString = type RawByteString;
{$else}
  /// define the fastest Unicode string type of the compiler
  SynUnicode = WideString;
  {$ifdef HASCODEPAGE} // FPC may expect a CP, e.g. to compare two string constants
  SockString = type RawByteString;
  {$else}
  /// define a raw storage string type, used for data buffer management
  SockString = type AnsiString;
  {$endif}
{$endif}
  /// points to a raw storage string instance, used for data buffer management
  PSockString = ^SockString;

{$ifdef DELPHI5OROLDER}
  // not defined in Delphi 5 or older
  PPointer = ^Pointer;
  TTextLineBreakStyle = (tlbsLF, tlbsCRLF);
  UTF8String = AnsiString;
................................................................................
    for i := 0 to n do // to n = including last #0
      PWordArray(pointer(result))^[i] := PByteArray(pointer(Ansi))^[i];
  end;
end;

function DefaultUserAgent(Instance: TObject): SockString;
const
  DEFAULT_AGENT = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows; Synopse mORMot '+









    SYNOPSE_FRAMEWORK_VERSION+' ';
begin
  result := DEFAULT_AGENT+SockString(Instance.ClassName)+')';
end;

/// decode 'CONTENT-ENCODING: ' parameter from registered compression list
function ComputeContentEncoding(const Compress: THttpSocketCompressRecDynArray;
  P: PAnsiChar): THttpSocketCompressSet;






|


|




|



|







 







|
>
>
>
>
>
>
>
>
>
|







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
....
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
  // THttpRequest.Create() constructor
  HTTP_DEFAULT_RECEIVETIMEOUT = 30000;

type
{$ifdef UNICODE}
  /// define the fastest Unicode string type of the compiler
  SynUnicode = UnicodeString;
  /// define a raw 8-bit storage string type, used for data buffer management
  SockString = type RawByteString;
{$else}
  /// define the fastest 16-bit Unicode string type of the compiler
  SynUnicode = WideString;
  {$ifdef HASCODEPAGE} // FPC may expect a CP, e.g. to compare two string constants
  SockString = type RawByteString;
  {$else}
  /// define a 8-bit raw storage string type, used for data buffer management
  SockString = type AnsiString;
  {$endif}
{$endif}
  /// points to a 8-bit raw storage variable, used for data buffer management
  PSockString = ^SockString;

{$ifdef DELPHI5OROLDER}
  // not defined in Delphi 5 or older
  PPointer = ^Pointer;
  TTextLineBreakStyle = (tlbsLF, tlbsCRLF);
  UTF8String = AnsiString;
................................................................................
    for i := 0 to n do // to n = including last #0
      PWordArray(pointer(result))^[i] := PByteArray(pointer(Ansi))^[i];
  end;
end;

function DefaultUserAgent(Instance: TObject): SockString;
const
  DEFAULT_AGENT = 'Mozilla/5.0 (' +
    {$ifdef MSWINDOWS}
      'Windows'
    {$else}
      {$ifdef LINUX}
        'Linux'
      {$else}
        'Posix'
      {$endif LINUX}
    {$endif MSWINDOWS}
    + '; Synopse mORMot '+ SYNOPSE_FRAMEWORK_VERSION+' ';
begin
  result := DEFAULT_AGENT+SockString(Instance.ClassName)+')';
end;

/// decode 'CONTENT-ENCODING: ' parameter from registered compression list
function ComputeContentEncoding(const Compress: THttpSocketCompressRecDynArray;
  P: PAnsiChar): THttpSocketCompressSet;

Changes to SynopseCommit.inc.

1
'1.18.2665'
|
1
'1.18.2666'