Thanks for your help, Nick.
I've got another question-I've got some test code that does a http request
and it has some errors. Here's some pseudocode(my real code is in lisp) of
what I'm doing:
define request-callback (request,args) {
input-buffer=evhttp_request_get_input_buffer request
len = evbuffer_get_length(input-buffer)
conn=args
str=evbuffer_pullup(input-buffer,len)
print(str)
free(str)
evhttp_connection_free(conn)
}
base=event_base_new()
conn=evhttp_connection_base_new(base,"127.0.0.1", 5984)
req=evhttp_request_new(request-callback,conn)
evhttp_make_request( conn, req, EVHTTP_REQ_GET, "/test/mwkohout")
event_base_dispatch(base)
Anyways, what happens is that the request works the first time, but it fails
with a memory error the second time. I suspect I'm freeing something I'm
not supposed to, or not freeing something I'm not supposed to. Looking at
this code, can you see what I'm not doing correctly? Also, is there any way
to obtain at the time of the call to evhttp_make_request the local port that
will be used for this request? And lastly, at some point in the future I'll
want to do some PUTs. What do I need to change to do that? Where do I
stick the body of the request?
thanks again,
Mike Kohout