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
30-Sep-2008
[2837x2]
are you saying that you have seen this problem?
If that is the case, it must be the windows calls
Dockimbel
30-Sep-2008
[2839]
I don't have Vista installed, so can't test. I guess that's probably 
an issue with one of the win32 API functions used by Cheyenne on 
startup. Did you tested on Vista 32-bit or Vista 64-bit ?
Graham
30-Sep-2008
[2840x4]
32 bit
I see instances of Rebol start up, and the port 80 is opened.
but no response
3 instances
Henrik
30-Sep-2008
[2844]
I wonder if Vista shuts off ports below 1024 for non-administrator 
users?
Graham
30-Sep-2008
[2845x2]
I added rebcmd to the firewall exceptions
ok, where does one change the port ?
Henrik
30-Sep-2008
[2847]
It may not have something to do with the firewall. Linux does this 
even without firewalls.
Graham
30-Sep-2008
[2848]
listen [ 80 ]
Henrik
30-Sep-2008
[2849]
in httpd.cfg
Graham
30-Sep-2008
[2850x2]
Yes, works on 8080
interesting.
Henrik
30-Sep-2008
[2852]
Then they have probably adopted that feature. Nice to know.
Graham
30-Sep-2008
[2853]
1024 is good too.
Henrik
30-Sep-2008
[2854]
What about 1023? :-)
Graham
30-Sep-2008
[2855x4]
let me test 81
Hmm.  Index appears on 81 but scripts don't work.
ok, 1024 scripts don't work either
just the home page appears
Henrik
30-Sep-2008
[2859]
But scripts work on 8080? Are you testing on the local machine or 
via network?
Graham
30-Sep-2008
[2860x7]
localhost
yes, scripts work on 8080
A question about post/put

Here's my little test file

<html><title> RSP PUT test </title>
<%= request/posted
%>
</html>
When I do this with the modified http protocol


page: read/custom http://localhost:8080/put.rsp [ PUT %rebview.exe 
]

I get this

<html><title> RSP PUT test </title>
file=%/D/che19/Cheyenne/incoming/zmmnfoto.tmp

</html>
but there is nothing in the incoming directory.
So, how do I access the file I sent with my PUT ?
I'm not at all clear on how to support a  REST call
Say, I have something like this

POST /@api/deki/pages/=patients%252F300/contents HTTP/1.0


how would i process that so the correct rsp page deals with the request?
Dockimbel
30-Sep-2008
[2867x2]
PUT file : the tmp file is deleted once the HTTP response is sent 
back to client. If you want to keep the file, you need to either 
rename it (with its original name) or move it elsewhere.
It's a security feature to avoid saturating server's disk with unwanted 
files.
Graham
30-Sep-2008
[2869x2]
Ok, got it.
And my REST question?
Dockimbel
30-Sep-2008
[2871x9]
First you should avoid URI starting with /@ unless you've disabled 
mod-internal module.
Then if you want to process URI that do not map directly to the filesystem, 
you can either use ALIAS (untested) : ALIAS "/" %rest-dispatcher.rsp
(requires Cheyenne v0.9.19)
if you're doing that, you should define a dedicated virtual domain.
Other option (more powerful, but more complex), write a specific 
mod-rest module and if required, a background task handler. Not easy 
to do but could be done by copy/pasting code from mod-action/CGI 
or  mod-rsp/RSP and adapting to your needs.
OTOH, you could also make a more simpler mod-rest acting as a REST 
wrapper and just rewriting the URL to point to a simple ressource 
(CGI or RSP) and saving the REST url inside a custom HTTP header. 
That way, you could easily redirect a REST call to a RSP dispatcher. 
If you go that way, I would recommend to write a module with a single 
callback early in the Cheyenne's request processing pipeline.
Here's an untested skeleton code for such a mod-rest :
REBOL [ ]

install-HTTPd-extension [
	name: 'mod-rest
	
	order: [
		url-translate	first
	]
	
	parse-REST: func [url /local new][
		...
		do the REST url to RSP url conversion here
		...
		new
	]
	
	url-translate: func [req /local new][
		if not find/part req/in/url "/@" 2 [return none]
		
		;-- save URL in a custom header 
		h-store req/in/headers 'REST-url req/in/url
		
		;-- rewrite URL
		new: parse-REST req/in/url
		
		;-- refresh the req/in objet content
		service/parse-request-line/short new req/in
		
		true
	]
]
Don't forget also to add the REST module name to the MODULES section 
in %httpd.cfg file.
Graham
30-Sep-2008
[2880x6]
thanks.
I see that request/posted either contains a filename, or, binary 
data depending on the size of the binary data.
I was looking for a web to fax gateway last night and found one that 
was about 10Mb using ruby on rails and a REST interface.  Instructions 
were in English but it looked like I had to be conversant with ROR 
to configure it!
Here's my one page web to fax gateway for Hylafax http://www.compkarori.co.nz/showpost.php?p=36&postcount=14
 :)
Ok, I admit it doesn't do any of the other stuff that the RoR one 
does, as all it does is just send a fax.
and to send the fax from REBOL is just


response: read/custom url?faxno=113432423&recipient=Joe Bloggs&extension=.pdf 
[ PUT %mypdffax.pdf ]
Kaj
1-Oct-2008
[2886]
Good old Hylafax :-)