r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Cheyenne] Discussions about the Cheyenne Web Server

Graham
3-Oct-2008
[2898x3]
I want to allow download of the faxes.  I made the file  names links

<a href=showfax.rsp?fax000000.tif>fax000000.tif</a>

and showfax.rsp is 

<%
recvqdir: %/var/spool/hylafax/recvq/
file: dehex request/content/filename

switch suffix? file [
	%.tif [ response/set-header 'Content-type "image/tiff" ]
	%.pdf [ response/set-header 'Content-type "application/pdf" ]
]
response/buffer: read/binary join recvqdir file file
%>

but when the file downloads,it is called showfax.rsp ...
Anyone know how to set the name of the file being downloaded?
<a href=showfax.rsp?file=fax000000.tif>fax000000.tif</a>
Dockimbel
3-Oct-2008
[2901]
I guess that you need to add this : response/set-header 'Content-disposition 
"attachment; filename=fax000000.tif"
Terry
3-Oct-2008
[2902]
Hey Doc, Im using the embed version of Cheyenne, but I can't grab 
any files for downloading.. the dialog box opens, but the content 
is empty.. with this error in the console.. 
target: rockstar.rar

## Error in [uniserve] : On-received call failed with error: make 
object! [
    code: 312
    type: 'script
    id: 'cannot-use
    arg1: 'path
    arg2: 'none!
    arg3: none
    near: [either req/file-info/size > 16384 [
            req/out/content: req/in/file
        ]]
    where: 'handler
] !

Any ideas?
Graham
3-Oct-2008
[2903]
Thanks ... I'll try that out tomorrow.
Gabriele
3-Oct-2008
[2904]
Graham: content-disposition should work, but there may be browsers 
or other clients that ignore it. there is a trick that should always 
work though, but i don't know if Cheyenne supports it: use a url 
like this: showfax.rsp/fax000000.tif?otherargs - you probably won't 
need to put the file name after the ? because most servers (and i 
assume Cheyenne, if this is supported) give you access to the actual 
request path.
Graham
3-Oct-2008
[2905]
I can try it .... but I suspect I'll get  a 404
Terry
3-Oct-2008
[2906x3]
Doc, regarding the issue above, I'm not getting the error now, but 
the content is still corrupted? ie: if I read/binary a .zip file, 
set the header to application/x-zip-compressed, the browser is recognizing 
the file size, but the file itself is corrupted? Happens with all 
binary files.
Do you have an example i can use in the embed-demo.r file that returns 
a binary?
nvm.. the response was sending back a subsequent rebol error.
Graham
3-Oct-2008
[2909]
Content-disposition worked fine! :)
Terry
3-Oct-2008
[2910]
What's the best way to make the params using embed global so I can 
pass them on to subsequent functions?
Dockimbel
4-Oct-2008
[2911]
I don't understand the  "params using embed" part of your question.
Terry
4-Oct-2008
[2912x2]
yeah..  missing a comma.. 

What I meant was.. I'm using embed, and I want to pass the params 
object to other, non-cheyenne functions that I DO from the /default 
function
Scope issue (my Rebol is rusty)... what I did was copy the content 
->  qstr: make object! decode-cgi to-string req/in/content
and make my own object . Im guessing this is not ideal
Dockimbel
4-Oct-2008
[2914]
I still don't understand where's your issue...What's wrong with :

your-function: func [obj][
	;-- do whatever you want here with 'obj
]

publish-site [
	default: func [req params svc][
		your-function req
	]
	...
]
Terry
4-Oct-2008
[2915x2]
I've strayed from the path a bit.. I only have one function.. default.. 
then manage everything from there
but I see what you mean...   can the  [req params svc] args be accessed 
outside of the publish-site function?
Dockimbel
4-Oct-2008
[2917]
Terry, that's local arguments passed to callback function. If you 
need to access them from global space, just set a global word to 
arguments value. Did you forgot how to program in REBOL ?
Terry
4-Oct-2008
[2918x2]
here's my default function.. 

  default: func [req params svc][
    raw-input: trim req/in/target
	if raw-input = ""[raw-input: "index.html"]
	qstr: make object! decode-cgi to-string req/in/content 
	bout: copy ""
	requesttype: "http"
	commander
	bout		 		
  ]
]

I want to pass the params to the commander function
Yeah.. I forgot .
Dockimbel
4-Oct-2008
[2920x2]
commander params
where's the issue ?
Terry
4-Oct-2008
[2922x2]
Oops.. I went commander[params]
hilarious
Dockimbel
4-Oct-2008
[2924]
Read http://www.rebol.com/docs/core23/rebolcore.htmlbefore posting 
here again! ;-)
Terry
4-Oct-2008
[2925]
What I need is a PHP lobotomy
Dockimbel
4-Oct-2008
[2926]
PHP is bad, look at what it did to you :-)
Terry
4-Oct-2008
[2927]
I feel so dirty. *sob*
Graham
5-Oct-2008
[2928x3]
I've wrapped up the latest Cheyenne source code, binary and my web 
to fax gateway in on file
one file .. see http://rebol.wik.is/Hylafax
It's a little rough .. but it works.  Needs some graphical enhancements.
Dockimbel
5-Oct-2008
[2931]
Nice work.
Terry
5-Oct-2008
[2932]
How about making it a Rockstar module?
Graham
5-Oct-2008
[2933]
doc, your website has 0.9.18 but I seem to have 0.9.19 ...
Dockimbel
5-Oct-2008
[2934x2]
0.9.19 has been officially released yet.
has => hasn't
Graham
5-Oct-2008
[2936]
oops
Dockimbel
5-Oct-2008
[2937]
Graham, that's not a problem.
Graham
5-Oct-2008
[2938]
whew
Dockimbel
5-Oct-2008
[2939]
I've released it as beta and posted the download link here, so main 
Cheyenne's users already have it.
Terry
7-Oct-2008
[2940]
Nenad, if I run Cheyenne, then do something like this... (on a newer 
XP box)

a: 1000
while [a > 0][read http://mydomain.com/a: a - 1]


It blazes along fine.. but gets about half way.. then just stalls.. 
waiting.. then further results will just trickle in.. stall.. a few 
more .. etc

Why?

Memory and CPU are hardly touched?
Oldes
7-Oct-2008
[2941x3]
some security limiter of XP to prevent DoS attacks?
check your system event log
http://www.mydigitallife.info/2005/11/15/windows-xp-sp2-tcp-connection-limit-event-id-4226/
Terry
7-Oct-2008
[2944x2]
I was thinking it may be the ISP throttling to prevent DoS ?
but it's from the same box.
Dockimbel
7-Oct-2008
[2946]
It's not a concurrency issue, READ is blocking, so just one connection 
at a time. I run the same test here (XP-SP3) several times, no problem. 
AFAIR, the same test was running just fine on SP2.
Terry
7-Oct-2008
[2947]
why would my READ block, and not yours?