Super version of TRoNetHttpClientChannel

This channel does not support ‘events’. Can this be added? Or can we do this in a different way for example by opening a callback channel before connecting to the server?

Hi,

this channel is based on System.Net.HttpClient.THTTPClient - RAD Studio API Documentation class.

from beginning (when it was introduced in XE8), it has lack of events.
probably they have added a new ones in the latest versions …

We’ll review possibility to add SuperHttp version of this channel.

Logged as bugs://D19448.

That would be great. We sometimes run into the problem that other ‘super’ channels (like Synapse and Indy) are blocked by the internal proxy (don’t understand why). TRoNetHttpClientChannel however, is not blocked. So having a super version of this channel would spare us the discussions with internal IT departments.

Hi,

hmm, I don’t see any functionality like Cancel, CloseSocket, etc in THTTPClient.
as a result, it will be impossible to terminate waiting request so it will wait for 120 sec …

Hi,

This code seems to work:
var rq := NetHTTPClient1.Get(‘https://google.nl’);
TURLResponse(rq).Cancel;

Not sure if this is what you need.

Hi,

You have IHTTPResponse after GET or POST method.
these interface and his ancestor don’t have Cancel method.
Delphi allows to cast interface to object, but it is a bit incorrect.

IURLResponse
  /// <summary>Common interface for an URL response and all of it's related data</summary>
  IURLResponse = interface(IInterface)
    ['{5D687C75-5C36-4302-B0AB-989DDB7558FE}']
...
    /// <summary>Property to retrieve all Headers from the response</summary>
    /// <returns>An Array of TNetHeader containing all Headers with theirs respective values.</returns>
    property Headers: TNetHeaders read GetHeaders;
    /// <summary>Property to retrieve the MimeType Header Value from the response</summary>
    /// <returns>A string containing the MimeType value.</returns>
    property MimeType: string read GetMimeType;
    /// <summary>Property to retrieve the ContentStream from the response</summary>
    /// <returns>A stream whith the content of the response.</returns>
    property ContentStream: TStream read GetContentStream;
    /// <summary>Function that transforms the ContentStream into a string</summary>
    function ContentAsString(const AnEncoding: TEncoding = nil): string;
    /// <summary>A reference to IAsyncResult controlling asynchronous execution of corresponding request</summary>
    property AsyncResult: IAsyncResult read GetAsyncResult;
  end;
IHTTPResponse
  IHTTPResponse = interface(IURLResponse)
    ['{ED07313B-324B-448F-84AD-F199D38981DA}']
...
    /// <summary>Function to know if a given header is present</summary>
    /// <param name="AName">Name of the Header</param>
    /// <returns>True if the Header is present.</returns>
    function ContainsHeader(const AName: string): Boolean;

    /// <summary>Getter for the Cookies Property</summary>
    function GetCookies: TCookies;

    /// <summary>Property to Get Header values</summary>
    /// <param name="AName">Name of the Header</param>
    /// <returns>The string value associated to the given name.</returns>
    property HeaderValue[const AName: string]: string read GetHeaderValue;

    /// <summary>Get ContentCharSet from server response</summary>
    property ContentCharSet: string read GetContentCharSet;
    /// <summary>Get ContentEncoding from server response</summary>
    property ContentEncoding: string read GetContentEncoding;
    /// <summary>Get ContentLanguage from server response</summary>
    property ContentLanguage: string read GetContentLanguage;
    /// <summary>Get ContentLength from server response</summary>
    property ContentLength: Int64 read GetContentLength;

    /// <summary>Get Date from server response</summary>
    property Date: string read GetDate;
    /// <summary>Get LastModified from server response</summary>
    property LastModified: string read GetLastModified;

    /// <summary>Get StatusText from server response</summary>
    property StatusText: string read GetStatusText;
    /// <summary>Get StatusCode from server response</summary>
    property StatusCode: Integer read GetStatusCode;
    /// <summary>Get Version from server response</summary>
    property Version: THTTPProtocolVersion read GetVersion;
    /// <summary>Get Cookies from server response</summary>
    property Cookies: TCookies read GetCookies;
  end;

Yes, I agree. But we have to work with what we have. Maybe we can convince EMB to add the Cancel method to IURLResonse, which should have been there in the first place.

bugs://D19448 was closed as fixed.

Many thanks for implementing the ‘Super’ version of the Net HTTP client. I have replaced our client components with the new version (one line of code) and it works! Also on customer sites that caused problems before are now working like a charm.

2 Likes