cURL / Mailing Lists / curl-library / Single Mail

curl-library

A Question On Curl

From: Thomas Dineen <tdineen_at_ix.netcom.com>
Date: Sat, 26 Jul 2014 12:36:23 -0700

Gentle People:

     The code shown below works about 98% of the time!

     About 2% of the time it will hang in url_fgets() maybe for 10
minutes or
more and sometimes longer.

     if the read fails that is ok, I just need it to return in an
orderly predictable way.

     Any ideas why or how to debug?

     I thought the CURLOPT_TIMEOUT would prevent this?

Thomas Dineen

   for ( j=0; j<sizeof( URL_String ); j++ )
       {
       URL_String[j] = '\0';
       };

    strcpy ( URL_String, "http://finance.yahoo.com/q?s=" );
    strcat ( URL_String, Symbol );
    strcat ( URL_String, "&ql=1" );

     handle = url_fopen ( URL_String, "r" );

     if ( Print_Head->Print_Headers_Daily_Bar_Parser == TRUE )
        printf ( "Handle = %d\n", handle );

     if( !handle )
        {
        printf( "Read_Yahoo_Daily_Bar: Error: Couldn't Open URL:
url_fopen() Failed\n"
  );
        printf ( "Handle = %d\n", handle );
        return (-1); /* Error: Couldn't Open URL: url_fopen() Failed */
        }

      curl_easy_setopt( handle, CURLOPT_TIMEOUT, (long) 10 );

        while( !url_feof( handle ))
           { /* Start While */

           if ( Print_Head->Print_Headers_Daily_Bar_Parser == TRUE )
              printf ( "Inside While \n" );

           for ( j=0; j<YAHOO_READ_BUFFER_SIZE; j++ )
              {
              Yahoo_Read_Buffer_Primary[j] = '\0';
              };

           url_fgets( Yahoo_Read_Buffer_Primary,
              sizeof( Yahoo_Read_Buffer_Primary), handle);

           } /* End While */

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-26