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

World: r3wp

[Core] Discuss core issues

Ladislav
6-Apr-2007
[7379]
Rebol [
	Title: "NIST clock"
	File: "nistclock.r"
	Author: "Ladislav Mecir"
	Date: 6-Apr-2007/8:32:57+2:00
]

get-nist-correction: func [
	{Never use this function more often than once in four seconds!}
	/local nist-time cpu-time mjd hms
] [
	nist-time: read daytime://time-a.nist.gov
	cpu-time: now

 parse/all nist-time [skip copy mjd 5 skip 2 thru " " copy hms 8 skip]
	nist-time: 18/Nov/1858 + to integer! mjd
	nist-time/time: to time! hms
	difference nist-time cpu-time
]

correction-interval: 181
seconds-to-correction: 1

view/new layout [
	banner 140x32 rate 1 with [data: 0:0:0] feel [
		engage: func [face action event] [
			seconds-to-correction: seconds-to-correction - 1
			if zero? seconds-to-correction [
				nist-correction: get-nist-correction
				seconds-to-correction: correction-interval
			]
			current-time: now + nist-correction
			face/text: current-time/time
			show face
		]
	]
]
do-events
BrianH
6-Apr-2007
[7380x2]
Quick dumb question: I have to post some data to a web site that 
requires authentication. How do I specify the username and password? 
I forget...
The password in question is incompatible with url! syntax.
btiffin
6-Apr-2007
[7382x2]
system/schemes/http/user: "user"    system/schemes/http/pass:  "pass" 
  ??
a: read/custom [site: "www.site.com" scheme: 'http user: "user" pass: 
"pass"] [post  "stuff"]
BrianH
6-Apr-2007
[7384]
First didn't work, second gave invalid port spec error.
btiffin
6-Apr-2007
[7385x2]
Umm, is it https?  Need rebcmd for that I think.  or add port: 80 
 maybe...
Sorry, I get it wrong everytime.  It's host:  not site:
BrianH
6-Apr-2007
[7387]
If it matters, I am accessing an Outlook Web Access site, https scheme, 
with /Command.
btiffin
6-Apr-2007
[7388]
Try  host: "..."  scheme: 'https ...    my mistake.
BrianH
6-Apr-2007
[7389]
That worked, but now I'm getting a "Method not allowed" error from 
the server. I'm trying to enable junk email folders on an Exchange 
server and apparently the only way to do so is with a 100+ line VBScript 
that translates to a one-line REBOL script, but neither seem to work 
with this server.
btiffin
6-Apr-2007
[7390]
try  [url: "www.site.com/prog.cgi" ...]  instead of host::
BrianH
6-Apr-2007
[7391]
I tried host and path and that builds the url properly, but now I 
get a different server error that REBOL doesn't print all of so I 
can't see it. I can't seem to trap the error so I can print the whole 
thing.
btiffin
6-Apr-2007
[7392x2]
Or maybe  [host: "www.site.com" url: "prog.cgi"]
Can you prepend the read with print to get the rest of the message?
Izkata
6-Apr-2007
[7394x2]
>> probe decode-url http://www.junk.net/path/to/index.html
make object! [
    user: none
    pass: none
    host: "www.junk.net"
    port-id: none
    path: "path/to/"
    target: "index.html"
]
try with those...
BrianH
6-Apr-2007
[7396]
It never gets to the read - it fails on open. When I tried TRACE/NET 
ON I saw the error: HTTP/1.1 440 Login Timeout
What's that?
btiffin
6-Apr-2007
[7397]
https authentication.  No experience.  Sorry.
Graham
6-Apr-2007
[7398]
what type of authentication is it?
BrianH
6-Apr-2007
[7399]
It's Basic authentication.
Graham
6-Apr-2007
[7400x2]
is it simple authentication ?
ok.
BrianH
6-Apr-2007
[7402x3]
AFAICT
Authorization: Basic Q0NFU1xBZG1pbmlzdHJhdG9yOiFNVFVTQSYqKA==
Is that digest?
Graham
6-Apr-2007
[7405x2]
read/custom http://user:[password-:-somewere-:-com] [ post ... ] doesn't 
work?
because the password has some funny characters in it??
BrianH
6-Apr-2007
[7407]
It does.
Graham
6-Apr-2007
[7408]
Ok, you can change the parse rule to allow the @ or whatever
BrianH
6-Apr-2007
[7409x2]
Nonetheless, the error I got with the port spec is the same that 
the VBScript from Microsoft's web site gets.
Any way to increase the timeout?
btiffin
6-Apr-2007
[7411]
You can try   port:  open  [spec]   insert port mold ['post stuff] 
 result: copy port  ???  the insert may need more....   {POST HTTP/1.1 
...  somesuch
Graham
6-Apr-2007
[7412]
yes
BrianH
6-Apr-2007
[7413]
And what would that way be? :)
btiffin
6-Apr-2007
[7414]
The command docs mention something about initiating ssl connections 
  with  port: open/direct  ssl://url:portnum  then a   set-modes 
port [secure: true]  to initiate authentication...
BrianH
6-Apr-2007
[7415]
Brian,

    read/custom [scheme: 'https host: "server" path: "path/to/stuff" 
    user: "username" pass: "password"]

works. I don't need to recreate the port scheme, as it does that 
secure: true in its code. I get the same error with Microsoft's VBScript 
fix. I think it's something server-side. Thanks for the help with 
the syntax though - it's been a while.
btiffin
6-Apr-2007
[7416x2]
There is a system/schemes/http/timeout field    probably the same 
for https
Yeah me too,  This is the kinda code that my brain treats as fire-and-forget. 
 Need to do it again...look it up again.  :)
