World: r3wp
[Core] Discuss core issues
older newer | first last |
Brock 3-Sep-2008 [10895] | I'll have to look at it as I don't think the versions up there have what I am looking for. |
Pekr 3-Sep-2008 [10896] | Can I have something like following? My friend asked me to do small "multiserver" in TCP mode, he is testing his HW device. IT works like a charm, but it is only console app (no GUI). Last week he asked me for another method of interruption of script - when he presses ESC (or closes console), the connection is RSTed, but he would like clean FIN, ACK. So - can I somehow trap keyboard press while in the wait loop? Or do I need to rewrite script to GUI version? I thought about adding console port to the wait block, but dunno if it would work :-) |
Anton 3-Sep-2008 [10897] | Probably you can. Try this, from Carl Sassenrath 2002: http://anton.wildit.net.au/rebol/os/system-port-trap-example.r |
Pekr 3-Sep-2008 [10898] | thanks ... |
Alan 14-Sep-2008 [10899] | . |
Graham 19-Sep-2008 [10900x7] | Read/custom allows you to send a custom header as in a cookie header like this read/custom url [post "postdata" [Cookie: "name=value"]] |
but it doesn't allow you to send a custom header except by using the post method. | |
This is the code in the prot-http.r if all [block? port/state/custom post-data: find port/state/custom 'post post-data/2] [ http-command: "POST" HTTP-Get-Header: make HTTP-Get-Header append [ Referer: either find port/url #"?" [head clear find copy port/url #"?"] [port/url] Content-Type: "application/x-www-form-urlencoded" Content-Length: length? post-data/2 ] either block? post-data/3 [post-data/3] [[]] post-data: post-data/2 ] | |
Now if we hack it like this either all [block? port/state/custom post-data: find port/state/custom 'post post-data/2] [ http-command: "POST" HTTP-Get-Header: make HTTP-Get-Header append [ Referer: either find port/url #"?" [head clear find copy port/url #"?"] [port/url] Content-Type: "application/x-www-form-urlencoded" Content-Length: length? post-data/2 ] either block? post-data/3 [post-data/3] [[]] post-data: post-data/2 ][ if all [block? port/state/custom post-data: find port/state/custom 'get post-data/2] [ http-command: "GET" HTTP-Get-Header: make HTTP-Get-Header append [ Referer: either find port/url #"?" [head clear find copy port/url #"?"] [port/url] ] either block? post-data/3 [post-data/3] [[]] post-data: none ] ] | |
we can now do this read/custom url [get "dummy place holder" [Cookie: "name=value"]] | |
and this sends the cookie header with the get request | |
can refine that by removing the dummy place holder and changing the post-data/3 => post-data/2 | |
Oldes 20-Sep-2008 [10907] | I would prefere to have an officialy inbuild transparent cookies support (as I prefere not to harcode every cookie request) |
Graham 20-Sep-2008 [10908] | If you mean that the cookie is automatically captured by the http protocol, and then sent with every GET/POST, then that would imply you need to acquire the cookie first .. whereas sometimes you know what the cookie is and so don't need to get it first. |
Oldes 20-Sep-2008 [10909] | If you know the cookie, you can set it inside the cookies block, where are stored all cokies used for automated (transparent) sending. But I never used it. My clasic scenario is to simulate an user with the web browser. That means read page with login form, submit the form and do whatever like normal logged user. With some pages I can skip the first step, but there are pages which are giving you unike session ids in this step and don't let you login without this first step. |
Graham 20-Sep-2008 [10910x2] | sure ... and some of them insist on referring ids as well. |
we ought to check on the http protocol for R3 and make sure that it has all this stuff. | |
Louis 20-Sep-2008 [10912] | I'm having a strange problem. I'm trying to convert a file created with a Win XP program to work with a Linux program. Rebol seems to read past the end of the file into RAM. >>x: read %file1.txt >>print x AS: {5F65606E-93B2-4B16-BB24-ADC663FC8B5A}$[24;40Héx AS: is the last line in the file. I'm just showing a small amount of the following output. Note that the program seems to be unable to recognize the end of file marker. So, I did this: write %file2.txt read %file1.txt x: read %file2.txt print x But it didn't help. I got the same results. Any idea what is causing this? |
Henrik 20-Sep-2008 [10913] | when printing, does it display the same garbage every time? |
Louis 20-Sep-2008 [10914x3] | Ok, I found the problem. When I saved the file with the Windows program, I saved it in utf8 format. Resaving it in ascii format solved the problem. I realized the problem with I noticed some Chinese characters in the output past what I pasted in above. |
That would have been no problem with rebol3. | |
Thanks for responding Henrik. You are always willing to help, and I apprciate it very much. | |
Henrik 20-Sep-2008 [10917] | no problem |
amacleod 20-Sep-2008 [10918] | Having a bock of blocks that I want to look more readable how do I get each block to start on a new line... I've tried to append 'newline to end of each block but it does not seem to work. Now I'm having a similar problem using Paul's tretbase. I've been using MySQL to store formatted text that when I load it I can run my parse function on. When I sttore the same text in tretbase and load it my parse function fails. When I probe the text from each tehy look different: MySQL preserves the carriage returns: [5 "FFP-LADDERS" "1-PORTABLE LADDERS" "2.1.2" { \table Straight Weight^-Ladders 20'^-55 lbs. 20'(Hook)^-60 lbs. 12'(Hook)^-35 lbs. /table } "" "2008-07-22 00:12:24"] Tretbase seems to store the carriage return's character code but displays 'flat': [5 "FFP-LADDERS" "1-PORTABLE LADDERS" "2.1.2" { \table Straight Weight^-Ladders 20'^-55 lbs. 20'(Hook)^-60 lbs. 12'(Hook)^-35 lbs. /table } "" 20-Sep-2008/3:07:19-4:00] What Might I be doing wrong? |
sqlab 20-Sep-2008 [10919] | it looks as if the carriage returns are replaced by tabs. |
amacleod 20-Sep-2008 [10920x2] | There are also tabs in the text... I think the carriage returns have been stripped out? |
Here is what the block looks like just before I upload it to the database: [1 "FFP-LADDERS" "1-PORTABLE LADDERS" "2.1.2" { \table Straight Weight^-Ladders 20'^-55 lbs. 20'(Hook)^-60 lbs. 12'(Hook)^-35 lbs. /table } "" 20-Sep-2008/16:58:48-4:00] | |
sqlab 20-Sep-2008 [10922] | sorry, I looked too short.. did you look at the source of tretbase? |
amacleod 20-Sep-2008 [10923] | No, I'm working with Paul on it. He will be able to sort it out better than me. I thought it might be related to the same problem I had with my block of blocks above... |
BrianH 20-Sep-2008 [10924] | Try the new-line function. |
Graham 20-Sep-2008 [10925x6] | Mindtouch's Deki is the wiki now adopted by Mozilla internally. I suggested we use this instead of Mediawki because it has an API http://wiki.developer.mindtouch.com/MindTouch_Deki/API_Reference but .... |
It has multi-language support ( human languages ) | |
This is how to authenticate against the wiki using REBOL http://synapsedirect.com/forums/permalink/6737/6736/ShowThread.aspx#6736 | |
I had to alter the prot-http to allow get to send cookies. | |
If you click on their api reference you will see code samples nicely formatted with line numbers .. much nicer than Mediawiki | |
So, the API would allow someone to easily update the wiki directly from Rebol sources | |
Henrik 21-Sep-2008 [10931] | Graham, did you study my wiki-tools for Mediawiki? They have been available for over a year. |
Graham 21-Sep-2008 [10932] | nope. didn't know you had released them. I was aware that you had been working on something. |
Henrik 21-Sep-2008 [10933x2] | they are not entirely done, but doc uploading and syncing should work. |
so it should be possible to create a local editor to edit mediawiki pages, or to upload series of pages generated locally. | |
Gregg 21-Sep-2008 [10935] | new-line post from ML: http://www.rebol.org/ml-display-thread.r?m=rmlMMCC |
Graham 22-Sep-2008 [10936x3] | Looks like I need to do a HTTP PUT to upload binary files .... |
So, I guess I need a way to add the PUT method, and then switch the IO from lines mode to binary and then back again. | |
From my understanding, R3 implements http prot all as binary and does not use lines mode | |
Gabriele 22-Sep-2008 [10939] | yes, R3 tcp ports are binary only. |
Graham 22-Sep-2008 [10940x5] | So, how about something like read/custom url [ PUT %file [ header .. ] ] ? |
calculate the content-length, add the new headers, insert the file as binary and then switch back to lines mode for R2 ? | |
apart from it not working ... anyone see a problem with this? either all [block? port/state/custom post-data: find port/state/custom 'post post-data/2] [ http-command: "POST" HTTP-Get-Header: make HTTP-Get-Header append [ Referer: either find port/url #"?" [head clear find copy port/url #"?"] [port/url] Content-Type: "application/x-www-form-urlencoded" Content-Length: length? post-data/2 ] either block? post-data/3 [post-data/3] [[]] post-data: post-data/2 ][ either all [block? port/state/custom post-data: find port/state/custom 'get post-data/2] [ http-command: "GET" HTTP-Get-Header: make HTTP-Get-Header append [ Referer: either find port/url #"?" [head clear find copy port/url #"?"] [port/url] ] either block? post-data/3 [post-data/3] [[]] post-data: none ][ if all [block? port/state/custom post-data: find port/state/custom 'put post-data/2] [ http-command: "PUT" data: system/words/read/binary post-data/2 HTTP-Get-Header: make HTTP-Get-Header append [ Content-Type: "application/octet-stream" Content-Length: length? data ] either block? post-data/3 [post-data/3] [[]] ] post-data: post-data/2 ] ] | |
last line should be post-data: data | |
And it's working :) | |
older newer | first last |