Menu

syswin-httpget

FKorning
Attachments

httpget.exe

@module:     httpget.exe
@project:    Manufacture.net - SysWin utilities (syswin.manufacture.net)
@author:     Francis Korning (fkorning@yahoo.ca)
@rigths:     (c) 2014 Francis Korning (manufacture.net)
@license:    Lesser GNU Public License (LGPL)

The httpget utility (aka wget, HttpRequest, HttpGetRequest) allows to fetch
text or binary files from a url via http get requests using the current NTLM
credentials.

This is a very rudimentary utility and is not meant to replace cygwin's wget.
It does https, but it doesn't handle redirects, formwards, or multipart types.
It is thus mainly provided to be able to retrieve software before cygwin wget.
This way we can programatically and transparently download cygwin installers
(cyg-setup-x86.exe) in order to configure our manufacture syswin platform.

httpget works in one of 2 two MIME content-type modes depending on mime type:

 mode    content-types                           example
 ----    -------------                           --------
 text    text|message                            text/plain
 binary  application|image|audio|video|model     application/octet-stream

parameters

usage: httpget.exe [options]
options:
             -h --help /help:  this usage and options help message (/?)
               -u --url /url:  url of file to be downloaded (http/https)
               -d --dir /dir:  directory in which to save downloaded file
             -f --file /file:  filename to save file (default: index.htm)
             -t --type /type:  mime content-type (text|application|image|audio|video)
             -w --winx /winx:  force WINx CRLF line separator (\r\n) for text file types 
             -x --unix /unix:  force UNIX LF line separator (\n) for text file types
             -i --time /time:  timeout for download (seconds)

logic

parse args

create request:

 create http request

 - set NTLM credentials
 - set proxy parameters

connect to url:

  check headers:

  - status
  - content-type
  - content-length

determine mode: 

 text-mode:

  - check content-type
  - read text stream
  - save to text file

 mime-mode:

  - check content-type
  - read data stream
  - save to data file

examples

  • download cygwin setup executable binary file
     httpget --dir tmp --url https://www.cygwin.com/setup-x86.exe --type application/octet-stream --file cyg-setup-x86.exe
[[img src=httpget_cyg-setup-x86.exe.png]]
  • download sysinternals binary zip file
    httpget /dir tmp /url http://download.sysinternals.com/files/SysinternalsSuite.zip /type application /file sys-internals.zip
[[img src=httpget_sys-internals.zip.png]]

todo

 -H/HttpProxy <Host:Port>
 -U/ProxyUser -P/ProxyPass
 -a/useragent, -c/charset, -e/encoding

screenshots


Related

Wiki: syswin

MongoDB Logo MongoDB