These are chat archives for opal/opal

11th
Aug 2014
Elia Schito
@elia
Aug 11 2014 09:19
If anyone’s interested I published corelib docs to http://opal.github.io/opal/doc/opal/frames.html#!file.README.html
The idea is to have a service similar to rdoc.info but for opal-land
opal.org/try/# uses 0.6.2 and seems to return promises ...
Elia Schito
@elia
Aug 11 2014 14:04
@bwl21 yes, opalrb.org/try should be more up to date
Bernhard Weichel
@bwl21
Aug 11 2014 14:04
@elia but at the moment I cannot solve the authentication issue.
Elia Schito
@elia
Aug 11 2014 14:04
so, which versions are you using in your code?
Bernhard Weichel
@bwl21
Aug 11 2014 14:04
my code runs 0.6.2
Elia Schito
@elia
Aug 11 2014 14:05
opal-jquery version?
Bernhard Weichel
@bwl21
Aug 11 2014 14:05
opal (0.6.2)
opal-browser (0.2.0.beta1)
opal-jquery (0.2.0)
I think I do not need opal-browser for the HTTP stuff, right?
Elia Schito
@elia
Aug 11 2014 14:06
right
opal-browser has its implementation with different API
Bernhard Weichel
@bwl21
Aug 11 2014 14:07

HTTP.get("https://cloud.weichel21.de:61670/remote.php/webdav/",
{username:"fooname",
password:"foopass",

}
).then do |response|
puts "success"
puts response.body
end.fail do |response|
puts "fail"
puts response.status_code
end
puts "foo"

result is always foo
fail
401
Elia Schito
@elia
Aug 11 2014 14:08
To have promises you need to get opal-jquery from git I think
Bernhard Weichel
@bwl21
Aug 11 2014 14:08
even if I provide the correct username password (here in the chat I did not post the same :-)
I am just playing around in opal.org/try
Elia Schito
@elia
Aug 11 2014 14:08
wrt the auth problem could be plain bug, have you checked the request headers?
Bernhard Weichel
@bwl21
Aug 11 2014 14:08
if it does not work there, I do not expect it to work
Elia Schito
@elia
Aug 11 2014 14:08
another thing you can try is to use jquery to do it and see if it works
Bernhard Weichel
@bwl21
Aug 11 2014 14:08
the rquest headers are
Remote Address:89.107.186.40:61670
Request URL:https://cloud.weichel21.de:61670/remote.php/webdav/
Request Method:GET
Status Code:401 Unauthorized
Request Headersview source
Accept:/
Accept-Encoding:gzip,deflate,sdch
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Host:cloud.weichel21.de:61670
Origin:http://opalrb.org
Referer:http://opalrb.org/try/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Response Headersview source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Authorization,Destination,Content-type,Depth
Access-Control-Allow-Methods:GET,POST,OPTIONS,DELETE,PUT,MKCOL,MOVE,COPY,PROPFIND
Access-Control-Allow-Origin:*
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Length:291
Content-Type:application/xml; charset=utf-8
Date:Mon, 11 Aug 2014 14:09:12 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=2, max=100
Pragma:no-cache
Server:Apache
Set-Cookie:5244769ad951a=aa8ddb2ecbb4a0707f2a01a8937af7ba; path=/; secure; HttpOnly
Strict-Transport-Security:max-age=31536000
WWW-Authenticate:Basic realm="ownCloud"
X-Powered-By:PHP/5.3.28
It seems that the request does not provide the Authenfication headers
http://stackoverflow.com/questions/10226333/ajax-authentication-with-jquery tells me that I have to create the basic authentication by myself
Elia Schito
@elia
Aug 11 2014 14:10
@bwl21 /try is a bit more limited, let me know how it goes with jquery directly
Bernhard Weichel
@bwl21
Aug 11 2014 14:10
can't believe that
Elia Schito
@elia
Aug 11 2014 14:11
indeed lol
Bernhard Weichel
@bwl21
Aug 11 2014 14:12
so what is the benefit if http://www.tutorialspoint.com/jquery/ajax-jquery-ajax.htm tells me that ajax takes username/password?
Elia Schito
@elia
Aug 11 2014 14:12
by indeed I mean that I expect it to be something about jquery itself
@bwl21 I’d check with their official docs tho
Bernhard Weichel
@bwl21
Aug 11 2014 14:13
I will add the code to my app and see what happens
Elia Schito
@elia
Aug 11 2014 14:13
keep me posted
Bernhard Weichel
@bwl21
Aug 11 2014 14:44
@elia is it ok if we discuss this in the public opal chat?
I tried it. I do not have Promise with the opal-jquery, i have. So I try the old fashioned callback hell :-)

this is, what I get:GET https://cloud.weichel21.de:61670/remote.php/webdav/xx/ 401 (Unauthorized) jquery-1.11.1.min.js:4
m.ajaxTransport.send jquery-1.11.1.min.js:4
m.extend.ajax jquery-1.11.1.min.js:4
def.$send! http.js?body=1:149
$opal.defs.TMP_1 http.js?body=1:24
(anonymous function) controller.js?body=1:146
def.$handle_command controller.js?body=1:162
def.$setup_ui_listener.$a._p.TMP_8 controller.js?body=1:356
def.$on.wrapper element.js?body=1:400
m.event.dispatch jquery-1.11.1.min.js:3
m.event.add.r.handle jquery-1.11.1.min.js:3
returned 401 io.js?body=1:98
<?xml version="1.0" encoding="utf-8"?>

<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre_DAV_Exception_NotAuthenticated</s:exception>
<s:message>No basic authentication headers were found</s:message>
<s:sabredav-version>1.7.6</s:sabredav-version>
</d:error>

Elia Schito
@elia
Aug 11 2014 15:07
@bwl21 fine by me, I just ask you to wrap long cheucks of stuff into triple backtics or indented by four spaces
so it won’t spam too much
gists would be good too
Bernhard Weichel
@bwl21
Aug 11 2014 15:18
Ok, I summarized it in a gist (never used gist before :-)
note that the $log is my implementation of a logger class which writes to the console as well as to the log window in my Applciation
Eric West
@edubkendo
Aug 11 2014 16:52
:+1: definitely a gitter fan
Artur Ostręga
@aost
Aug 11 2014 17:14
I like that it can be accessed via IRC client
Elia Schito
@elia
Aug 11 2014 17:14
yep, it’s really nice to have it bothways
Artur Ostręga
@aost
Aug 11 2014 17:20
I need everything I use to be command line-accessible!
Elia Schito
@elia
Aug 11 2014 17:21
:raised_hands: