[Gambas-user] [SegFault 11] Enumerating HttpClient.Headers with For Each

T Lee Davidson t.lee.davidson at ...626...
Sun Nov 23 22:07:13 CET 2014


Okay, I've done more testing related to the noise I accidentally sent to 
the list yesterday.

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."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GraphicalAppTest-0.0.1-crash-141123-151942.tar.bz2
Type: application/x-bzip
Size: 6509 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20141123/b58207a5/attachment.bin>


More information about the User mailing list