#156 NSISdl http/1.1 support and improvements

open
Amir Szekely
Plugin (47)
5
2007-09-05
2007-08-19
Che Rivera
No

Changes:

NSISdl.cpp:
-download function now attempts to resume a failed download. If /RETRIES= is omitted in the install script, download() functions exactly as before.
-arguments to the download function are now order independent. (!!)
-translations can now include most error, resume, and connecting strings.

httpget.cpp:
-now accepts response 206 Partial Content.

ReadMe.txt:
-updated to reflect above changes.

NOTES:
While the "Range:" header is from HTTP/1.1 the servers I have tested this on response correctly with "206 Partial Contents" and don't chunk the data. It works, the only thing remaining unimplemented for full HTTP/1.1 compatibility is chunked transfer encodings. Thats the next phase.

I would like to test this on some other less common servers. IIS and Apache seem to respond to a HTTP/1.0 request with a "Range:" header correctly.

Discussion

1 2 > >> (Page 1 of 2)
  • Amir Szekely
    Amir Szekely
    2007-08-25

    Logged In: YES
    user_id=584402
    Originator: NO

    Thanks, I'll have a look after 2.30.

     
  • Che Rivera
    Che Rivera
    2007-08-31

    • summary: NSISdl various changes --> NSISdl http/1.1 support and improvements
     
  • Che Rivera
    Che Rivera
    2007-08-31

    Logged In: YES
    user_id=1817904
    Originator: YES

    File Added: nsisdl_patch.diff

     
  • Che Rivera
    Che Rivera
    2007-08-31

    Logged In: YES
    user_id=1817904
    Originator: YES

    Changes in Latest Patch:
    -All .cpp and .h files received the same header comment layout and changed erroneous license file reference to license.txt.

    NSISdl.cpp
    -download function now able to do file-based resumes with /RESUME.
    -download function will not delete the target file if /NODELETE is specified.
    -accepts /FILESIZE= allows the script to specify filesize (content-length header no longer required)

    httpget.cpp
    -now checks for "Transfers-Encoding: chunked" and dechunks properly
    -correctly skips "100 Continue" headers
    -sends "Connection: close" during request

    connection.cpp
    -new function recv_lineb() functions like recv_line() but returns bytes read instead of a flag

    util.cpp
    -new function myatoi64h() takes a number in acsii hex and converts it to a 64-bit integer

    NOTES:
    Obviously /RESUME and /NODELETE are meant to be used together.

    Example script snippet:

    !define DL_FILE_URL "http://www.someserver.com/file"
    !define DL_FILE_SIZE 11213948

    ; We check to see if the download temp file exists
    ; if it does we check to see if it is the right filesize
    ; if it is the right file size we go to unpacking
    ; otherwise we open a message box to ask for resume permission
    ; if the file doesn't exist we download as normal
    IfFileExists $1 +1 DoesntExist
    Push $1
    Call FileSizeNew ; FROM WIKI
    Pop $2
    IntCmp $2 ${DL_FILE_SIZE} Success
    MessageBox MB_YESNO "The file $1 already exists.$\nDo you want to resume the download?" /SD IDYES IDYES ResumeDL IDNO DoesntExist
    ResumeDL:
    NSISdl::download /TIMEOUT=25000 /NODELETE /RESUME /RETRIES=8 /FILESIZE=${DL_FILE_SIZE} ${DL_FILE_URL} "$1"
    Goto Done
    DoesntExist:
    NSISdl::download /TIMEOUT=25000 /NODELETE /RETRIES=8 /FILESIZE=${DL_FILE_SIZE} ${DL_FILE_URL} "$1"
    Done:
    Pop $R0 ;Get the return value

    StrCmp $R0 "success" Success
    MessageBox MB_OK "Download failed: $R0"
    Quit
    Success:

     
  • Che Rivera
    Che Rivera
    2007-08-31

    Logged In: YES
    user_id=1817904
    Originator: YES

    File Added: nsisdl_patch.diff

     
  • Che Rivera
    Che Rivera
    2007-08-31

    Fixed a few errors in readme.txt

     
    Attachments
  • Che Rivera
    Che Rivera
    2007-09-05

    • assigned_to: nobody --> kichik
     
  • Che Rivera
    Che Rivera
    2007-09-10

    Downloader Skeleton (or nsisdl2 test)

     
    Attachments
  • Che Rivera
    Che Rivera
    2007-09-10

    Logged In: YES
    user_id=1817904
    Originator: YES

    File Added: nsisdl2_example.nsi

     
  • Che Rivera
    Che Rivera
    2007-09-16

    Logged In: YES
    user_id=1817904
    Originator: YES

    File Added: nsisdl2_patch.diff

     
1 2 > >> (Page 1 of 2)