mary Posted August 23, 2007 Share Posted August 23, 2007 happy to see an libcurl exemple !! tinks a lot Picasso !! just one question about libcurl.au3 ; This Callback function recieves the data downloaded ; it hast to behave exactly like crt's 'fwrite' Func _WriteFunc($pFile,$nSize,$nMemb,$pStream) ; Do nothing - discard data Return $nSize*$nMemb EndFunc how we can get data with _WriteFunc ? I tried with DllStructGetData($pStream,1) but with no success thinks again Link to comment Share on other sites More sharing options...
piccaso Posted August 23, 2007 Author Share Posted August 23, 2007 that way:Func _WriteFunc($pFile,$nSize,$nMemb,$pStream) $vData = DllStructCreate("byte[" & $nSize*$nMemb & "]",$pStream) $data = DllStructGetData($vData,1) Return $nSize*$nMemb EndFunc CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
mary Posted August 23, 2007 Share Posted August 23, 2007 (edited) that way:Func _WriteFunc($pFile,$nSize,$nMemb,$pStream) $vData = DllStructCreate("byte[" & $nSize*$nMemb & "]",$pStream) $data = DllStructGetData($vData,1) Return $nSize*$nMemb EndFunc just tested now but a get a raw data (hexadecimal format i suppose) with this url http://www.autoitscript.com some think like this 0000000000000000000000000000000000000000000000000000000000000000020000010000004C48BE773C48BE7718FFC2 77000000000C4ABE77084ABE77044ABE77004ABE77FC49BE77F849BE77F449BE77EC49BE77E449BE77DC49BE77D049BE77C4 49BE77BC49BE77B049BE77AC49BE77A849BE77A449BE77A049BE779C49BE779849BE779449BE779049BE778C49BE778849BE 778449BE778049BE777849BE776C49BE776449BE775C49BE779C49BE775449BE774C49BE774449BE773849BE773049BE7724 49BE771849BE771449BE771049BE770449BE77F048BE77E448BE770904000001000000010000008070000001000000F0F1FF FF00000000505354000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000050445400000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000E0FFC2772000C377FFFFFFFFFFFFFFFFFF FFFFFF0000000000000000FFFFFFFF00 should i add a conversion function ? Edited August 23, 2007 by mary Link to comment Share on other sites More sharing options...
piccaso Posted August 23, 2007 Author Share Posted August 23, 2007 (edited) Well yes, thats what i would expect from a byte array but there are to many 00's. I'm having the same odd behaviour here... When saved to a file (by libcurl internal) everything works fine but i never looked at the content when saving to memory. i remember a c example of doing that coming with libcurl, i'll have a look at this later... for now i just saw that i made a terrible mistake in the 'subclassing' stub, i mixed up 2 registers (esp & ebp). I didn't use ebp in the stub so i guess i'm using ebp from SendMessage API in other words, subclassing probably wont work on any other os build than mine. I'll fix that first Edited August 23, 2007 by piccaso CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
Zedna Posted August 23, 2007 Share Posted August 23, 2007 should i add a conversion function ?In String.au3 include file is _HexToString($strHex) function.Just for your info if that helps. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
mary Posted August 23, 2007 Share Posted August 23, 2007 In String.au3 include file is _HexToString($strHex) function.Just for your info if that helps.i tried this function without successanyway, thinks for help Link to comment Share on other sites More sharing options...
piccaso Posted August 23, 2007 Author Share Posted August 23, 2007 Ok i did my homework this time and actually read the documentation and wrote the 'subclassing' stub in proposed standard... I hope that was the last fix Also added a freebasic example of the dll and changed the libcurl to save the file to disk. CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
Zedna Posted August 23, 2007 Share Posted August 23, 2007 Ok i did my homework this time and actually read the documentation and wrote the 'subclassing' stub in proposed standard...I hope that was the last fix Also added a freebasic example of the dll and changed the libcurl to save the file to disk.Great UDF and examples!!I will try it for sure.Thanks Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
mary Posted August 23, 2007 Share Posted August 23, 2007 ... changed the libcurl to save the file to disk. Link to comment Share on other sites More sharing options...
ValeryVal Posted August 24, 2007 Share Posted August 24, 2007 File size of libcurl_dummy = 0 Output is following: RETR response: 550 It is according to curl_doc (libcurl/curl_easy_setopt.html): CALLBACK OPTIONS ... CURLOPT_WRITEDATA ... If you're using libcurl as a win32 DLL, you MUST use the CURLOPT_WRITEFUNCTION if you set this option or you will experience crashes. ... This is fact that Experience crashes... You are compelled to write file by AutoIt's funcs The point of world view Link to comment Share on other sites More sharing options...
piccaso Posted August 24, 2007 Author Share Posted August 24, 2007 550 means that the server doesn't want you to have it... I read this but i think (but i don't know) docs are outdated because this worked fine for me with the nt and the win32 dll. try another url.. The one i used is a speed test file from my isp, its on a public ftp server but maybe they configured it somehow clever the dummy file is fopen'd and fclose'd anyway so thats why there is a 0 byte file... I'm still trying to make 'download to memory' work - did i hear someone scream? mary? - but this will happen on another day... did it really 'crash' ? like rc != 0 ? if so im wrong CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
ValeryVal Posted August 24, 2007 Share Posted August 24, 2007 You are right. Now it works fine for me. :-) The point of world view Link to comment Share on other sites More sharing options...
ValeryVal Posted August 24, 2007 Share Posted August 24, 2007 It works fine. But file size of source and dest have different values, only. The point of world view Link to comment Share on other sites More sharing options...
piccaso Posted August 24, 2007 Author Share Posted August 24, 2007 filesize after download and size reported by libcurl ($dltotal) are the same as if i download it with firefox and binary identical. the server reports a size rounded to kb's which does not exactly fit... is it that what you mean? is so you can ignore it, thats pretty common... CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
ValeryVal Posted August 24, 2007 Share Posted August 24, 2007 No. File size of source and dest have different values. Source file is received by other ftp client and dest file is received by libcurl.au3 script. But it works fine - very fast. I know too that help is created as a result of previous mistakes. You can see that BOLD word MUST and it does matter, I think. The point of world view Link to comment Share on other sites More sharing options...
ValeryVal Posted August 24, 2007 Share Posted August 24, 2007 Maybe it will be useful. Dest file size is always > than source file size and this difference is related to source file size. The point of world view Link to comment Share on other sites More sharing options...
piccaso Posted August 24, 2007 Author Share Posted August 24, 2007 No. File size of source and dest have different values. Source file is received by other ftp client and dest file is received by libcurl.au3 script.But it works fine - very fast. well if the size differs it doesn't work fine for me...I know too that help is created as a result of previous mistakes. You can see that BOLD word MUST and it does matter, I think.not sure what you mean, are you referring to CURLOPT_WRITEDATA doc's ?libcurl is a mystery on its own, i'll probably spend more time on it than i thought...but for now i'm going to sleep oh, allmost forgot:can you post which url u used? and os, libcurl version... anything interesting thanks. CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
ValeryVal Posted August 24, 2007 Share Posted August 24, 2007 Please:I use random URL- ftp://ftp.kiarchive.ru/pub/0month-recursiveMy OS is WinXP + SP2 (Russian)Curl LIB is libcurl-4.dll It has doc about CURLOPT_WRITEDATA. See my first message. The point of world view Link to comment Share on other sites More sharing options...
ValeryVal Posted August 24, 2007 Share Posted August 24, 2007 Disributive of curl lib has name libcurl-7.16.4-win32-ssl-sspi.zip I got it from curl home page yesterday. I use your last version of libcurl.au3 from file au3_callback_v6.4.zip any Q? The point of world view Link to comment Share on other sites More sharing options...
piccaso Posted August 24, 2007 Author Share Posted August 24, 2007 oh its a text file, that explains everything CURLOPT_TRANSFERTEXTA non-zero parameter tells the library to use ASCII mode for ftp transfers, instead of the default binary transfer. For win32 systems it does not set the stdout to binary mode. This option can be usable when transferring text data between systems with different views on certain characters, such as newlines or similar.libcurl does not do a complete ASCII conversion when doing ASCII transfers over FTP. This is a known limitation/flaw that nobody has rectified. libcurl simply sets the mode to ascii and performs a standard transfer.i'm definitely to tired to understand that note about the flaw today CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
Recommended Posts