Attempting to enumerate through HttpClient.Headers with For Each causes a SegFault 11 under certain conditions.
In the attached project, there is a procedure that traverses through a list of three URLs from a GridView and does HttpClient.Get on each one.
If HttpClient.Headers for each URL is enumerated with Headers[iIndex], I can run through the list of URLs multiple times all day long. But, if I enumerate the Headers array with For Each, the application SegFaults at the second execution of the procedure.
When using Headers[iIndex], Headers.Count is correct.But, when using For Each, URL[1].Headers.Count is obviously URL[0].Headers.Count plus URL[1].Headers.Count. And, actually printing out the headers shows that URL[1].Headers is the URL[0].Headers with URL[1].Headers appended.
Interestingly, the Headers for the third URL are correct no matter which enumeration method is used. And, the application does not SegFault when attempting to enumerate the Headers (with For Each) for the third URL on the first run. Only after the procedure is re-entered the second time does the app SegFault.
How to reproduce: Set "Actually Print Headers to Console" to your preference. A. 1. Leave "Enumerate Response Headers With" set to "Headers[iIndex]".2. Click "Get Response Status Codes" as many times as you wish to show that enumerating with Headers[iIndex] does not SegFault.
B. 1. Set "Enumerate Response Headers With" to "For Each Headers". 2. Click "Get Response Status Codes" twice. (>>SegFault)One last note: I stumbled across this while trying to determine why HttpClient.Code sometimes returned "0", and IIRC, I was enumerating with For Each at the time.
Now just for clarification, is enumerating HttpClient.Headers with For Each something I should not be doing? Have I done something else wrong? Or is this actually a bug?
Oops, almost forgot. System info: [System] Gambas=3.6.0 OperatingSystem=Linux Kernel=3.10.60-desktop-1.mga3 Architecture=x86 Distribution=Mageia 3 Desktop=KDE4 Theme=Oxygen Language=en_US.UTF-8 Memory=1005M [Libraries] Cairo=libcairo.so.2.11200.12 Curl=libcurl.so.4.3.0 DBus=libdbus-1.so.3.7.2 GStreamer=libgstreamer-0.10.so.0.30.0 GStreamer=libgstreamer-1.0.so.0.5.0 GTK+3=libgtk-3.so.0.600.4 GTK+=libgtk-x11-2.0.so.0.2400.17 OpenGL=libGL.so.1.2.0 Poppler=libpoppler.so.34.0.0 Qt4=libQtCore.so.4.8.6 SDL=libSDL-1.2.so.0.11.4 -- Lee __________ "Artificial Intelligence is no match for natural stupidity."
GraphicalAppTest-0.0.1-crash-141123-151942.tar.bz2
Description: application/bzip
------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user