Cris Bailiff | 15 Jul 2002 11:05

[ANN] Curl::easy perl interface v1.30 released

The latest version of Curl::easy, the perl interface to libcurl, has been 
posted at <http://curl.haxx.se/libcurl/perl>. 

This is a big update to v1.21, which re-factors almost  all of the internal 
code,  removing the use of previous internal static structures and moving to 
PerlIO, so making Curl::easy v1.30 safe for ithreads and multiple curl 
handles (though it doesn't provide curl_multi_foo yet!) and providing clean 
OO-style syntax support.

This release has been thoroughly tested, including for backwards 
compatibility with existing scripts, but on a limited number of platforms, so 
please report any issues - all feeback welcome.

The full Changelog is at:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/curl/perl/Changes?rev=HEAD&content-type=text/vnd.viewcvs-markup

Regards,
Cris Bailiff

--
Cris Bailiff, /dev/secure Pty Ltd.
c.bailiff+curl at awayweb.com
http://www.awayweb.com/

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

(Continue reading)

Francis Dagenais | 15 Jul 2002 17:26
Favicon

Problem using libcurl

Hi,
  I'm using libcurl to send SOAP-XML messages over HTTPS. I'm now able to do 1 post, and receive the answer without problem. But when I try to do 2 post in a row, the second post doesn't end correctly, and my C program ends in a core dump. Here is what I've programmed:
 
CURL   *ch;
struct  curl_slist   *headerlist=NULL;
struct  MemoryStruct *bodyStruct=NULL;
char    _gatineauSoapReq[2000]="";void _gatineauInit() {
  ch = curl_easy_init();
  curl_easy_setopt(ch, CURLOPT_URL, transactionServerUrl3);
  curl_easy_setopt(ch, CURLOPT_POST, 1);
  curl_easy_setopt(ch, CURLOPT_HEADER, 1);
  curl_easy_setopt(ch, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
  if ((bodyStruct = (struct MemoryStruct *) malloc(sizeof(struct MemoryStruct))) == NULL) exit(1);
  curl_easy_setopt(ch, CURLOPT_FILE, bodyStruct);
}void _gatineauEndReq() {
  free(bodyStruct);
  curl_slist_free_all(headerlist);
  curl_easy_cleanup(ch);
} int _gatineauExtractRetour(char *response) {
  char *tok="", buf[64]="", *p="";
  p = strstr(response, "<Retour>");
  tok = strtok(p, ">");
  tok = strtok(NULL, "<");
  strcpy(buf, tok);
  return(atoi(buf));
}

void _gatineauValidateNow(
  const char *arg1, const char *arg2, const char *arg3, const char *arg4
) { // I make sure that headerlist is erased before rebuilding it with the soap function
  curl_slist_free_all(headerlist); headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
  headerlist = curl_slist_append(headerlist, "SOAPAction: \"http://blabla.com/blabla_services/ValidateNow\""); 

  sprintf(_gatineauSoapReq, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\
<soap:Body>\
<ValidateNow xmlns=\"namespace://xml.blabla.com/shemas/blabla_service/blabliblo/\">\
<IdSessionTel>%s</IdSessionTel>\
<NoMember>%s</NoMember>\
<NoActivity>%s</NoActivity>\
<ready>%s</ready>\
</ValidateNow>\
</soap:Body>\
</soap:Envelope>", arg1, arg2, arg3, arg4);
  curl_easy_setopt(ch, CURLOPT_POSTFIELDS, _gatineauSoapReq);
  curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headerlist);
  curl_easy_perform(ch);
} void _gatineau() {
  char   *strToSend="", buf[2000]="", buf2[256]="", *dtmf="",
         *msgDir="", msgPath[128]="", *periodInfo="";
  int     i=0, retour=0;
 
  _gatineauInit();
 
  _gatineauValidateNow("1234", "0052", "654321", "0");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour1: --%d--\n", retour);  _gatineauValidateNow("1235", "0053", "123456", "1");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour2: --%d--\n", retour);
 
  _gatineauEndReq();
}

