Author |
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 09 2004 at 22:58 | IP Logged
|
|
|
Is there more info on the /ph-cgi/relay command? I found nothing in any docs, but, it sounds interesting!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 10 2004 at 00:00 | IP Logged
|
|
|
Tony,
I just started really playing with this command on my home system and its still needing a bit of work. When I initially tested using a proxy server, it was working pretty well.
If you're interested in experimenting with it, the general format is something like this:
http://192.168.0.10/ph-cgi/relay?url=http://www.sybase.com/home
What is supposed to happen is a request for a remote web page goes to the PowerHome web server. The PowerHome web server then makes the request to the remote page, the HTML is searched for images and links, and they are replaced with the appropriate /ph-cgi/relay command. The PowerHome web server then passes the resulting HTML back to the remote client without the remote client ever having to actually connect to the remote web page.
A couple of the original reasons for this was to work around the fact that some celluar providers block access to all but port 80 on their low end internet package. This function would have allowed users to access web pages other than on port 80 via their PowerHome web server.
It also would have been useful for some webcam software that doesnt properly support password access. By blocking external access to the port the webcam uses with a home router, PowerHome could make a request to the webcam software (on the internal network), and pass the image back only after proper password access had been passed to PowerHome.
I'll work some more on this command and try to get it working so that it's more reliable.
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 14 2005 at 20:52 | IP Logged
|
|
|
Is it safe to assume that this has been worked on?
Tony
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 15 2005 at 13:33 | IP Logged
|
|
|
Tony,
Yep...it's still not perfect (doesnt handle forms), but will work decently for standard web pages. (I cant even remember exactly why I added this function. It has been useful for getting to certain webpages that are blocked at my work however.)
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 15 2005 at 20:18 | IP Logged
|
|
|
"I cant even remember exactly why I added this function"
Heh! That is one of the first signs...
Tony
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: February 16 2005 at 05:55 | IP Logged
|
|
|
TonyNo wrote:
"I cant even remember exactly why I added this function"
Heh! That is one of the first signs...
Tony |
|
|
hehe, yes, be warned: The first sign are here..
However: the relaycommand sounds very interesting... I'll follow news on this subject with big eyes... Could be usefull....
Peter
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: March 31 2005 at 22:42 | IP Logged
|
|
|
PowerHome could make a request to the webcam software (on the internal network), and pass the image back only after proper password access had been passed to PowerHome
Is there anything special one needs to do to get the authentication to work for this?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 05 2005 at 11:30 | IP Logged
|
|
|
Tony,
Not really, (Im trying to remember exactly what I was thinking ).
You could simply have a PSP page (which default requires authentication) make a request to the internal webcam software. You could also have the PSP request a separate userid/password (different from the guest or master) by using the ph_getwebbase64auth function to verify the userid/password and the ph_setwebreturn funtion to return a 401 if not correct.
Let me know if this is what you were asking.
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 05 2005 at 20:32 | IP Logged
|
|
|
Yup. I just wanted confirmation that it required authentication. How is this handled with respect to guest/master?
Thanks!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 05 2005 at 22:49 | IP Logged
|
|
|
Well, if you're using the default security setting for PSP (Master Only) and then use the ph_setwebreturn and ph_getwebbase64auth functions, then it will ask for a userid and password twice. Once for access to the PSP page (master userid and password) and once for the ph_setwebreturn (whatever userid and password you code into the PSP page using ph_getwebbase64auth).
Now in browserland, the browser will cache all userid's and passwords used in a session and will try them all until you get a match (at least thats my impression ). This way, you only have to login the master password once and the ph_getwebbase64auth password once for a session.
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 06 2005 at 08:10 | IP Logged
|
|
|
I guess my question was... Would the redirect occur when using Guest access in PH? This is a redirect to my web cam, which serves no code, just an image. If so, could I code something to cover this?
Thanks,
Tony
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 06 2005 at 11:14 | IP Logged
|
|
|
By default, no. PSP pages will only execute with the master password so no redirect will occur. Now if you go into the Explorer->Setup->Web, you can change the security for PSP to "Master or Guest" and then it would work. However, ALL PSP pages will now be accessible to the guest account. This can be easily fixed however by simply including the code below:
<%ph_rtne(if(ph_getwebauth() < 2,ph_setwebreturn(401),0))%>
This isnt completely foolproof however...even though the PSP will return a 401 resulting in a userid/password box being presented, the actual PSP code will still execute. You could get around this by embedding all of the code within the second parameter of the "if" statement, but this could quickly become messy. Soooo, Im going to make a quick change to the PSP processing so that after the evaluation of every separate PSP formula (what between the <% and %> blocks), if the return code is anything other than 200, then no more PSP formula evaluations will occur for the page. So by just placing this formula as the first PSP formula of the page should take care of you.
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 06 2005 at 12:59 | IP Logged
|
|
|
OK, thanks Dave!
So, I could just place that code on the page where I have the link to the redirect. I think I've done that on my older cam and CID pages.
Maybe the redirect itself could use some fortification, if it will be sticking around.
Tony
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 11 2005 at 15:19 | IP Logged
|
|
|
Tony,
While working through this with you, I finally remembered what I had coded the ph-cgi/relay function for. Mainly to handle problems with certain ports being blocked by ISP's and such .
In the new beta 1.03.4.4, Ive included a couple of extra functions at the last minute. Ive also recoded so that PSP will stop executing as soon as the return value is changed from 200.
The new functions are: ph_webaddblob and ph_webclearblob. These functions will allow you to build a blob (binary file) using PSP. So in your case, you could create a PSP that checks for user authorization and if it passes, use the ph_webaddblob function with the URL option to retrieve the image from the webcam and pass it back to the user.
Ive been trying to think of how to modify the "relay" command but cant come up with an effective way to do it. Currently the "relay" command requires the "master" userid and password. I havent been able to come up with alternatives so that the user can enter a different userid/password that is authenticated within a PSP and then passed to the "relay" function without embedding the master userid/password and giving the user the opportunity of collecting this info.
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 11 2005 at 17:11 | IP Logged
|
|
|
Dave,
Sounds good. If only the "master" credentials work, that's OK with me! That makes it easier!
Tony
|
Back to Top |
|
|