[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] evbuffer_pullup(x,-1): garbage at end?



Hello again,

Another question! I used the code from Pavel to create a basic HTTP client. While testing I noticed that the retrieved data sometimes (but consistent for that specific request) contains garbage at the end:

(gdb) p joined
$4 = 0x95232ff "<the actual response>\nÿÁÈ[ç\002\030[æ"

The client uses 'evbuffer_pullup(buffer, -1)' to get a char* containing all data received. When testing with 'evbuffer_readln()' the garbage does not show up. Packet sniffing has also shown that that extra data is not being sent by the webserver.

It almost appears as if the '\0' is missing at the end of the data. If I manually put a '\0' at the length (retrieved by evbuffer_get_length()) of the buffer then everything appears to be fine.

Are we using the wrong method to retrieve data from the evbuffer, or is this a bug/by design?
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.