I think that may be the problem is within the headerlist function :
curl_slist_free_all(headerlist);
headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
If someone has already done something with soap-xml or has made several posts within the same curl session, please help!
 
Thank you,
Francis Dagenais
Francis Dagenais | 15 Jul 2002 17:50
Favicon

Fw: Problem using libcurl

I tried what you just said, and it changed the behavior of my application. The chained list "headerlist" is not looping anymore (good!). And the second post now seems to start (I can see in the curl traces) but doesn't end correctly (still core dumped). I'm continuing the search (if you have an idea, please post!)
 
thank you,
Francis Dagenais
----- Original Message -----
Sent: Monday, July 15, 2002 11:32 AM
Subject: RE: Problem using libcurl

Francis
 
You need to reinitialize your headerlist to NULL before each post.
 
See below.
 
Cheers,
 
Mike Tardif
Abobe Systems Canada.
 
-----Original Message-----
From: Francis Dagenais [mailto:francis <at> voxtel.com]
Sent: Monday, July 15, 2002 11:27 AM
To: curl-library <at> lists.sourceforge.net
Subject: Problem using libcurl

Hi,
  I'm using libcurl to send SOAP-XML messages over HTTPS. I'm now able to do 1 post, and receive the answer without problem. But when I try to do 2 post in a row, the second post doesn't end correctly, and my C program ends in a core dump. Here is what I've programmed:
 
CURL   *ch;
struct  curl_slist   *headerlist=NULL;
struct  MemoryStruct *bodyStruct=NULL;
char    _gatineauSoapReq[2000]="";void _gatineauInit() {
  ch = curl_easy_init();
  curl_easy_setopt(ch, CURLOPT_URL, transactionServerUrl3);
  curl_easy_setopt(ch, CURLOPT_POST, 1);
  curl_easy_setopt(ch, CURLOPT_HEADER, 1);
  curl_easy_setopt(ch, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
  if ((bodyStruct = (struct MemoryStruct *) malloc(sizeof(struct MemoryStruct))) == NULL) exit(1);
  curl_easy_setopt(ch, CURLOPT_FILE, bodyStruct);
}void _gatineauEndReq() {
  free(bodyStruct);
  curl_slist_free_all(headerlist);
  curl_easy_cleanup(ch);
} int _gatineauExtractRetour(char *response) {
  char *tok="", buf[64]="", *p="";
  p = strstr(response, "<Retour>");
  tok = strtok(p, ">");
  tok = strtok(NULL, "<");
  strcpy(buf, tok);
  return(atoi(buf));
}

void _gatineauValidateNow(
  const char *arg1, const char *arg2, const char *arg3, const char *arg4
) { // I make sure that headerlist is erased before rebuilding it with the soap function
  curl_slist_free_all(headerlist); headerlist = NULL;  headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
  headerlist = curl_slist_append(headerlist, "SOAPAction: \"http://blabla.com/blabla_services/ValidateNow\""); 

  sprintf(_gatineauSoapReq, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\
<soap:Body>\
<ValidateNow xmlns=\"namespace://xml.blabla.com/shemas/blabla_service/blabliblo/\">\
<IdSessionTel>%s</IdSessionTel>\
<NoMember>%s</NoMember>\
<NoActivity>%s</NoActivity>\
<ready>%s</ready>\
</ValidateNow>\
</soap:Body>\
</soap:Envelope>", arg1, arg2, arg3, arg4);
  curl_easy_setopt(ch, CURLOPT_POSTFIELDS, _gatineauSoapReq);
  curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headerlist);
  curl_easy_perform(ch);
} void _gatineau() {
  char   *strToSend="", buf[2000]="", buf2[256]="", *dtmf="",
         *msgDir="", msgPath[128]="", *periodInfo="";
  int     i=0, retour=0;
 
  _gatineauInit();
 
  _gatineauValidateNow("1234", "0052", "654321", "0");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour1: --%d--\n", retour);  _gatineauValidateNow("1235", "0053", "123456", "1");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour2: --%d--\n", retour);
 
  _gatineauEndReq();
}

