World: r3wp
[!Cheyenne] Discussions about the Cheyenne Web Server
older newer | first last |
Terry 11-Nov-2009 [6440] | Hey Doc, any hints / docs on building a Uniserve service that could handle what I need? |
Dockimbel 11-Nov-2009 [6441x2] | UniServe API documentation : http://www.softinnov.org/rebol/uni-guide.html HTTP async client implementation : http://www.softinnov.org/tmp/HTTP-client.zip |
From what I've understood of your need, you should look into the "Protocol API" part (and not the "Service API" part). | |
Terry 12-Nov-2009 [6443x4] | k, thanks. |
Hmm, i think i did this some time ago.. pre Cheyenne days. | |
I remember googling a coding problem one time, and found a solution.. thought to myself.. "this guy knows the situatioh".. only to realize i was my own code i had posted some years earlier. ;() | |
So /Service acts as a receiving port vs connecting to a port via /Protocol | |
Dockimbel 12-Nov-2009 [6447] | Yes. /Protocol = client side. |
Terry 12-Nov-2009 [6448x3] | I just can't seem to speak to this remote port with Rebol or Uniserve no matter what i try |
This PHP code works fine.. <?php $password = "ClueCon"; $port = "8021"; $host = "127.0.0.1"; function event_socket_create($host, $port, $password) { $fp = fsockopen($host, $port, $errno, $errdesc) or die("Connection to $host failed"); socket_set_blocking($fp,false); if ($fp) { while (!feof($fp)) { $buffer = fgets($fp, 1024); usleep(100); //allow time for reponse if (trim($buffer) == "Content-Type: auth/request") { fputs($fp, "auth $password\n\n"); break; } } return $fp; } else { return false; } } function event_socket_request($fp, $cmd) { if ($fp) { fputs($fp, $cmd."\n\n"); usleep(100); //allow time for reponse $response = ""; $i = 0; $contentlength = 0; while (!feof($fp)) { $buffer = fgets($fp, 4096); if ($contentlength > 0) { $response .= $buffer."<br>"; } if ($contentlength == 0) { //if contentlenght is already don't process again if (strlen(trim($buffer)) > 0) { //run only if buffer has content $temparray = split(":", trim($buffer)); if ($temparray[0] == "Content-Length") { $contentlength = trim($temparray[1]); } } } usleep(100); //allow time for reponse //optional because of script timeout //don't let while loop become endless if ($i > 10000) { break; } if ($contentlength > 0) { //is contentlength set //stop reading if all content has been read. if (strlen($response) >= $contentlength) { break; } } $i++; } return $response; } else { echo "no handle"; } } $fp = event_socket_create($host, $port, $password); $cmd = "api show dialplan"; $response = event_socket_request($fp, $cmd); echo $response; fclose($fp); | |
I can open a port, and get the authentication challenge.. i iget a content-type: auth/request.. .when i insert into the port "auth Cluecon \n\n" i get no reply.. just times out with a timeout error? | |
Will 20-Nov-2009 [6451] | nice http://pushmodule.slact.net/ |
Kaj 20-Nov-2009 [6452] | Very nice indeed |
Janko 24-Nov-2009 [6453] | set-cookie docs don't exist and it says n/a .. does this mean the word is not there any more or something else? Do I have to manually set http response headers to set cookies? |
Dockimbel 24-Nov-2009 [6454x2] | Set-cookie is on the todo list but hasn't been implemented yet. So, for now, you have to set http header manually. |
IIRC, there's some code for setting cookies in the rebol.org library. | |
Janko 24-Nov-2009 [6456x3] | aha, no problem .. how can I read the cookies .. looking at request headers I guess (I forgot a little about how exactly cookies are doing) |
doing = work | |
aha I remember :) | |
Dockimbel 24-Nov-2009 [6459] | request/headers/cookie |
Janko 24-Nov-2009 [6460x3] | aha, you already parse it .. cool |
I am creating an simple affiliate system for cebelca.biz , but it will be made so you can reuse it on any page without installing aff system on server | |
so if anyone needs it, tell me | |
Terry 26-Nov-2009 [6463x2] | I'm coming to the conclusion that any communication other than via HTTP is a waste of time. Sockets suck. |
I mean, this low level coding is a pain. | |
Robert 26-Nov-2009 [6465x2] | IMO HTTP sucks. Since years people try to make stateless HTPP stateful. One just needs a simple socket and than handle everything via a multiplexed channel system through this. |
And, with some tricks everything can be tunneled through port 80 ;-) See Skype. | |
Henrik 26-Nov-2009 [6467] | Well, HTTP works ok as long as you treat it like what it is: Stateless. |
Janko 1-Dec-2009 [6468] | I am trying to use the set-locale locales-dir .. but I wasn't able to get it work |
Dockimbel 1-Dec-2009 [6469] | Here's the configuration I'm using for CureCode.org : webapp [ virtual-root "/rebol3/" root-dir %/home/curecode.org/rebol3/ locales-dir %private/locales/ ] %private is located under %rebol3/ |
Janko 1-Dec-2009 [6470] | aha, thanks :) I will try that way |
Dockimbel 2-Dec-2009 [6471] | Btw, %private/ folder under a webapp folder is a *special* folder that's protected from direct access (you'll get 404 if you try), so you can safely store there your libs and support code. |
Janko 2-Dec-2009 [6472] | aha, good to know |
Endo 15-Dec-2009 [6473] | hi, I have a problem about sessions, when I start a session, then end it, then restart it, session/active? return false if the file is not in same location with the file which is started the session. |
Dockimbel 15-Dec-2009 [6474] | Which Cheyenne version are you using? Have you tried with the development version from SVN repository? |
Endo 15-Dec-2009 [6475x3] | 2.7.6.3 |
on windows/xp home & pro | |
I did not try the SVN version. | |
Dockimbel 15-Dec-2009 [6478] | 2.7.6.3 is the REBOL version. Cheyenne versions are the ones listed here : http://cheyenne-server.org/download.shtml So, I guess you're probably using v0.9.19. Could you make small RSP scripts that exhibit this issue and send them to me by email? |
Endo 15-Dec-2009 [6479x2] | oh sorry, yes I'm using the 0.9.19, I guess the problem is about subfolders |
I'm preparing the scripts now.. | |
Dockimbel 15-Dec-2009 [6481x2] | Thanks. |
I remember a similar issue reported once by a user a few months ago. I'm not sure this has been fixed properly or if your issue is exactly the same. Anyway with the help of your test scripts, I should be able to figure it out. | |
Endo 15-Dec-2009 [6483x2] | I just send the test files by email |
Please try the test cases I wrote in the email, session/active? gives 2 different result after restarted a session, if the files are different folders | |
Dockimbel 15-Dec-2009 [6485] | Got it, will give it a quick look now. |
Endo 15-Dec-2009 [6486] | thanks a lot |
Terry 15-Dec-2009 [6487] | Websockets... now we're cookin' http://mylittlehacks.appspot.com/phpwebsocket |
Dockimbel 15-Dec-2009 [6488] | The test cases run OK here with the development version (on SVN), which means that the issue has been already fixed. Now trying with 0.9.19 to be sure. |
Endo 15-Dec-2009 [6489] | can I download the SVN version (where?) so I can test it here too |
older newer | first last |