fatih 0 Posted March 26 Hello. I use SslHttpCli1 and SslContext1 to get URLs (ICS v9.0). I found a problem which Indy idHttp works fine. This results Http 200: https://test.com/?test This results Http 400: https://test.com?test How can I solve it? Share this post Link to post
Angus Robertson 577 Posted March 26 Technically, https://test.com?test is an invalid URL, since there is no path included in the URL, Without the query parameter, ICS would add path / automatically, so probably should do so for the query parameter as well, that is what my Firefox browser seems to do. Will fix it next week. If you want to do it yourself, in THttpCli.DoRequestAsync change: if FPath = '' then FPath := '/'; to if Pos('/', FPath) <> 1 then FPath := '/' + FPath; Angus Share this post Link to post
Remy Lebeau 1436 Posted March 26 (edited) 4 hours ago, Angus Robertson said: Technically, https://test.com?test is an invalid URL, since there is no path included in the URL, That is not correct. Technically, the path component is allowed to be empty in any url, per RFC 3986 sections 3 and 3.3: URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0<pchar> RFC 2616 section 3.2.2 tried to restrict an HTTP url to require a non-empty absolute path if the query component is present: http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]] But, RFC 2616 section 5.1.2 does allow the path in an HTTP url to be empty: Quote Note that the absolute path cannot be empty; if none is present in the original URI, it MUST be given as "/" (the server root). RFC 7230 sections 2.7.1 and 2.7.2 loosen the restriction to allow the path in HTTP and HTTPS urls to be empty: http-URI = "http:" "//" authority path-abempty [ "?" query ] [ "#" fragment ] https-URI = "https:" "//" authority path-abempty [ "?" query ] [ "#" fragment ] 4 hours ago, Angus Robertson said: If you want to do it yourself, in THttpCli.DoRequestAsync change: if FPath = '' then FPath := '/'; to if Pos('/', FPath) <> 1 then FPath := '/' + FPath; Why would you an inefficient "Pos" check instead of using something like StartsText() instead? Or simply: "if (FPath = '') or (FPath[1] <> '/')" ? Edited March 26 by Remy Lebeau 2 Share this post Link to post
fatih 0 Posted May 24 Hello, I'm trying the new version ICS-V9.1. However, it seems nothing has changed. I still get 400 status code. Share this post Link to post
Angus Robertson 577 Posted May 24 This was fixed for V9.2, in SVN and the overnight zip. Are you using one of those? Angus Share this post Link to post
fatih 0 Posted May 24 Oh OK. I used overbyte.eu/wiki and downloaded ICS V9.1. Thank you. Share this post Link to post