I think that may be the problem is within the headerlist function :
curl_slist_free_all(headerlist);
headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
If someone has already done something with soap-xml or has made several posts within the same curl session, please help!
 
Thank you,
Francis Dagenais
Raphael Summers | 15 Jul 2002 19:04
Picon
Picon

Downloading page in PHP database

Sirs/madams,

I apologise in advance for presenting what I believe is a standard problem. 
Unfortunately, time does not permit me at the moment to research into it. I 
was wondering whether you might know the answer.

I am trying to download the html of the following website:

 http://www.idlepimps.com/displaycityranks.php?offset=0&uid=3w6FZJiZmXzH

However, it downloads (null).

The website www.idlepimps.com presents two boxes for username and password. 
After a bit of investigation, I discovered that the following website 
achieves the same goal:

http://www.idlepimps.com/login.php?pimpid=xxx&pwd=xxx

Another observation I made is that the uid changes on every occassion I log 
in. Therefore, it did not seem possible just to use the CURLOPT_POSTFIELDS 
option of curl_easy_setopt() with uid=3w6FZJiZmXzH. I also messed around a 
bit with CURLOPT_USERPWD, but to no avail. How do I get Curl to log onto 
www.idlepimps.com, retrieve the new uid, and then use that uid to download 
the webpage I require?

Thank you in advance,

Raphael Summers.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Francis Dagenais | 16 Jul 2002 19:47
Favicon

Re: Problem using libcurl - Resending

Hi,
  I'm using libcurl to send SOAP-XML messages over HTTPS. I'm now able to do 1 post, and receive the answer without problem. But when I try to do 2 post in a row, the second post doesn't end correctly, and my C program ends in a core dump. Here is what I've programmed:
 
CURL   *ch;
struct  curl_slist   *headerlist=NULL;
struct  MemoryStruct *bodyStruct=NULL;
char    _gatineauSoapReq[2000]="";
 
void _gatineauInit() {
  ch = curl_easy_init();
  curl_easy_setopt(ch, CURLOPT_URL, transactionServerUrl3);
  curl_easy_setopt(ch, CURLOPT_POST, 1);
  curl_easy_setopt(ch, CURLOPT_HEADER, 1);
  curl_easy_setopt(ch, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
  if ((bodyStruct = (struct MemoryStruct *) malloc(sizeof(struct MemoryStruct))) == NULL) exit(1);
  curl_easy_setopt(ch, CURLOPT_FILE, bodyStruct);
}
 
void _gatineauEndReq() {
  free(bodyStruct);
  curl_slist_free_all(headerlist);
  curl_easy_cleanup(ch);
}
 
int _gatineauExtractRetour(char *response) {
  char *tok="", buf[64]="", *p="";
  p = strstr(response, "<Retour>");
  tok = strtok(p, ">");
  tok = strtok(NULL, "<");
  strcpy(buf, tok);
  return(atoi(buf));
}

void _gatineauValidateNow(const char *arg1, const char *arg2, const char *arg3, const char *arg4) {
  // I make sure that headerlist is erased before rebuilding it with the soap function
  curl_slist_free_all(headerlist);
  headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
  headerlist = curl_slist_append(headerlist, "SOAPAction: \"http://blabla.com/blabla_services/ValidateNow\"");  
  sprintf(_gatineauSoapReq, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\
<soap:Body>\
<ValidateNow xmlns=\"namespace://xml.blabla.com/shemas/blabla_service/blabliblo/\">\
<IdSessionTel>%s</IdSessionTel>\
<NoMember>%s</NoMember>\
<NoActivity>%s</NoActivity>\
<ready>%s</ready>\
</ValidateNow>\
</soap:Body>\
</soap:Envelope>", arg1, arg2, arg3, arg4);
  curl_easy_setopt(ch, CURLOPT_POSTFIELDS, _gatineauSoapReq);
  curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headerlist);
  curl_easy_perform(ch);
}
 
