Accessing self.request from an iframe-htmlfile connection (IE8/9) #15

Closed
thapar opened this Issue Oct 12, 2012 · 16 comments

Comments

Projects
None yet
2 participants
@thapar
Contributor

thapar commented Oct 12, 2012

How can I access self.request in an iframe-htmlfile connection (IE8/9)? self.request is always None from an IE8/9 request.

single-file app: http://paste.ofcode.org/XzSpU5uT7bNsmZk3WJMdS9
with your chat.pt as the template file

@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 12, 2012

Owner

well, i dont have access to IE, but i tested iframe-htmlfile transport in firefox. works as expected

Owner

fafhrd91 commented Oct 12, 2012

well, i dont have access to IE, but i tested iframe-htmlfile transport in firefox. works as expected

@fafhrd91 fafhrd91 closed this Oct 12, 2012

@fafhrd91 fafhrd91 reopened this Oct 12, 2012

@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 12, 2012

Contributor

Meaning, it's expected not to have access to self.request within the class EchoSession(Session)? Because no one else has been able to access self.request with iframe-htmlfile either.

Contributor

thapar commented Oct 12, 2012

Meaning, it's expected not to have access to self.request within the class EchoSession(Session)? Because no one else has been able to access self.request with iframe-htmlfile either.

@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 12, 2012

Owner

it is expected to have access to request. you should be able to get request object for any transport.

i cant test IE at the moment, i will try to get win box with IE in a week or two.

Owner

fafhrd91 commented Oct 12, 2012

it is expected to have access to request. you should be able to get request object for any transport.

i cant test IE at the moment, i will try to get win box with IE in a week or two.

@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 12, 2012

Contributor

Even in Chrome and Firefox, with iframe-htmlfile, self.request is None. This is confirmed by other users as well. Because an iframe request is an independent request, perhaps it needs to be retrieved from elsewhere?

Contributor

thapar commented Oct 12, 2012

Even in Chrome and Firefox, with iframe-htmlfile, self.request is None. This is confirmed by other users as well. Because an iframe request is an independent request, perhaps it needs to be retrieved from elsewhere?

@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 12, 2012

Owner

what OS do you use? what versions of chrome and firefox?

Owner

fafhrd91 commented Oct 12, 2012

what OS do you use? what versions of chrome and firefox?

@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 12, 2012

Contributor

Windows 7 x64

  • Chrome - Version 23.0.1271.26 beta-m
  • FF - 16.0.1
  • IE - 9

Ubuntu 11.04 x64

  • Chromium - Version 12.0.742.112 (90304)
  • FF - 5.0
Contributor

thapar commented Oct 12, 2012

Windows 7 x64

  • Chrome - Version 23.0.1271.26 beta-m
  • FF - 16.0.1
  • IE - 9

Ubuntu 11.04 x64

  • Chromium - Version 12.0.742.112 (90304)
  • FF - 5.0
@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 12, 2012

Owner

and do you test on master?

Owner

fafhrd91 commented Oct 12, 2012

and do you test on master?

@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 12, 2012

Contributor

Yes

Contributor

thapar commented Oct 12, 2012

Yes

@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 12, 2012

Owner

ok, i'll install ubuntu today and will try to reproduce

Owner

fafhrd91 commented Oct 12, 2012

ok, i'll install ubuntu today and will try to reproduce

@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 12, 2012

Contributor

I realize my single-file-app seems to have some issue since it isn't able to use websockets. But the issue exists in my main app and your example app as well (both of which can use websockets without an issue). This happens on both OS's (Windows + Ubuntu) and each browser I listed, where I use iframe-htmlfile as the transport means.

Contributor

thapar commented Oct 12, 2012

I realize my single-file-app seems to have some issue since it isn't able to use websockets. But the issue exists in my main app and your example app as well (both of which can use websockets without an issue). This happens on both OS's (Windows + Ubuntu) and each browser I listed, where I use iframe-htmlfile as the transport means.

@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 15, 2012

Contributor

Knock knock =)

Contributor

thapar commented Oct 15, 2012

Knock knock =)

@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 15, 2012

Owner

chat example used sockjs-0.3.1 and it didnt work. chat example now uses sockjs 0.3.2
Firefox 16.0.1 + Ubuntu 12.04.1 works with sockjs 0.3.2

