Rob van der Heij wrote:
On Mon, Apr 21, 2008 at 7:46 PM, Rob van der Heij <[EMAIL PROTECTED]> wrote:

 It can certainly be done with CMS Pipelines. My wget is very stable.
 Show us your problematic code.

Did not mean to keep a secret: http://www.rvdheij.nl/download/wget.vma

Thanks.  It's small enough that I was able to grab it using
my "problematic code".  Hmmm.  Seems to be some sort of archive.
What's ".vma"?  What has magic number ":CFF"?

Here's my problematic code.  I tried to obscure local
server names.  That merely means I don't trust our firewall.

Thanks again,
gil



/* REXX geturl_2Erexx Wed Mar 26 09:08:22 MDT 2008 */ signal on novalue;
parse value '%full_name: 1/ascii/geturl_2Erexx.Rexx/0.95 %' ,
     with . '%' 'full_name:' full_name . ' %' .

/* Usage:

   PIPE GETURL [ URL ] | stage

If a secondary output stream is connected, the URL headers will be
written to that stream.  Otherwise the headers will be written to
the console.

Examples:

   PIPE GETURL http://xxxxxxxxxxxxxxxxxxxx/getmcs.cgi?L1H086R.mcs | console

   Null = '00'x
   'PIPE (ENDCHAR' Null')' ,
       'a: GETURL | xlate a2e | CONSOLE' Null ,
       'a: | > GETURL $HEAD$ A | CONSOLE'
*/
'streamstate output 0'
if RC<0 | RC>8 then do
    say 'Output stream 0 not connected'
    exit(RC);  end

/* If secondary output stream is not connected, translate headers to EBCDIC
   and display on console.
*/
trace Off
'streamstate output 1'
trace Err
Xlate = 'xlate a2e'
if RC<0 | RC>8 then do
    'addstream output'
    'addpipe *.output.1: |' Xlate '| console';  end

parse arg URL .

/* Initialize control information                                     */
if word(URL ., 1)=='.' then
    URL = 'http://xxxxxxxxxxxxxxxxxxxxxx/getmcs.cgi?L1E022T.EXPR,EXPR410_1'

parse value URL with Scheme '://' Host '/' +0 Path
parse value Host ':80' with Host . ':' port .
parse value Host with . '.' +0 T1 +1
if T1<>'.' then Host = Host'.xxxxxxx.com'
if Scheme=='http' & right(Host,12)=='.xxxxxxx.com' & ,
        right('.'Host,18)<>'.xxxxxxxxxxxxx.com' then do
    Server = Host
end;  else do
    parse value 'yyyyyyyyy:80' with Server ':' port
    Path = URL;  end

address 'CMS' 'ESTATE TCPIP DATA *'
if RC=28 then address 'COMMAND' 'EXEC TCPLINK'

'addstream both TCP'
'addpipe *.output.TCP: | xlate e2a |' ,
    'tcpclient' Server port '|' ,
    '*.input.TCP:'
if RC<>0 then return(RC)
'select output TCP'

/* Initialize for receiving lines sent by the server                  */
s = right(URL,10)
call Write 'GET' Path 'HTTP/1.0'||'0D25'x
call Write 'Host:' Host'0D25'x
call Write 'User-Agent:' full_name'0D25'x
call Write 'Pragma: no-cache'||'0D25'x
call Write 'Cache-Control: no-cache'||'0D25'x
call Write '0D25'x

/* Wait for lines sent by the server                                  */
dataline = ''
Num = 1
'select input TCP'
'select output 1'
do Buffers = 1

  /* Receive a line and display it                                    */
  'readto newline'
  if RC==12 then leave Buffers
  len = length(newline)
  dataline = dataline || newline
  do Num = Num
    if pos('0A'x,dataline)=0 then leave Num
    parse var dataline nextline '0A'x dataline
    nextline = strip(nextline, 'T', '0D'x)
    'output' nextline
    'callpipe var nextline |' Xlate '| var nextline'
    if nextline=='' then leave Buffers
    if Num==1 then parse value nextline with . MimeRC . 1 MimeStat ''
  end
end Buffers
RcvRC = 59

Count = 0
LCount = ''
if value('MimeRC')<>200 then do
    say 'GETURL: Error from HTTP:' value('MimeStat')
end;  else do Body = 1
  RC = PutBody()
  if RC<>0 then leave body
  /* Receive a line and display it                                    */
  'readto dataline'
  if RC==12 then leave Body
  len = length(dataline)
end Body
'sever output'
say s Count 'chars received' time() 'Done'

/* Terminate and exit                                                 */
exit(RcvRC)

PutBody:
    if dataline=='' then return(0)
    if MimeRC==200 & Symbol('Plumb')=='LIT' then do
        RcvRC = 0
        'sever output'
        'select output 0'
        Plumb = 1;  end
    'output' dataline
    if RC<>0 then
        say 'GETURL: Error writing output connector.'
    Count = right(Count + length(dataline), 10)
    if left(Count,5)>>LCount then do
        say s Count 'chars received' time()
        LCount = left(Count,5);  end
    return(RC)

/* Write and log.                       */
Write:
    SocL = sigl
    say s 'Writing:' arg(1)
    'output' arg(1)
    return( 0 )

Reply via email to