cURL / Mailing Lists / curl-library / Single Mail


Re: How to use libcurl to do HTTP GET request and get response in Apache module...

From: <>
Date: Sat, 23 Jun 2012 17:34:07 -0400

---- Daniel Stenberg <> wrote:
> On Sat, 23 Jun 2012, wrote:
> > I'm trying to use libcurl in an Apache module that I'm working on, to make
> > an HTTP GET request, and to get and process the response.
> In what way would it be different to use libcurl from an Apache module than
> from other code? libcurl's API and functionality remain the same no matter
> what...
> --
> /
> -------------------------------------------------------------------
> List admin:
> Etiquette:

Hi Daniel,

Thanks for that.

I'm new to both writing Apache modules and to using libcurl, and when I was testing my prototype, I was getting that segfault, and had *assumed* that the segfault was occurring because there might be problems with memory allocation, as Apache has a pool mechanism which I had run into problems with earlier (before trying to integrate libcurl into my module).

But when you said what you said ( :) ), I went back and ran Apache under GDB, and noted that the callback was returning a CURLE_WRITE_ERROR. I googled that, and also realized that the sample (the link I pointed to earlier) I had started with wasn't returning a byte/char count from the callback (causing the curl error -

So, I just added an appropriate return to the callback, and now it works :)!!

List admin:
Received on 2012-06-23