Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: POST examples ...

From: petr:krenzelok:trz:cz at: 4-Jun-2001 15:28

GS Jones wrote:
> From: "Petr Krenzelok" > > OK, thanks for the tip. I made it - it works. I just had to remove > > enclosing "" for each parameter and take care of hidden newlines ... > > > > Now its easy to download the stuff using read/custom url [post > > {string-here}] > > Good. > > Of course, later I realized that a single 'to-url could have more easily > been placed before 'rejoin. In other words, instead of: > > 'post rejoin [{name=} to-url name {&address=} to-url address] > > use: > > 'post to-url rejoin [{name=} name {&address=} address]
I use more general aproach :-) Website source contains following string: #T1107_0003*MVS*DOWNLOAD**MZ7090S.TRA*P$PZ.MZ7090S.R$31007.CNTL**ASCII**MVS*NO*NO ... it contains some 22 or more such strings, each for one file .... I defined post-object: post-obj: context [ function: "TRASO_ACTION" ACTION_TYPE: "DOWNLOAD" FILE_DEF: FILE_TYPE: FTP_CODE_PAGE: ZIP: PC_FILE_NAME: SERVER_FILE_NAME: TARGET_SERVER: WHAT: "DOWNLOAD" ] I thought I will kill someone for putting "function" into website in lowercase. I spent nearly one hour figuring out what is the problem .... ... then I fill in object using above mentioned definition string: fill-post-obj: func [def-str [string!]][ tmp: parse def-str "*" post-obj/FILE_DEF: tmp/1 post-obj/TARGET_SERVER: tmp/2 post-obj/FILE_TYPE: tmp/3 post-obj/FTP_CODE_PAGE: tmp/8 post-obj/ZIP: tmp/11 post-obj/PC_FILE_NAME: tmp/5 post-obj/SERVER_FILE_NAME: tmp/6 ] and now let's produce post string from object definition. Look how powerfull Rebol is for series handling :-) post-obj-str: does [ str: copy "" foreach [word] next first post-obj [append str join "&" [word "=" get in post-obj word]] remove at str 1 ; remove first "&" at string ... return str ] and then: file-string: read/custom hostc-downloads reduce ['POST post-obj-str] ... one problem which bothers me is - I can't know the size of file :-) You know - it's all MVC (CICS3270 file :-)), you can know only some block-size, but it will not help you ... bloody historical things :-)
> I have no way to exactly duplicate your conditions, but I simulated a > situation where I wanted to skip the first 800k of a 1600k file, then > download in 1k chunks and the following worked for me. > > from-port: open/direct ftp://user:[pass--www--mydom--dom]/logs/my-access-log >
yes, but I am not using ftp. I am using http post method, so I don't know if such aproach is even possible ... One crazy thought: would it be possible to use http port 'awake field for calling the fucntion, which would count current buffer size and could update the progress bar? ... once you use read/part/custom .... /part refinement seems to be ignored .... the same will go for /skip imo .... So - there seems to be no simple solution. Probably the only one way is to use 'open and construct all http headers myself, but that's something I have no experience with yet ... -pekr-