BrianH
6-Apr-2007
[7418]
Timeout is ignored. Must be a server misconfiguration (just a guess 
based on how messed up this server is).
btiffin
6-Apr-2007
[7419]
There are threads in MS Tech net about 440 timeouts when Exchange 
enables Form Authentication.  All I've seen so far is Help Help messages, 
not fixes...


http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=1110323&SiteID=17

Is one example.
BrianH
6-Apr-2007
[7420x2]
According to MS's blogs, the only way to enable Exchange's server-side 
junk mail folders is to do so through Outlook Web Access on a per-user 
basis. The only way they suggest to do so for all users is to post:

cmd=options
junkemailstate=1
cmd=savejunkemailrule


to every user, logging in as a domain administrator. They provide 
a 100+ line VBScript to do this for a list of names in a file. When 
that failed, I figured that I could do the same in 1 or 2 lines of 
REBOL, and I was correct: I get the same exact failure the VBScript 
gets in 1 line of REBOL :(
Interesting. That site you linked to seems to narrow this down to 
forms-based authentication, which is enabled om my server. I'm going 
to try temporarily disabling it and see if that helps.
btiffin
6-Apr-2007
[7422]
Drummm rollll
BrianH
6-Apr-2007
[7423]
Worked!
btiffin
6-Apr-2007
[7424x2]
Yippee...if you can disable FBA long term...

There may be a more permanent solution...I didn't read all of it.

http://www.chicagotech.net/exchange/owa440.htm
Brian;  Don't forget to post your REBOL solution to the place you 
got the VBScript.  :)
Henrik
8-Apr-2007
[7426x2]
doh! I'd been hunting a bug in LIST-VIEW all day and it turns out 
that Ladislav's BUILD function does funny stuff to paths:

>> build [append/only [] []]
== [append/unset [] []]
The solution seems to be:

>> build [only 'append/only [] []]
== [append/only [] []]
Gregg
8-Apr-2007
[7428]
Gotta watch those advanced libs. :-) The tricky stuff, like REBOL 
itself, often has a few things you have to trip over a couple times 
before setting a flag in your brain.