try again with latest change.

Owner

fafhrd91 commented Oct 15, 2012

chat example used sockjs-0.3.1 and it didnt work. chat example now uses sockjs 0.3.2
Firefox 16.0.1 + Ubuntu 12.04.1 works with sockjs 0.3.2

try again with latest change.

@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 15, 2012

Contributor

Tried it with sockjs 0.3.2, but the same problem exists. If any iframe transport is used, self.request is None. If you pdb.set_trace() within on_open(self) and check self.request, you can see that it is in fact None.

Contributor

thapar commented Oct 15, 2012

Tried it with sockjs 0.3.2, but the same problem exists. If any iframe transport is used, self.request is None. If you pdb.set_trace() within on_open(self) and check self.request, you can see that it is in fact None.

@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 15, 2012

Owner

here is what i get

-> self.manager.broadcast("Someone joined.")
(Pdb) self.request
<Request at 0xa8cdacc GET http://localhost:8080/__sockjs__/846/ai03l59f/htmlfile?c=_jp.atenqmo>
(Pdb)
Owner

fafhrd91 commented Oct 15, 2012

here is what i get

-> self.manager.broadcast("Someone joined.")
(Pdb) self.request
<Request at 0xa8cdacc GET http://localhost:8080/__sockjs__/846/ai03l59f/htmlfile?c=_jp.atenqmo>
(Pdb)
@thapar

This comment has been minimized.

Show comment
Hide comment
@thapar

thapar Oct 16, 2012

Contributor

I created a fresh virtual environment and I now get the same output. Not sure what the issue was earlier. Continuing on this train though, authenticated_userid(self.request), as well as for sess in self.manager.active_sessions(): print sess both give this error:

2012-10-16 13:20:06,387 ERROR [pyramid_sockjs][Dummy-3] Exceptin in .on_open method.
Traceback (most recent call last):
  File "/home/raj/cleanenv/lib/python2.7/site-packages/pyramid_sockjs/session.py", line 90, in open
    self.on_open()
  File "/home/raj/Practice/git/newsite/newsite/views/chat.py", line 179, in on_open
    nick = authenticated_userid(self.request)
  File "/home/raj/cleanenv/lib/python2.7/site-packages/pyramid_sockjs/session.py", line 55, in __str__
    result = ['id=%r' % self.id]
TypeError: not all arguments converted during string formatting

Also:

(Pdb) self.request
<RequestWithUserAttribute at 0x4c15a90 GET http://babasociety.local:6543/__sockjs__/585/89_w5di1/websocket>
(Pdb) self.id
('Guest3796', u'89_w5di1')

Guest3796 should be the authenticated_userid(self.request).

Any idea?

Contributor

thapar commented Oct 16, 2012

I created a fresh virtual environment and I now get the same output. Not sure what the issue was earlier. Continuing on this train though, authenticated_userid(self.request), as well as for sess in self.manager.active_sessions(): print sess both give this error:

2012-10-16 13:20:06,387 ERROR [pyramid_sockjs][Dummy-3] Exceptin in .on_open method.
Traceback (most recent call last):
  File "/home/raj/cleanenv/lib/python2.7/site-packages/pyramid_sockjs/session.py", line 90, in open
    self.on_open()
  File "/home/raj/Practice/git/newsite/newsite/views/chat.py", line 179, in on_open
    nick = authenticated_userid(self.request)
  File "/home/raj/cleanenv/lib/python2.7/site-packages/pyramid_sockjs/session.py", line 55, in __str__
    result = ['id=%r' % self.id]
TypeError: not all arguments converted during string formatting

Also:

(Pdb) self.request
<RequestWithUserAttribute at 0x4c15a90 GET http://babasociety.local:6543/__sockjs__/585/89_w5di1/websocket>
(Pdb) self.id
('Guest3796', u'89_w5di1')

Guest3796 should be the authenticated_userid(self.request).

Any idea?

@fafhrd91

This comment has been minimized.

Show comment
Hide comment
@fafhrd91

fafhrd91 Oct 16, 2012

Owner

thats bug, fixed in master

Owner

fafhrd91 commented Oct 16, 2012

thats bug, fixed in master

@fafhrd91 fafhrd91 closed this Oct 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment