STOP

--- On Thu, 6/13/13, [email protected]  wrote:

> From: [email protected] 
> Subject: curl-library Digest, Vol 94, Issue 18
> To: [email protected]
> Date: Thursday, June 13, 2013, 9:35 AM
> Send curl-library mailing list
> submissions to
>     [email protected]
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>     http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library
> or, via email, send a message with subject or body 'help'
> to
>     [email protected]
> 
> You can reach the person managing the list at
>     [email protected]
> 
> When replying, please edit your Subject line so it is more
> specific
> than "Re: Contents of curl-library digest..."
> 
> 
> Today's Topics:
> 
>    1. CURLOPT_WRITEFUNCTION; Function not
> writing all data to disc
>       file? (Spencer Elliott)
>    2. RE: cURL using axTLS non-blocking (Hu,
> Eric)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 13 Jun 2013 16:05:47 +0100
> From: Spencer Elliott 
> To: 
> Subject: CURLOPT_WRITEFUNCTION; Function not writing all
> data to disc
>     file?
> Message-ID: 
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Dear all,
> 
>  
> 
>  
> 
> I am very new to LibCurl, and am struggling with the
> CURLOPT_WRITEFUNCTION
> function.
> 
> I have included my source code below, but essentially my
> issue is here:
> 
>  
> 
> /*
> 
>                
>                
> printf("\n");
> 
>                
>                
> printf(response.c_str());
> 
>                
>                
> printf("\n");
> 
>                
>                
> LogToDisk(response);
> 
> */
> 
>  
> 
> The function that stores the data to a string seems to print
> the entire
> string out perfectly fine on the console using ?printf?.
> However, when it
> saves to disc file, there is a large amount of text missing.
> Can anyone help
> me understand what I am doing wrong?
> 
>  
> 
> I noticed that there is an extremely long string in the html
> of the page I
> am going to, and this is also where is just stops working?
> 
>  
> 
> Here is an example of the last line where the file stops
> writing and gives
> up (I put the last part in bold), it should continue waaaay
> past this?:
> 
>  
> 
> >
> 
(None) Become a member of our community t
&gt; o&nbsp;get&nbsp;inside&nbsp;information&nbsp;and&nbsp;prizes!<br>&gt;
&gt; 
(None)&nbsp;We&nbsp;have&nbsp;5&nbsp;other&nbsp;servers&nbsp;up&nbsp;and&nbs
&gt; p;running!<br>&gt;
&gt; 
(None)&nbsp;Check&nbsp;out&nbsp;the&nbsp;Doom&nbsp;24/7&nbsp;Server!<br>&gt;
&gt; (None)&nbsp;Join&nbsp;our&nbsp;Forums&nbsp;at&nbsp;RenCorner.ca!<br>&gt;
&gt; 
(None)&nbsp;Too&nbsp;Easy?&nbsp;Join&nbsp;the&nbsp;RenCorner&nbsp;Killing&nb
&gt; sp;Floor&nbsp;-&nbsp;Hard&nbsp;Server!<br>&gt;
&gt; 
(None)&nbsp;Join&nbsp;our&nbsp;Teamspeak&nbsp;3&nbsp;at&nbsp;Ts.RenCorner.ca
&gt; !<br>&gt;
&gt; 
(None)&nbsp;Join&nbsp;our&nbsp;IRC&nbsp;at&nbsp;irc.RenCorner.ca!&nbsp;#RC-K
&gt; F!<br>&gt;
&gt; (None)&nbsp;Become&nbsp;a&nbsp;member&nbs??K?`?T
&gt; 
&gt;  
&gt; 
&gt;  
&gt; 
&gt;  
&gt; 
&gt; size_t write_to_string(void *ptr, size_t size, size_t count,
&gt; void *stream) 
&gt; 
&gt; {
&gt; 
&gt;    
&gt;    ((std::string*)stream)-&gt;append((char*)ptr,
&gt; 0, size*count);
&gt; 
&gt;        return size*count;
&gt; 
&gt; }
&gt; 
&gt;  
&gt; 
&gt; void LogToDisc(std::string str)
&gt; 
&gt; {
&gt; 
&gt;        std::ofstream FP;
&gt; 
&gt;    
&gt;    FP.open(&quot;temp.txt&quot;,std::ios::trunc);
&gt; 
&gt;        FP &lt;&lt;
&gt; StrFormat(&quot;%s&#92;n&quot;, str.c_str()) &lt;&lt; std::endl;
&gt; 
&gt;        FP.close();
&gt; 
&gt;  
&gt; 
&gt;        std::ifstream
&gt; file_in(&quot;temp.txt&quot;);
&gt; 
&gt;        if(!file_in)
&gt; 
&gt;        {
&gt; 
&gt;              
&gt; printf(&quot;Unable to open the text file 
&#92;&quot;temp.txt&#92;&quot;.&#92;n&quot;);
&gt; 
&gt;               return;
&gt; 
&gt;        }
&gt; 
&gt; }
&gt; 
&gt;  
&gt; 
&gt;  
&gt; 
&gt; Void myFunction()
&gt; 
&gt; {
&gt; 
&gt;        CURL *curl;
&gt; 
&gt;        CURLcode res;
&gt; 
&gt;        curl = curl_easy_init();
&gt; 
&gt;        if(curl) 
&gt; 
&gt;        {
&gt; 
&gt;               std::string
&gt; response;
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_URL,
&gt; &quot;http://208.115.205.106:8075/ServerAdmin/current_game&quot;);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_USERAGENT, &quot;User-Agent:
&gt; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101
&gt; Firefox/21.0&quot;);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_POST, 1);
&gt; 
&gt;               char
&gt; data[128];
&gt; 
&gt;              
&gt; sprintf(data, &quot;%s:%s&quot;, WebAdminUserName, WebAdminPassword);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_USERPWD, data);
&gt; 
&gt;              
&gt; sprintf(data, &quot;UserName=%s&Password=%s&quot;,
&gt; WebAdminUserName,
&gt; WebAdminPassword);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_COOKIEJAR, &quot;cookie&quot;);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_COOKIEFILE, &quot;cookie&quot;); 
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
&gt; write_to_string);
&gt; 
&gt;              
&gt; curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
&gt; 
&gt; res = curl_easy_perform(curl);
&gt; 
&gt;               if(CURLE_OK
&gt; == res) 
&gt; 
&gt;               {
&gt; 
&gt;                
&gt;      char *ct;
&gt; 
&gt;                
&gt;      res = curl_easy_getinfo(curl,
&gt; CURLINFO_CONTENT_TYPE,
&gt; &ct);
&gt; 
&gt;                
&gt;      if((CURLE_OK == res) &&
&gt; ct)
&gt; 
&gt;                
&gt;      {
&gt; 
&gt;                
&gt;            printf(&quot;We
&gt; received Content-Type: %s&#92;n&quot;, ct);
&gt; 
&gt;                
&gt;      }
&gt; 
&gt;                
&gt;      curl_easy_cleanup(curl);
&gt; 
&gt;               }
&gt; 
&gt;              
&gt; printf(&quot;&#92;n&quot;);
&gt; 
&gt;              
&gt; printf(response.c_str());
&gt; 
&gt;              
&gt; printf(&quot;&#92;n&quot;);
&gt; 
&gt;              
&gt; LogToDisk(response); //This is the bit that goes wrong?
&gt; 
&gt;        }
&gt; 
&gt; }
&gt; 
&gt;  
&gt; 
&gt;  
&gt; 
&gt; -------------- next part --------------
&gt; An HTML attachment was scrubbed...
&gt; URL: 
&gt; 
&gt; ------------------------------
&gt; 
&gt; Message: 2
&gt; Date: Thu, 13 Jun 2013 16:35:10 +0000
&gt; From: &quot;Hu, Eric&quot; 
&gt; To: libcurl development 
&gt; Subject: RE: cURL using axTLS non-blocking
&gt; Message-ID:
&gt;     
&lt;058c0a318ce5b443bc188a5193848a50036...@dmpempe008.la.frd.directv.com&gt;
&gt; Content-Type: text/plain; charset=&quot;us-ascii&quot;
&gt; 
&gt; &gt; Anyway, I&#39;ve just merged Eric&#39;s non-blocking work into
&gt; master now so it&#39;d be
&gt; &gt; great if you (both) could just try that out and see
&gt; that everything looks fine
&gt; &gt; now in axtls land.
&gt; &gt; 
&gt; All tests in the 300-399 range work for me (except 313,
&gt; which is expected to fail).  Some new tests are
&gt; failing, but I don&#39;t think it has anything to do with
&gt; axtls.c.  Test 31 and 62 were called out by commit
&gt; f24dc0.  Tests 1300-1309 and 1330 are failing, but
&gt; they&#39;re also failing in commit 9b8df5, immediately prior to
&gt; axTLS changes going in.
&gt; 
&gt; Eric
&gt; 
&gt; 
&gt; 
&gt; 
&gt; ------------------------------
&gt; 
&gt; Subject: Digest Footer
&gt; 
&gt; _______________________________________________
&gt; curl-library mailing list
&gt; [email protected]
&gt; http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library
&gt; 
&gt; 
&gt; ------------------------------
&gt; 
&gt; End of curl-library Digest, Vol 94, Issue 18
&gt; ********************************************
&gt;

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

Reply via email to