void _gatineau() {
  char   *strToSend="", buf[2000]="", buf2[256]="", *dtmf="",
         *msgDir="", msgPath[128]="", *periodInfo="";
  int     i=0, retour=0;
 
  _gatineauInit();
 
  _gatineauValidateNow("1234", "0052", "654321", "0");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour1: --%d--\n", retour);
 
  _gatineauValidateNow("1235", "0053", "123456", "1");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour2: --%d--\n", retour);
 
  _gatineauEndReq();
}

I think that may be the problem is within the headerlist function :
curl_slist_free_all(headerlist);
headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
If someone has already done something with soap-xml or has made several posts within the same curl session, please help!Does anybody has a working example of more than one soap xml request within the same curl session?
 
Thank you,
Francis Dagenais
Steve Dekorte | 18 Jul 2002 00:20
Picon
Favicon

Re: async connect


--- Bjorn Reese <breese <at> mail1.stofanet.dk> wrote:
> Steve Dekorte wrote:
> It is not supposed to block (except for the DNS
> lookup.)

Yes, I looked into it some more and that's what's
happening. But I'm only handing curl urls with IP
addresses as the hosts, and the option is set not to
follow redirects, so I don't see why it ends up doing
a lookup.

Steve

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Kjetil Jacobsen | 18 Jul 2002 13:28
Picon
Picon
Favicon

ann: pycurl 7.9.8.3

hello,

a new version of pycurl has been released.  pycurl is a python wrapper
module for the curl library.

changes since the last version:

        * Under Python 2.2 or better, Curl and CurlMulti now participate
        in garbarge collection with the gc module.

pycurl can be downloaded at http://pycurl.sourceforge.net/ and the
current version is 7.9.8.3.

regards,

        - kjetil

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Domenico Andreoli | 18 Jul 2002 13:42
Picon

Re: ann: pycurl 7.9.8.3

On Thu, Jul 18, 2002 at 01:28:58PM +0200, Kjetil Jacobsen wrote:
> hello,
> 
hi

> changes since the last version:
> 
>         * Under Python 2.2 or better, Curl and CurlMulti now participate
>         in garbarge collection with the gc module.
> 
does this mean that garbarge collection participation works only under
python 2.2 or that pycurl needs to be compiled with python 2.2 to work?

-----[ Domenico Andreoli, aka cavok
 --[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
   ---[ 3A0F 2F80 F79C 678A 8936  4FEE 0677 9033 A20E BC50

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Kjetil Jacobsen | 18 Jul 2002 13:58
Picon
Picon
Favicon

Re: ann: pycurl 7.9.8.3

hello,

pycurl does not require python 2.2, it should work as before on python
versions >= 1.5.2.

however, pycurl won't use (circular) garbage collection for python
versions < 2.2.

regards,

	- kjetil

On Thu, 2002-07-18 at 13:42, Domenico Andreoli wrote:
> On Thu, Jul 18, 2002 at 01:28:58PM +0200, Kjetil Jacobsen wrote:
> > hello,
> > 
> hi
> 
> > changes since the last version:
> > 
> >         * Under Python 2.2 or better, Curl and CurlMulti now participate
> >         in garbarge collection with the gc module.
> > 
> does this mean that garbarge collection participation works only under
> python 2.2 or that pycurl needs to be compiled with python 2.2 to work?
> 
> 
> 
> -----[ Domenico Andreoli, aka cavok
>  --[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
>    ---[ 3A0F 2F80 F79C 678A 8936  4FEE 0677 9033 A20E BC50
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Key88 SF | 18 Jul 2002 19:46
Picon
Favicon

CURLOPT_POSTFIELDS & const char * ??


Could someone explain why the parameter passed to the curl_easy_setopt() 
function with CURLOPT_POSTFIELDS is a regular "char *", and not a "const 
char *"?  Does libcurl modify this data?

Thanks,

Dave

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


Gmane