Takhir
7th December 2009 17:12 UTC
This work for me
;--------------------------------
; General Attributes
Name "Inetc ftp mkdir Test"
OutFile "ftp_mkdir.exe"
;--------------------------------
;Interface Settings
!include "MUI.nsh"
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
; use your own URL and login@pwd. Password hidden from user with /popup "ALIAS"
inetc::put /caption "service pack upload" /popup "" "ftp://takhir:somepwd@localhost/subdir/inetc.dll" "$EXEDIR\inetc.dll"
Pop $0
MessageBox MB_OK "Upload Status: $0"
SectionEnd
Sorry, CLI output is in Russian, but it is not difficult to understand
>dir /S /W
Том в уÑтройÑтве C имеет метку OS
Содержимое папки C:\Users\takhir\Documents\wftpd\shared
[.] [..] [subdir]
0 файлов 0 байт
Содержимое папки C:\Users\takhir\Documents\wftpd\shared\subdir
[.] [..] inetc.dll
1 файлов 20_480 байт
Ð’Ñего файлов:
1 файлов 20_480 байт
5 папок 130_276_462_592 байт Ñвободно
StephanB86
8th December 2009 08:31 UTC
It's not working for me. User got the permission to read/edit/create/execute.
inetc::put /caption "service pack upload" /popup "" "ftp://myuser:mypass@192.168.0.150:8021//Application/Test//inetc.dll" "C:\DELL\5mb.bin"
Pop $0
MessageBox MB_OK "Upload Status: $0"
Returns: Upload Status: Reget Error
*For testing I created a 5mb.bin*
With CLI and ftp open it's possible. Also tried several attempts using extra slashes.
skuallpa
2nd February 2010 08:50 UTC
Hello,
I have a problem with the unicode build of inetc. I am trying to send post values to a script on my website.
This is my command line:
inetc::post "t=i&v=2" /SILENT /TIMEOUT 2500 "https://www.mywebsite.com/myscript.php" "$TEMP\BD-827364682984.txt" /END
Bot nothing is send, as if the connexion could not be established.
Thanks in advance for your help
robod
25th February 2010 09:26 UTC
Zdravstvuj Takhir :-),
I'm wondering if you could help me with this.
I've got a php script which allows me to upload a file (just a normal HTML form with upload). I'd like to post data to that script and upload a file.
So, the question is - is it possible to use inetc::post to upload a file?
I guess I can use the TEXT2POST field, but I would have to MIME encode the file as a text and I'm worried that it will not be long enough.
If it's not possible, have you (or anyone else) got a better idea how to do it? Alternatively, would you be able to enhance inetc, so it's possible?
I can't use put as it's a IIS server and I can't enable webdav (to allow put).
Thanks,
Rob
punkomat
14th September 2010 11:08 UTC
Thanks, I took your suggestion. If anyone needs this, just modify inetc.rc and rebuild:
IDD_DIALOG3 DIALOG DISCARDABLE 0, 0, 300, 62
STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",0x0,0,23,
300,11
CTEXT "",IDC_STATIC1,0,8,266,11
PUSHBUTTON "Cancel",IDCANCEL,213,41,80,16
END
When recompiling with a newer Visual Studio, make sure you link against libcmt.lib and not msvcrt.lib as by default, otherwise you will require msvcrXY.dll at runtime depending on your VS version. The statically linked plugin is a tad larger, but works everywhere.
bsmith1
28th January 2011 16:39 UTC
/BANNER with SilentInstall
Hello,
I use NSIS to run a Java program, so I run it in SilentInstall.
However, before it runs, I check if java.exe is present, if not I download the JRE using Inetc::get.
My issue is that in "SilentInstall silent" mode, the /BANNER or /POPUP do not show the downloading progress windows.
I know this was done on purpose since it is supposed to be "silent", however is there an option or a way to implement that the progress windows shows up, like a /NOSILENT option?
That would be great!
Thanks
- NSIS Discussion
- http + ftp download plug-in
Archive: http + ftp download plug-in
Takhir
30th January 2011 12:52 UTC
Originally posted by bsmith1
I know this was done on purpose since it is supposed to be "silent", however is there an option or a way to implement that the progress windows shows up, like a /NOSILENT option?
Yes, this is possible to implement, I even tested 'small' changes and found that for installer with /S dialog appears in the center of screen. Looks a bit ugly for silent install, IMHO would be better to move it to the right bottom corner. Or to left top. May be /NOSILENT /POSITION X:Y (percents, pixels?). So we need to understant a full set of options for this feature. Code update for this may take time (and I need to find this time in my schedule :( ).
Necku
14th February 2011 01:14 UTC
/RESUME seems buggy for me.
If I enable it without the extra text parameter then the download errors with "connecting". If I add the extra text, then I properly get a pop up, however clicking retry seems to do nothing and the pop up just comes up over and again and the download never resumes, when clicking cancel I get "reget error". Any idea on what could be going on ?
-Using win7 64bit
-compiled non unicode script
-file is in direct download and support resuming (through firefox or download manager)
-no other options used for inetc
-tried disabling device or unplugging cable gives same result
Help appreciated!
Takhir
14th February 2011 11:51 UTC
/RESUME RETRY_QUESTION - parameter is mandatory. On error during download plug-in asks you what to do - continue download or fail with rising some error (reget error in this case). If network cable still disconnected, Resume popup will appears again. Normal behavior is to restore connection (where is my VPN! :) ) and press Resume button after this only.
Necku
14th February 2011 13:40 UTC
Thanks for the reply Takhir!
For the parameter: yes I was confused by the existence of a default value. Seeking for example I figured it was used if you use an empty string "" as parameter, problem solved.
However for the pop up, this is exactly my issue, the plugin seems to fail to detect my connection is available again. i.e. after plugging the cable back in and even if internet works perfectly, the pop up with retry/cancel error will keep showing up, refusing to restore the download.
Necku
14th February 2011 18:01 UTC
Looks like I owe you an apology. Your files work perfectly. As the history page show (http://nsis.sourceforge.net/File:Inetc.zip) someone else applied modifications on your plugin which caused the bug, using the last version uploaded by yourself (16:04, 13 July 2010) works perfectly. I don't know why/who modified it but you might want to revert it.
Thanks for your awesome work :)
Takhir
14th February 2011 18:04 UTC
Sorry, after reading code :) : Reget error for http means that InternetSetFilePointer() failed with (REST for ftp). So connection itself was already established, but server could not continue download from this position. Dynamic content names, unknown file size in reply, server functionality limitations - what else? Could you reproduce this on another server? On static content/file?
Takhir
14th February 2011 18:25 UTC
Thanks, Necku, presisely, JohnTHaller added 2 flags "for cleanliness", but "This handle must not have been created with the INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_NO_CACHE_WRITE value set." Main idea from the very beginning was to add reget support. But I'll think a little is this a bug or feature :). May be well need to rollback inetc version.
Necku
14th February 2011 18:31 UTC
You're welcome, I'm happy as long as it works :D
On a side note I'll pm you the URL I used for tests so you can see by yourself :)
Takhir
14th February 2011 19:02 UTC
Unfortunatelly I cannot login to sourceforge now (server internal error), so I am attaching patched version here for the moment. New flags will be used if resume option not set only. Necku, if you will have time, please test this ;)
Necku
14th February 2011 19:59 UTC
Originally posted by Takhir
Unfortunatelly I cannot login to sourceforge now (server internal error), so I am attaching patched version here for the moment. New flags will be used if resume option not set only. Necku, if you will have time, please test this ;)
Works like a charm :)
cole2k
25th February 2011 16:06 UTC
First I'd like to say thanks for the plugin, it looks to be exactly what I've been looking for.
I am having a small issue with inetc::get it works for the most part, but on my server logs it's showing as POST instead of GET.
The version I'm using is the one you posted above on the 14th.
Example:
Section "Dummy Section" SecDummy
inetc::get /USERAGENT "Some Browser" \
"http://somesite.com/somepage.html" "$EXEDIR\somepage.html"
Pop $0
MessageBox MB_OK "Download Status: $0"
SectionEnd
Takhir
25th February 2011 17:02 UTC
I re-tested 2 last versions and in apache logs I see:
127.0.0.1 - - [25/Feb/2011:19:45:35 +0300] "GET /aut_1986.htm HTTP/1.1" 200 17952
127.0.0.1 - - [25/Feb/2011:19:55:11 +0300] "GET /aut_1986.htm HTTP/1.1" 200 17952
for the following script:
inetc::get /useragent "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)" "http://localhost/aut_1986.htm" "$EXEDIR\aut.html" /end
In code I see 3 situations where POST may have place: 1) inetc::post(); 2) /file ; 3) /NOUNLOAD in previous POST request. Any other ideas?
Latest release is here http://nsis.sourceforge.net/File:Inetc.zip
cole2k
25th February 2011 18:13 UTC
Thanks Takhir,
I've tried your example with the latest version and it works fine. My problem appears to be with the agent string I've been trying to use.
Works fine:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)
Causes POST:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET CLR 1.1.4322; InfoPath.2)
Takhir
26th February 2011 06:50 UTC
You are right, cole2k, string size limit 128 chars in current version for user agent. Most of strings in inetc allocated dynamically with size 1k or 8k depending on NSIS build, but not user agent. Most of servers support at least 8kB fields. I'll fix this in next release.
yyv
30th March 2011 14:53 UTC
/resume
Dear sirs,
I’m trying to use your plugin with parameter/RESUME
Everything seems to work normally.
We started downloading, then disconnected the network cable, downloading broke and a message requesting to resume/cancel the downloading appeared. We connected the cable, clicked “resume” and downloading continued.
But actually, there is no real downloading. The plugin downloads everything from the start till the moment of break and then continues downloading.
For example, I’m downloading a 600 mb file.
When 200 mb are downloaded, I disconnect the network and then connect it.
The downloading process seems to continue but the progress bar doesn’t move ahead.
Once the plugin downloads those 200 mb once again he continues the further download.
Is this the way the plugin operates or is it an error?
What can we do to resume the downloading from the point of downloading break?
Thank you.
klopfdreh
4th April 2011 15:17 UTC
Hello,
first of all thanks a lot for that great plugin!
I saw that there is a new release with this resume flag and I tried it by myself. I've the same issue as yyv.
In addition to that there are sometimes errors while downloading files that are bigger in size while there is kaspersky running on that client. The antivirus scanner trys to check the complete file after download and then the inetc.dll is running into a timeout which is not regarding due to an issue of the connection. This problem appears on several systems - windows xp / vista / 7.
Any ideas?
Thanks a lot again and hopefully we will se a lot of updates to this plugin in feature!
Takhir
4th April 2011 18:24 UTC
I prepared small patch for reget feature, but we still have this problem on nginx server (apache is OK), so please wait few days.
No ideas about virus protection....
klopfdreh
5th April 2011 07:04 UTC
@Takhir - what I also found out so far about the "kaspersky issue" is that downloads of the same files in browsers also take for about ~30 seconds till they are finished. During this time the progress bar and the percentage info stucks on 99%,too.
The delay until the Internet Explorer throws an error is much later then of inetc.dll. Maybe it is regarding how the WinInet lib is used of both (please correct me if I'm wrong).
What I have tried so far is to reset the browser settings. Reference to microsoft answer: Download stucks at 99% Solution - still the same issue.
Is there a delay not regarding an connection timeout that can be configured till the download will be aborted?
Thanks a lot again for your fast answer!
klopfdreh
5th April 2011 11:05 UTC
I looked into your source code and there are a lot of other TIMEOUT settings that can be applied to "hinternet" - and in the past, some of them, weren't implemented.
InternetSetOption(hSession, INTERNET_OPTION_SEND_TIMEOUT, &timeout, sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_DATA_SEND_TIMEOUT, &timeout,
sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_RECEIVE_TIMEOUT, &timeout,
sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, &timeout,
sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT,
&timeout, sizeof(DWORD));
InternetSetOption(hSession, INTERNET_OPTION_CONTROL_SEND_TIMEOUT, &timeout,
sizeof(DWORD));
The reason why I did this is, because I tried to increase the timeout and shut down my http server during the download. After that the error message appeared in exaclty the same time.
Maybe it is a bug?!
Takhir
5th April 2011 11:40 UTC
May be. But MSDN says that DATA_SEND/RECEIVE_TIMEOUT related to ftp only. CONTROL_RECEIVE is identical to RECEIVE. So the only flag that can help with big files download via HTTP is INTERNET_OPTION_RECEIVE_TIMEOUT (probably no separation of HTTP header and data).
Currently plug-in can use not default INTERNET_OPTION_CONNECT_TIMEOUT only (if set in parameters - /timeout). I do not remember why it was added in 2005 :), but IMHO this option is good. This way we can change IE default setting for connection t/o. If you can test RECEIVE_TIMEOUT flag and confirm that this resolves situation with antivirus (this may be true if Kaspersky catches data before Inetc), I'll add this new option.
Thanks, Takhir
klopfdreh
5th April 2011 13:57 UTC
I tried various settings now in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
ReceiveTimeout (REG_DWORD) = 300000
KeepAliveTimeout (REG_DWORD) = 300000
ServerInfoTimeout (REG_DWORD) = 300000
But I had no success, because I received the error message every ~3000 Milliseconds and not as expected ~5 minutes.
So I had a deeper look into the source code.
Please correct me if I'm wrong, but you are using a thread which is waiting if there is a transfer and if not it will abort after 3000 milliseconds, right?
Line: WaitForSingleObject(hThread, 3000) == WAIT_TIMEOUT
Could it be that the timeout which is going to be set via RECEIVE_TIMEOUT and CONNECT_TIMEOUT should influence this timeout, because the thread would exit to early?
In my opinion the changes of the RECEIVE_TIMEOUT would be only a little (~5 lines -> cmd line parsing and call in the function itself), so I would add it to the next version, to set it as needed.
P.S.: A few options are not mentioned in the wiki (for example: nocookies).
Yathosho
6th April 2011 23:43 UTC
could it be the plugin ignores the default font rendering settings when used in /BANNER mode? it seems to ignore the fact i have cleartype enabled.
klopfdreh
18th April 2011 12:44 UTC
Hello again,
@Takhir : Anything new to Yathosho and my objections?
Takhir
19th April 2011 06:41 UTC
Originally posted by klopfdreh
Please correct me if I'm wrong, but you are using a thread which is waiting if there is a transfer and if not it will abort after 3000 milliseconds, right?
Line: WaitForSingleObject(hThread, 3000) == WAIT_TIMEOUT
No, in this line plug-in waits transfer thread termination after Cancel button was pressed. On server termination DATA_RECEIVE_TIMEOUT probably defines time. If you tested InternetSetOption(hSession, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, &timeout,
sizeof(DWORD)); and this work as expected please let me know (or I'll test this when I'll have time - a lot of job now :( ). Both options - connection and receive timeouts have sence, so let's test and add new feature :).
> P.S.: A few options are not mentioned in the wiki (for example: nocookies).
Thanks!
> could it be the plugin ignores the default font rendering settings when used in /BANNER mode? it seems to ignore the fact i have cleartype enabled.
Yathosho, please send me minimum size sample script and I'll test this. Only english/russian/italian systems are available now for me :).
klopfdreh
19th April 2011 07:26 UTC
@Takhir: Thank a lot for the fast answer again. Well I don't have the environment to compile the source :( . Would you please so kind and test it?
The way I did was simply to limit the transfer rate of the http server and shut it down, before the download was finished. The response always appears after ~3 Seconds, thats why I was supposing it could be the line I worte. And in the case of the virus scanner it also appears in ~3 Seconds, because the file is beeing scanned.
It would be really really nice, because we are using your lib to update clients automatically in an environment with ~1500 users. :)
I think it should be only a little change, just those lines that get the parameter out of the call and if the parameter contains the receive timeout the call of the internetSetOption.
klopfdreh
26th April 2011 07:20 UTC
Now I tried to compile it with cygwin by myself and I got some errors during the compilation (picture)
@Takhir: Because I can't compile it easily - would you be so kind and add/change the following lines to inetc.cpp and recompile it? I think it should work that way:
line 208:
timeout,
receivetimeout = 0;
line 799:
if(receivetimeout > 0)
InternetSetOption(hSes, INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, &receivetimeout, sizeof(receivetimeout));
line 1374:
else if(lstrcmpi(url, _T("/receivetimeout")) == 0)
{
popstring(url);
receivetimeout = _tcstol(url, NULL, 10);
}
That would be very very nice of you. If you could do this and post a new build in here I would check if that will solve our problem!
Edit: I was able to solve the error with the exdll by using the exdll.h and the api.h of the current source of nsis but the error in inetc.cpp on line 648 still appears.
Afrow UK
26th April 2011 10:50 UTC
You don't need to use strtol (you don't want a dependency on CRT). NSIS exposes popint() and myatoi() that you can use.
Stu
klopfdreh
26th April 2011 10:59 UTC
Ok, I solved it for my environment. I used dev-c (g++) within cygwin:
g++ -c inetc.cpp -I/usr/include/mingw -lwininet -lcomctl32
g++ -shared -o inetc.dll inetc.o -I/usr/include/mingw -lwininet -lcomctl32
and I used the exdll.h and api.h attached to the post.
@ Afrow UK: It is not my code. I only want to recompile and test the changes posted above.
Edit: Well my dll doesn't work! :D I hope I will get it running today.
Edit2: Mmhhh I don't know why it is not working for me, the result if I compile the dll is, that the return value is not "OK". Example:
inetc::get /NOCOOKIES /TIMEOUT 300000 /NOCANCEL /CAPTION "$(^Name)" /RESUME "..."
Pop $R0
MessageBox MB_OK $R0
$R0 is always the first paramter I give into the dll call....
Takhir
26th April 2011 12:23 UTC
I am sorry... and thank for your efforts!
I am attaching build with your changes, please send me info if you need something else and I'll try to do this tonight.
klopfdreh
26th April 2011 12:49 UTC
@Takhir: Thank you very very much! Maybe you are able to tell me what I did wrong with the compilation?
I don't know why it doesn't worked for me - even NSIS was compiling fine...
Edit: I tried the new version with the internetreceive timeout and if I have the kaspersky virus scanner installed, it trys to check the download after the tranfer and then aborts. :cry: I've tested it on a vmware box already...
Edit2: BUUUUUTTTT!!! I tested the ReceiveTimeout in the registry again and then the download worked for me. Seems that the internetSetOption with INTERNET_OPTION_DATA_RECEIVE_TIMEOUT doesn't apply it to the current connection.
Brrrr.... this smells like an ugly sh* but I'm going to set the dword previously:
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" 'ReceiveTimeout' 0x001b7740
Takhir
27th April 2011 18:33 UTC
Thanks, klopfdreh
Attached plug-in worked as expected (for me ).
Finally: INTERNET_OPTION_RECEIVE_TIMEOUT sets what we need. Interesting information from MSDN 2005: INTERNET_OPTION_DATA_RECEIVE_TIMEOUT 8 Not implemented.
Now Inetc options are /connecttimeout and /receivetimeout, both in seconds (not milliseconds!). I.e. 60 sec timeout will be /receivetimeout 60
And ... this not took many time after I understood how to test timeout - simple php script with sleep() . Included to zip. please let me know if big files problem resolved.
klopfdreh
28th April 2011 09:00 UTC
Great! Thanks a lot! I'm going to test it without the reg key and with this new version, now!
Edit: It is working like a charm, even without the registry entry - thank you very very much! :D
I think we should add those changes to the wiki, too. It is a great change and really usefull!
Takhir
28th April 2011 09:30 UTC
Thank you very much, klopfdreh! I'll add this patch shortly to archive.
Yathosho
4th May 2011 12:35 UTC
Originally posted by Takhir
Yathosho, please send me minimum size sample script and I'll test this. Only english/russian/italian systems are available now for me :).
(screenshot based on your cameron diaz example)
is the banner using the system font? it should be antialiased according to my windows settings, but it's not.
Yathosho
4th May 2011 12:42 UTC
btw, i have tried to use InetLoad with three switches (/TIMEOUT 5000 /RESUME /BANNER) but the download only works when using just one of these. the documentation and examples don't deal with multiple switches, is it even possible to chain these?
zenpoy
23rd May 2011 09:27 UTC
Hi all - I've noticed that when using embedded progress bar the text above the main progress bar is always printf("Downloading %s",filename), ignoring the caption switch. so I've changed the code a bit to make the text printf("%s",caption) if the caption switch exists.
If you think the this is really a bug you can merge it. Anyway, this is what the I thought the expected behavior would be.
Thanks,
J
ManoKum80
26th May 2011 20:02 UTC
Feature Add Request -
- If download file already exists, check hash, if OK do not re-download
- Resume download even if user Cancels it, something like /NODELETE option on nsisdl v1.4
- on resume prompt, window title is 'Inetc plugin', it should be either removed completely or changeable via some option
Currently both above are available nsisdl v1.4 but it does not have authentication/proxy handling features that inetc can do.
PS - let me know if above features are already available and i am missing something.
Great thanks to all!
MSG
26th May 2011 20:07 UTC
Originally posted by ManoKum80
- If download file already exists, check hash, if OK do not re-download
This is actually trivial to implement in NSIS code. Use the md5dll plugin.
zenpoy
15th June 2011 14:50 UTC
Bug?
I think I found a bug in Inetc but I'm not sure - for some reason it clears the stack after cancelling. Does anyone see this behavior also?
EDIT: It clears the stack when clicking cancel and then it pops up an are you sure dialog - while it continues to download - if it finishes to download while the dialog is still open and then I press "Yes" (which means - yes, I'm sure I want to cancel) It clears the stack. If everyone see this behavior - I think it's pretty critical...
Takhir
15th June 2011 14:57 UTC
Originally posted by zenpoy
I think I found a bug in Inetc but I'm not sure - for some reason it clears the stack after cancelling. Does anyone see this behavior also?
inetc can download few files, so stack can include few pairs of URL/file, on termination plug-in should remove tail from stack. Best of all is to use /end paramater in your command line.
- NSIS Discussion
- http + ftp download plug-in
Archive: http + ftp download plug-in
zenpoy
15th June 2011 15:02 UTC
the command line I'm using is:
Inetc::get /NOPROXY /QUESTION "" /CAPTION "Installing $TITLE" $IS_PROXY_ALLOWED $URL $R3 /END
zenpoy
15th June 2011 15:27 UTC
Anyway - I think I fixed it I've changed dlgProc, case IDCANCEL to be:
case IDCANCEL:
if(nocancel) break;
if(szQuestion) {
msgboxAnswer = MessageBox(hDlg, szQuestion, szCaption, MB_ICONWARNING|MB_YESNO);
if (msgboxAnswer == IDNO)
break;
else if (status == ST_DOWNLOAD)
status = ST_CANCELLED;
}
zenpoy
16th June 2011 08:39 UTC
ok... now I've fixed it
Sorry for spamming the thread... The former solution wasn't a solution - it did not clear the stack but it returned a wrong status. So please ignore the last fix.
There's a function called inetTransfer which pops pairs of url and file name and downloads them. what I did was to add two lines right after the loop that does that:
if (lstrcmpi(url, _T("/end"))==0)
pushstring(url);
And in cleanup section I removed the status check - so now I always clean the stack.
Hope it makes sense to anyone. If you want the fixed version, tell me.
J.
Takhir
16th June 2011 11:41 UTC
Originally posted by zenpoy
Hope it makes sense to anyone. If you want the fixed version, tell me.
J.
Thanks, zenpoy!
If you can send me PM with updated source, I'll merge changes and build new release for wiki.
Unfortunatelly I am overloaded with business tasks and had not time to dig into proble, sorry :(.
Takhir
zenpoy
27th July 2011 13:48 UTC
What do you use to compile inetc?
When I'm using the inetc.dll out of the box (that is, out of the zip) it works fine in winxp sp2. When I use my x64 (win7) pc with both vs2008 and vs2010 to compile the source code it produces a dll that works in win7 but is not working in winxp sp2 (without any updates/vc++ packs or anything, completely fresh install).
When I try to call inetc:
strcpy $R0 "http://www.google.com/intl/en_com/images/srpr/logo2w.png"
Inetc::get /SILENT /CONNECTTIMEOUT 10000 $R0 "image.png" /END
dumpstate::debug
it leaves the args on the stack ( /SILENT /CONNECTTIMEOUT 10000 $R0 "image.png" /END)
So how do you compile it to be compatible for xp sp2??
Thanks
Takhir
27th July 2011 14:23 UTC
I compile it in VS 6 on XP or Vista. Resulting DLL depends on msvctr.dll but this is OK. You can change settings in later VS to multithreaded DLL, this case module size should increase, but without dependencies to runtimes. IMHO targetver.h should not produce any conflicts.
zenpoy
3rd August 2011 09:10 UTC
Thanks! that helped... I tried to change to multithreasded DLL but still, it didn't work. So I used VS6 and it works like a charm.
Takhir
4th August 2011 07:53 UTC
Oups... Sorry, 'multithreaded' only. No 'DLL' and no dependencies to runtimes this case. But any case VS 6 is better way.
zenpoy
4th August 2011 09:33 UTC
I have now another issue with winxp32 sp2. In win7/vista and others I can redirect from https to http. but in winxp32sp2 I get error Redirection (302). I thought I should add something like:
InternetQueryOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
(LPVOID)&rslt, &(err = sizeof(rslt)));
rslt |= SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP;
InternetSetOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
&rslt, sizeof(rslt) );
but it didn't work - I'm not that familiar with the code, can you give me some guidance?
Takhir
4th August 2011 10:04 UTC
Inetc already has
#define MY_REDIR_FLAGS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
for primary https URL. 'SECURITY_' flags are the same
#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
So I guess problem is in this XP settings or in WinInet.dll version supplied with this OS/SP.
I am attaching test version with merged code for 'Cancel' issue (because it's not possible to send link in PM :( ). BTW I am not sure if anybody use this 'multiple download' mode. May be has sence to remove this option and download one file per Inetc call? For me this even simpler then long-long-long strings with name-URL pairs...
zenpoy
4th August 2011 13:53 UTC
1. regarding the winint.dll and https->http redirection in xp sp2, I found out this http://support.microsoft.com/kb/907301 issue, and applying the hotfix (which only replaces winint.dll and adds registry key) solves it! the bad news is that wininit.dll is a 'KnownDll' which means it always loaded from Windows\System32 and only OS can update it. I think the only way is to change the redirection to be like XP SP2 wants.
2. regarding the 'cancel' bug - looks good :) The bug is not related to multiple downloads, I use only one download at a time, and I had this bug.
tperquin
19th October 2011 15:36 UTC
Hello Takhir,
First of thanks for the plugin. I however encountered a problem with the FTP PUT functionality of the plugin. It has to do when PUTing files that are in non-existing (on the FTP server) subdirectories.
The plugin determines if a FTP PUT upload failed due to a non existing subdirectory and tries to create the necessary subdirectories.
However the code that determines non-existing subdirectories relies on the FTP server's response. And I encountered a FTP server where the code in the plugin failed.
I attached two images with the different responses by different FTP servers on non-existing directory.
Code fix should be easy, around line 528 in inetc.cpp:
if(fput && _tcsstr(buf, _T("550")) != NULL)
{
Change to: (or what you prefer)
if(fput && (_tcsstr(buf, _T("550")) != NULL || _tcsstr(buf, _T("553")) != NULL))
{
I saw a few messages that also had problem with subdirectories and FTP PUT earlier in the thread. Those probably had to do with this as well.
Takhir
19th October 2011 18:40 UTC
Good job, tperquin, than you!
I uploaded new release http://nsis.sourceforge.net/File:Inetc.zip
DaLiV
21st October 2011 11:12 UTC
in .zip lost non-unicode version
Takhir
21st October 2011 11:48 UTC
Oups... Fixed.
CritterNYC
26th October 2011 18:45 UTC
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
Zinthose
17th November 2011 20:49 UTC
It looks like inetc::head is corrupting the stack.
DetailPrint "Beer is placed on the stack.."
Push "BEER"
inetc::head "http://download.macromedia.com/pub/flashplayer/current/install_flash_player_ax_32bit.exe" "$TEMP\Temp.dat"
Pop $0
DetailPrint "Result of inetc::head = $0"
DetailPrint "Reach for Beer..."
Pop $0
${If} $0 == "BEER"
DetailPrint "Sip... ahh... sweet sweet beer!"
${Else}
DetailPrint "I'm sorry but inetc::head drank your beer. :'-("
${EndIf}
Please won't someone find my beer?
zenpoy
17th November 2011 20:57 UTC
Zinthose, try putting /END as the last argument to tell inetc where is the end of your argument list:
inetc::head "http://download.macromedia.com/pub/flashplayer/current/install_flash_player_ax_32bit.exe" "$TEMP\Temp.dat" /END
Zinthose
17th November 2011 21:05 UTC
You found my beer!
Weird bug though... need a tinfoil hat for this one. :tinfoil:
klopfdreh
8th December 2011 08:02 UTC
Details button and information text in instfiles page
Hello!
Since I wrote the last time into this thread the plugin is working like a charm, so thanks a lot first!
I have only two little feature request regarding the detail button and the information which are being displayed.
1. Is it possible not to grey the button out, but instead to make it pushable and print the downloading information into the textarea on each refresh?
Example:
<filename>: 14071kb (6%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 32833kb (14%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 53940kb (23%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
.
.
.
2. Is there a way to show which file is downloading at the moment, because in my installer there is only the product name displayed on top of the installation bar?
Example:
Downloading: <filename>
[ || || || || || || || || || || || || || || || || || || || || ]
Thanks a lot!
dravster
5th February 2012 23:38 UTC
Odd Error with Inetc::get
Using the below simple test code at both my work (win7) and home (xp) hosts I get
the error "U" off the stack. I'm using NSIS 2.46 and the latest Inetc plugin from
http://nsis.sourceforge.net/Inetc_plug-in.
Name "InetClient GET Test"
OutFile "get.exe"
!AddPluginDir ./plugins
!include "MUI.nsh"
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "Dummy Section" SecDummy
SetDetailsView hide
; single file, NSISdl-style embedded progress bar with specific cancel button text
inetc::get /canceltext "interrupt!" "http://drav.net/test.md5" "$EXEDIR\test.md5" /end
; NSISdl::download /TIMEOUT=30000 http://drav.net/test.md5 $TEMP\test.md5
Pop $1
MessageBox MB_OK "Download Status: $1"
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
FunctionEnd
The Error appears as so (and no file is downloaded).
http://drav.net/error.jpg
Takhir
6th February 2012 05:43 UTC
test.md5 38 bytes, status OK. String may be trancated to first char only ('U') if you use Unicode plug-in version with multibyte installer.
dravster
6th February 2012 09:31 UTC
Re: Odd Error with Inetc::get
Yep that was it, drop in the "plugin/Inetc.dll" file (rather than unicode/Inetc.dll) and volia - It works :D
Cheers for the quick response (as ever!) Takhir!
Regards
D.
klopfdreh
2nd April 2012 07:08 UTC
Originally posted by klopfdreh
Hello!
Since I wrote the last time into this thread the plugin is working like a charm, so thanks a lot first!
I have only two little feature request regarding the detail button and the information which are being displayed.
1. Is it possible not to grey the button out, but instead to make it pushable and print the downloading information into the textarea on each refresh?
Example:
<filename>: 14071kb (6%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 32833kb (14%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 53940kb (23%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
.
.
.
2. Is there a way to show which file is downloading at the moment, because in my installer there is only the product name displayed on top of the installation bar?
Example:
Downloading: <filename>
[ || || || || || || || || || || || || || || || || || || || || ]
Thanks a lot!
Hello again,
only wanted to say that I solved the "2." by settings the right caption, but point "1." would be really nice if it is possible. :D
barabanger
5th June 2012 18:25 UTC
Originally posted by CritterNYC
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
I noticed same issue, at least when using inetc from another process. From what I discovered, to avoid this, WS_EX_NOACTIVATE style should be set in dialog template.
klopfdreh
6th June 2012 09:27 UTC
Hello everyone again,
I got some troubles with the inetc plugin and a low speed http server. After an undefined time the download aborts and a dialog show an error that the connection isn't available. If I press retry the dialog is shown again - so there is a loop which always show the error message and retry/abort. If I press abort the process is aborted as expected. The error is not within the time of 1800 seconds - it appears randomly.
I'm using the following call in our NSIS script:
inetc::get /NOCOOKIES /CONNECTTIMEOUT 1800 /RECEIVETIMEOUT 1800
/NOCANCEL /CAPTION "$(INETCHeader)${What}" /TRANSLATE
"$(INETC1)" "$(INETC2)" "$(INETC3)" "$(INETC4)" "$(INETC5)"
"$(INETC6)" "$(INETC7)" "$(INETC8)" /RESUME
"$(DownloadResumeWarning)" "$downloadURL${What}"
"$userhomeworkingdir\${What}" /END
Thanks a lot!
negativesir
21st August 2012 05:28 UTC
Originally posted by CritterNYC
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
Yes, this has to do with
WM_INITDIALOG not returning false.
From MSDN:
The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control specified by wParam. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus.
Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
T.Slappy
21st August 2012 09:10 UTC
[OT] Thanks for the fix, but seriously you are using Visual C++ 6.0 and Win 95 ??? [/OT]
negativesir
21st August 2012 09:14 UTC
Originally posted by T.Slappy
[OT] Thanks for the fix, but seriously you are using Visual C++ 6.0 and Win 95 ??? [/OT]
Yea. NSIS supports Windows 95 or higher. If I compile the source with anything higher than Visual C++ 6.0, the resulting DLL will not work on Windows 95. I have a Virtual PC Windows 95 image which makes it easy and I just had to downloaded Visual C++ 6.0. I compiled on Windows 7 and copied it over to the VM and tested the installer with the DLL.
T.Slappy
23rd August 2012 05:57 UTC
Originally posted by negativesir
Yea. NSIS supports Windows 95 or higher. If I compile the source with anything higher than Visual C++ 6.0, the resulting DLL will not work on Windows 95. I have a Virtual PC Windows 95 image which makes it easy and I just had to downloaded Visual C++ 6.0. I compiled on Windows 7 and copied it over to the VM and tested the installer with the DLL.
[OT]
Thanks for explanation, nice job.
I assume nobody uses version below Windows 2000 and also Microsoft does not support such old versions any more.
[/OT]
negativesir
23rd August 2012 06:17 UTC
Originally posted by T.Slappy
[OT]
Thanks for explanation, nice job.
I assume nobody uses version below Windows 2000 and also Microsoft does not support such old versions any more.
[/OT]
I don't doubt that. I know Microsoft doesn't support Windows 9X but NSIS does! Let me put it this way, I have a duty.. no a.. moral obligation.. to ensure that my patch does not break the minimum OS requirements.
T.Slappy
24th August 2012 08:03 UTC
Originally posted by negativesir
Let me put it this way, I have a duty.. no a.. moral obligation.. to ensure that my patch does not break the minimum OS requirements.
Like!!!
thaman667
10th September 2012 15:29 UTC
For me it's not showing any window with download information which is very annoying..
Afrow UK
10th September 2012 15:36 UTC
Where are you calling the plug-in from? To show download progress you probably need to use it in a Section (and without /silent).
Stu
zenpoy
8th November 2012 08:34 UTC
Can I resolve the filename from the request with inetc?
I have a url which I download a file from during install, this url is using redirection and the name of the file is based on some of the get parameters I use. Anyway, is there a way to use inetc to use/extract the filename from the last redirection in the redirection chains and use that as the filename? I have no problem do the change myself and try it, but I don't have to much experience with wininet api.
BTW - When I put the url in the browser (e.g. chrome) address bar it automatically uses the correct filename to save the file - this is the behaviour I would like to implement.
Thanks
maliktous
3rd December 2012 13:04 UTC
Originally posted by negativesir
Yes, this has to do with WM_INITDIALOG not returning false.
Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Thank. You save my day.
Takhir, are you planning to include this fix into new version?
newuser10
14th May 2013 21:50 UTC
Hey guys,
Just a disclaimer, I'm still new to NSIS in general
The INETC plugin seems to work very well in general, although I'm having an issue which appears to be intermittent.. Basically i am attempting to retrieve a large number of files, approx 2 GB in size spread over 150 files and the transfer of some files are failing intermittently.
I am using the /resume switch and when the failure occurs it takes place somewhere in the middle of a file transfer, when I click on resume, I right away get the same popup coming up asking if i want to resume or cancel.
If i close up the installation package entirely, it will usually go through that file no issue but then fail on another. I'm not seeing any patterns as to specific files failing over and over again, it looks like its completely random.
I thought it might be network related so i ran wireshark to verify if the outbound httpd request goes through and it does.. Also, if i cancel that specific file the next few files go through without issue and since they are all retrieving from the same web server i don't believe its network related.
I'm not sure where to look to get this resolved, can i enable any additional logging?
I can post the script if necessary
Thanks in advance
T.Slappy
20th May 2013 12:20 UTC
Is there any safe way how to detect the source of the problem when downloading file fails (inetc::get) ?
Sometimes I am getting ERR_SENDREQUEST which is "SendRequest Error" but I cannot found the problem.
Here is code:
boolqueryStatus
(HINTERNEThFile)
{
TCHARbuf***91;256***93;=_T("");
DWORDrslt;
if(HttpQueryInfo(hFile,HTTP_QUERY_STATUS_CODE,
buf,&(rslt=sizeof(buf)),NULL))
{
buf***91;3***93;=0;
if(lstrcmp(buf,_T("0"))==0||*buf==0)<<<Theresultcodeiszero(0)-butwhy???
status=ERR_SENDREQUEST;
tom_q
1st August 2013 09:59 UTC
Hi,
I'm trying to use inetc to download files. I allow users to cancel the download, and to try to download the file a second time. I use the following code:
Function OnDownloadPageClose
Push $0
;Download the file
inetc::get /BANNER "Download in progress." \
/CAPTION "Downloading..." \
"http://www.myuri.com/myfile.txt" \
"$DownloadDirectory\myfile.txt" \
/END
Pop $0
${If} $0 == "OK"
ExecWait "$DownloadDirectory\myfile.txt -d$\"$DownloadDirectory$\" -s"
Delete "$DownloadDirectory\myfile.txt"
${Else} ;an error occured
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"The file could not be downloaded. This may be due to a faulty \
Internet connection. Click 'Yes' to try again, or click 'No' to finish installation \
without downloading the optional files." \
IDNO exit
Delete "$DownloadDirectory\myfile.txt" ; !! THIS DOES NOT WORK
Pop $0
Abort ; do not go to the next installer page, so the user can try again.
${EndIf}
exit:
Pop $0
FunctionEnd
This does not work, most likely because when the download is interrupted by the user (closing the download pop-up) the half-downloaded-file cannot be deleted. It is also impossible to delete the file manually for as long as the installer is running ("Another program is using this file").
Edit: I get the same issue in other modes (besides banner mode) when clicking the cancel button. It seems like cancelled downloads are not properly handled -- the downloaded files are never closed. Then again it might just be that I have forgotten some essential operation.
aerDNA
1st August 2013 14:42 UTC
inetc automatically deletes the file on dl cancel; why it doesn't in your case, it's hard to say. Does the problem persist with some other file from a different server? Try using Unlocker to see if some 3rd party sw is hijacking the file. If you can't resolve the problem, a workaround can be to use GetTempFileName for the destination, then move the completed dl to target dir.
- NSIS Discussion
- http + ftp download plug-in
Archive: http + ftp download plug-in
CritterNYC
20th August 2013 05:32 UTC
Originally posted by negativesir
Yes, this has to do with WM_INITDIALOG not returning false.
From MSDN:
Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Thanks, negativesir. I've verified that this fixes the issue with stealing focus and otherwise works unaltered. I wasn't sure if you'd compiled as release or debug back when you'd submitted this, so I recompiled it using a clean VC++6 under a clean Windows XP of release builds of both ANSI and Unicode just to be sure. It's now been updated on the inetc plugin download page.
CritterNYC
20th August 2013 05:36 UTC
Originally posted by negativesir
Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Thanks, negativesir! I've verified that this fixes the issues with stealing focus when in silent mode and does not affect other functionality. (for the curious an Abort was switched to return false where appropriate). I wasn't sure if you'd compiled as release or debug last year, so I recompiled using a clean VC++6 install on a clean Windows XP VM of the release config of both ANSI and Unicode. I've packaged it and updated the default download on the inetc plugins page.