cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP client as new child process

From: Ajay Tanpure <ajaytanpure92_at_gmail.com>
Date: Tue, 19 Feb 2013 17:54:37 +0530

Attached file fork.c

On Tue, Feb 19, 2013 at 5:53 PM, Ajay Tanpure <ajaytanpure92_at_gmail.com>wrote:

> Thank for your reply sir.
> The changes you have made works fine.
> but if i want to read the data written on the pipe by parent process, then
> problem exists.
> If i declared character pointer before curl_easy_init() function called,
> then no request is sent to the server.
>
> But if declare pointer after the init() call the it works.
> I have also mentioned in the code you have edit for me. Commented part is
> not giving expected output.
> Can you tell why should we need to call init() before?
>
> Thank you
>
> On Tue, Feb 19, 2013 at 3:52 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>> On Tue, 19 Feb 2013, Ajay Tanpure wrote:
>>
>> Please. Don't top-post nor full-quote.
>>
>>
>> But in case of child process, as have mentioned below, functions like
>>> curl_easy_setopt(), didn't get called.
>>>
>>
>> Sure they do. libcurl cannot prevent your code from calling the
>> functions. If they don't get called then the problem is not caused by
>> libcurl itself!
>>
>>
>> I have searched on web also regarding that, global_init() is NOT thread
>>> safe.
>>>
>>
>> You don't have to search the web for that, just read the libcurl docs.
>> And no, it isn't thread-safe. But then fork() doesn't start a new _thread_
>> either...
>>
>>
>> I am using libcurl version 7.9.6
>>>
>>
>> REALLY? I suspect that's not correct. 7.9.6 is over 10 years old. I think
>> you're using 7.19.6, not exactly the same thing. Please pay (more)
>> attention to details.
>>
>> [incomplete example]
>>>
>>
>> Your example didn't build as it was incomplete. I did however amuse
>> myself by converting it into a working code example and what do you know?
>> It works for me... See the attachment.
>>
>> --
>>
>> / daniel.haxx.se
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>>
>
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

  • text/x-csrc attachment: fork.c
Received on 2013-02-19