Jump to content
omnibrain

IcsMimeIsTextual doesn't work with content-type 'text'

Recommended Posts

I make heavy use of 'TSslHttpRest' for all kinds of requests, but with the recent update to ICS 9.4 (I skipped 9.3) some requests to plain text endpoints fail. I get 200 OK, but the responseraw is empty.

I think the culprit is this:

{ V9.3 is a MIME type texual or printable text }
function IcsMimeIsTextual(const MimeType: String): Boolean;
begin
    Result := (Pos ('text/', MimeType) = 1) or (Pos ('json', MimeType) > 0)  or
               (Pos ('javascript', MimeType) > 0) or (Pos ('xml', MimeType) > 0);
end;

I have to request some servers that answer with content-type 'text' instead of 'text/plain', so this function doesn't work for me.

I'm not sure if you consider this a bug, because I think just 'text' is no "official" mime-type, but on the other hand, I have no control over the servers I have to query, so I would appreciate if there was a solution besides me manually patching the ICS code. 

Share this post


Link to post

Strangely, that function was on my screen, I've just added some more parameter encoding and decoding functions to that unit. 

 

I've removed the / after text, it's a pretty basic function to avoid trying to convert images and files into unicode. 

 

Not sure why V9.3 changed anything, that text/ check was previously in the TriggerRequestDone2 function. 

 

Angus

 

  • Thanks 1

Share this post


Link to post

Thanks.

 

Yes, strange, must be a coincidence then. Perhaps something changed at a server and I only noticed just now.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×