[REBOL] differences between script output and typing with tcp port
From: sags:apollo:lv at: 4-Apr-2004 23:34
newbie q:
why there is differencies
f.ex. script:
[
REBOL [Title: "CGI Test Script"]
print "Content-Type: text/plain"
print "" ; required
print "<html>"
print "<head>"
print "<title>Rebol script test</title>"
print "</head>"
print "<body>"
print "<h1>Hello!</h1>"
checkPop: func [user-name passe pop-server port-
number] [
myCommands: ["user admin" "pass qwerty" "list"]
myPop: open/lines/no-wait [
scheme: 'tcp
host: pop-server
port-id: port-number
]
wait myPop
response: copy myPop
probe response
print "<br>"
foreach myCom myCommands [
print join "<br>>" myCom
print "<br>"
insert myPop myCom
wait myPop
response: copy myPop
probe response
]
; print "<pre>"
print "</table>"
print "<pre>quit"
insert myPop "quit"
wait myPop
probe copy myPop
print "</pre>"
close myPop
]
checkPop "admin" "qwerty" "localhost" 110
print "</body>"
print "</html>"
]
Produces following output with do:
Content-Type: text/plain
<html>
<head>
<title>Rebol script test</title>
</head>
<body>
<h1>Hello!</h1>
[{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build
1.3.21.0) <[c4q53k--3vs4i15--1--FQDN-n]
ot-set.he374c91d.invalid>}]
<br>
<br>>user admin
<br>
["+OK More authentication information required"]
<br>>pass qwerty
<br>
["+OK mailbox locked, 3 messages"]
<br>>list
<br>
["+OK 3 messages"]
</table>
<pre>quit
["1 411" "2 405" "3 405" "." "+OK closing connection -
goodbye!"]
</pre>
</body>
</html>
After command quit I am getting just part of response
while when I am doing the same by typing in console I am
geting full response after comand, that gives multiline
response:
>> myPop: open/lines/no-wait tcp://localhost:110
>> a: copy myPop
== [{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build
1.3.21.0) <[c4q4a3--3vs4i15--1--FQD]
N-not-set.hf8a3c319.invalid>}]
>> probe a
[{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build 1.3.21.0)
<[c4q4a3--3vs4i15--1--FQDN-n]
ot-set.hf8a3c319.invalid>}]
== [{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build
1.3.21.0) <[c4q4a3--3vs4i15--1--FQD]
N-not-set.hf8a3c319.invalid>}]
>> insert myPop "user admin"
>> a: copy myPop
== ["+OK More authentication information required"]
>> insert myPop "pass qwerty"
>> a: copy myPop
== ["+OK mailbox locked, 3 messages"]
>> insert myPop "list"
>> a: copy myPop
== ["+OK 3 messages" "1 411" "2 405" "3 405" "."]
>> insert myPop "quit"
>> close myPop
>>
Interesting also is that throught cgi the last response
differs from that I got from running that script in console:
<pre>quit
["1 411" "2 405" "3 405" "."]
</pre>
</body>
</html>
Thanks in advance,
Janeks