These are chat archives for IndySockets/Indy

19th
Apr 2017
Sergey
@icegood
Apr 19 2017 08:36

Hi, Remy. After migration from Indy9 to Indy10 i found one more issue:
our web server always requires Content-Length in header of HTTP Post method. It doesn't matter whether ContentStream is assigned or not.
In Indy10 code i see that in case when ASource is not assigned then header is not added:
if Assigned(ARequest.Source) then begin
ARequest.ContentLength := ARequest.Source.Size;
end else begin
ARequest.ContentLength := -1; => leads to omitting of 'Content-Length'
end;
For this moment i have workaround via adding 'Content-Length' to CustomHeaders (value is '0', works great!). Moreover, seems Indy9 always added 'Content-Length'!

Please, consider adding 'Content-Length' always in library as well. At least i see it is a widespread issue:
http://stackoverflow.com/questions/19227142/http-status-code-411-length-required

perverez
@perverez
Apr 19 2017 11:00
Hi, I have problem with GStack.LocalAddress. When I call this function on Windows Server 2016 (ver. 1607, build 14393, virtualized), error occured. Function Stub_GetAdaptersAddresses() returns any pointer, but GetAdaptersAddresses() return error 127. Some solution?
Remy Lebeau
@rlebeau
Apr 19 2017 15:56
@icegood Indy 9 does not allow the source stream to be nil. If the request is POST or PUT, it assumes a valid stream and will crash accessing the Size if the stream is nil. Indy 9 also omitted the Content-Length for all requests other than POST and PUT. Indy 10 allows a nil source stream, but the real question is - why are you posting a nil source stream to begin with? You really shouldn't be. That being said, I have checked in a fix to generate a 'Content-Length: 0' header when the source stream is nil for POST and PUT requests.
Remy Lebeau
@rlebeau
Apr 19 2017 16:03
@perverez error 127 is ERROR_PROC_NOT_FOUND. GetAdaptersAddresses() should not be returning that error, it comes from GetProcAddress() instead. Did you check to make sure Indy is able to load iphlpapi.dll correctly before calling GetAdaptersAddresses()?
perverez
@perverez
Apr 19 2017 17:13
Hi, I check all - DLL is loaded (hIpHlpApi > 0), GetAdaptersAddresses is assigned, function Stub_GetAdaptersAddresses not calling Impl_GetAdaptersAddresses. The problem does not occur in the physical network interface cards, only in Hyper-V.
Remy Lebeau
@rlebeau
Apr 19 2017 19:15
@perverez Then that is an OS issue, not an Indy issue. Ask Microsoft why GetAdaptersAddresses() returns 127 in Hyper-V (apparently you have already tried to?). It is likely a driver bug or something like that.
Remy Lebeau
@rlebeau
Apr 19 2017 19:26
@perverez does GetAdaptersInfo() exhibit the same problem? If I have Indy treat ERROR_PROC_NOT_FOUND the same as ERROR_NOT_SUPPORTED when calling GetAdaptersAddresses(), Indy would then fallback to GetAdaptersInfo().