13 Replies Latest reply: Jul 5, 2012 7:28 PM by joedart RSS

    reg.cgi

    flairjax Community Member
      Do we just throw reg.cgi into a web server and that is it or are we suppose to do something else with it?
        • 1. Re: reg.cgi
          flairjax Community Member
          Better yet has anyone set it on Google Apps? If so do you have the step by step instructions on how to do this?

          • 2. Re: reg.cgi
            Michael Thornburgh Adobe Employee
            The ReadMe.txt file included with the "Video Phone Application source code" .zip file includes a section on installing reg.cgi. You will need to place reg.cgi (changing its name if you want) into your web server's cgi-bin location, create the SQLite3 database that it needs somewhere, and modify reg.cgi so that it knows the location of the database directory (that part is marked with the comment "CHANGE THIS"). The minimal instructions are also at the top of reg.cgi as a comment, including the schema of the SQLite3 database that you must create. The "CREATE TABLE" and "CREATE INDEX" commands can simply be copy-and-pasted directly into the SQLite3 shell.

            Up-to-date installations of Python and the sqlite3 Python module are required for this script to work without modification. Python 2.5.1 and above, and the SQLite3 module actually called "sqlite3" should work. Those are present on Mac OS X 10.5.

            Note that reg.cgi is *not* the kind of code you would deploy for a real production service. Most importantly, there's no authentication or access control of any sort. The script is a minimal illustration of a means of exchanging peerIDs.
            • 3. Re: reg.cgi
              joedart Community Member

              Michael I have the same problem. I did place the python cgi program in the cgi-bin and put the registrations.db in there too... however, having never heard of this data base I have no idea how to set it up other than using notepad and uploading it. But what if anything do we actually have to put into this .db file? I am leaving it empty because I assumed the python program would put data into it. Could this be the reason why I am getting a successful connect followed by error message ID event: idManagerError Error description: HTTP error:(mx.messaging.messages::ErrorMessage)#0 body=(null)... etc??

               

              Thanks.

               

              The audio and web cam works and it does make a connection with NetConnection, but then loses it.

              • 4. Re: reg.cgi
                joedart Community Member

                p.s. How does the VideoPhoneLabs program find the reg.cgi script anyway? I assume the users enter the link to the VideoPhoneLabs.html. Does that program find the Python script?

                • 5. Re: reg.cgi
                  joedart Community Member

                  ok. I added the code for Create Table and Create Index to the .db file. Still get the same errors. Instead of retyping them, here they are copied.

                  ----------------------------

                  Connecting to rtmfp://p2p.rtmfp.net

                  NetConnection event: NetConnection.Connect.Success

                  Connected, my ID: b376e91ae5f49115f352b68fc37ddfa6c365a7f9fc685e5d982e6d58f7a2d463

                  ID event: idManagerError

                  Error description: HTTP error: (mx.messaging.messages::ErrorMessage)#0

                    body = (null)

                    clientId = "DirectHTTPChannel0"

                    correlationId = "41CF1D4D-6900-3240-E3CF-378C5001BE3B"

                    destination = ""

                    extendedData = (null)

                    faultCode = "Channel.Security.Error"

                    faultDetail = "Destination: DefaultHTTP"

                    faultString = "Security error accessing url"

                    headers = (Object)#1

                      DSStatusCode = 0

                    messageId = "FD812AC6-5DC2-76C2-03DC-378C508B2964"

                    rootCause = (flash.events::SecurityErrorEvent)#2

                      bubbles = false

                      cancelable = false

                      currentTarget = (flash.net::URLLoader)#3

                        bytesLoaded = 0

                        bytesTotal = 0

                        data = (null)

                        dataFormat = "text"

                      errorID = 2048

                      eventPhase = 2

                      target = (flash.net::URLLoader)#3

                      text = "Error #2048"

                      type = "securityError"

                    timestamp = 0

                    timeToLive = 0

                  Disconnecting.

                  Hanging up call

                  • 6. Re: reg.cgi
                    Michael Thornburgh Adobe Employee

                    here the URL to the SWF is not in the same domain as the URL to reg.cgi, so you're getting a security error from Flash Player.

                     

                    if the domains can't be the same, you will need a crossdomain.xml file on reg.cgi's web server to allow the cross-domain access.

                     

                    regarding reg.cgi and its installation: its database should not be in the cgi-bin directory, as the directory where the database is (and the database file itself) must be writable by the web server process.

                     

                    the VideoPhoneLabs source code has a spot for you to set the URL to reg.cgi according to how/where you installed the script.

                    • 7. Re: reg.cgi
                      joedart Community Member

                      Michael

                       

                      thanks for your help. But I this is a more complicated problem than what

                      domain my files are in. I looked at the code in the VideoPhoneLabs.mxml

                      program and see that I have put my Domain into

                      WebServiceUrl:String = "http://dartwerks.com";

                       

                      which is the web site where I am storing the html/swf/etc files

                       

                      I put the python file named reg.cgi  (with all permissions) in the

                      cgi-bin folder in that same domain (which should be

                      dartwerks.com/cgi-bin/reg.cgi

                       

                      VideoPhoneLabs.mxml shows it is trying to Get cgi-bin/reg.cgi in

                      HttpIdManager.as.

                       

                      If something at that point is causing the problem, I am not yet seeing

                      what it could be.

                      • 8. Re: reg.cgi
                        Michael Thornburgh Adobe Employee

                        a security error from URLLoader almost certainly means a cross-domain permission issue.

                         

                        that notwithstanding, i also get a "500 Internal Server Error" when trying to access http://dartwerks.com/cgi-bin/reg.cgi . your web server and the installation of reg.cgi isn't quite right yet.

                         

                        reg.cgi is a simple REST-y service. you can use your web browser or curl or even telnet (if you're willing to speak HTTP manually) to test it. for example:

                         

                          % curl 'http://your.domain/cgi-bin/reg.cgi?username=joedart&identity=1234'

                         

                        to set identity "joedart" to "1234", and to look that up:

                         

                          % curl 'http://your.domain/cgi-bin/reg.cgi?friends=joedart'

                         

                        once you get that working, then you can get it working with VideoPhoneLabs. i believe the WebServiceUrl must be the whole URL, such as

                         

                          WebServiceUrl:String = "http://dartwerks.com/cgi-bin/reg.cgi";

                         

                        in order to avoid a cross-domain security issue, the origin of your SWF and the web service URL must be exactly the same; that is, the scheme must be the same (both "http:" or both "https:") and the hostname must be exactly the same. if one is www.dartwerks.com and the other is dartwerks.com (or if one is an IP address or "localhost" or something), it won't work and you'll get that security violation.

                        • 9. Re: reg.cgi
                          joedart Community Member
                          • 10. Re: reg.cgi
                            joedart Community Member

                            Michael

                             

                            this is concerning the cgi-bin problem.

                             

                            I contacted the technical guy at Hostmonster and he looked at the domain

                            problem I am having with the errors using reg.cgi. Here is his complete

                            reply:

                             

                            -


                             

                            ". . .sqlite3 is listed as a module installed for python so, they should be able to use that for their python script . . .here's one thing to consider - I do not see xml.sax.saxutils and on line 35, they are trying to use that: import xml.sax.saxutils so, that's not a module we have by default.  Which means, if they want to be able to use that module, they'll need to install it, and in order to install a module, they will have to install python locally.  So, their best bet at this point is to install python locally using this helpdesk article:

                             

                            https://my.hostmonster.com/cgi/help/python-install

                             

                            Once they have python installed locally, they can install that module and import it.  Finally, they would need to change the interpreter of their reg.cgi script to now use the locally installed python on their account instead of the server installed version. So, they've got a bunch of work to do to get this to work. And I bet the 500 error on their script is caused by not being able to import that xml.sax.sutils module."

                             

                             

                            -


                             

                            This recipe above seems like a lot of work just to exchange IP addresses

                            between peers. I will do it if I have to, but do you have any

                            suggestions as to how else I might approach having the GETs in

                            VideoPhoneLabs.swf obtain the information to be exchanged? Something

                            simple is best. If I am having this much trouble, and this hosting

                            company is running a common linux, then a lot of other people are going

                            to hit the same wall when they try to do this no matter who is hosting

                            them. My gut feeling is that this is a weakness that undermines the

                            acceptance of this very nice p2p flash system. By the way, I've talked

                            to several computer technical people here at the university where I work

                            (I teach computing) and none of them have this specific band of

                            pythonsqlite3 experience. That's worrisome. Maybe some people are

                            immersed in the latest python and sqlite3 but it is by no means

                            universal, even among us geeks. It's worth thinking about.

                             

                            joe dart

                            • 11. Re: reg.cgi
                              Michael Thornburgh Adobe Employee

                              the xml.sax.saxutils should be a standard installed module as of Python 2.0, which has been around for a *very* long time.

                               

                              the sqlite3 module was added in Python 2.5. there's no reason why a Python installation that has sqlite3 shouldn't also have xml.sax.saxutils. also, Python 2.5 has been around for a very long time (many many years).

                               

                              that being said, reg.cgi is an instructive example of how one might make a simple web service, which goes with an instructive sample application.

                               

                              use of this exact script is not required. any web service which provides an equivalent interface will be compatible with VideoPhoneLabs. i believe several folks have written compatible scripts in languages like PHP or Perl. i bet they aren't even that hard to find if you ask the Google.

                              • 12. Re: reg.cgi
                                joedart Community Member

                                Michael

                                 

                                There is something here I am missing.

                                 

                                ok. At your suggestion I downloaded a php replacement for the reg.cgi

                                and now I want to tell VideoPhoneLabs.mxml to get the cgi script in

                                dartwerks.com's html folder instead of the /cgi-bin/ folder. so I opened

                                VideoPhoneLabs in flash builder and did a search for cgi-bin since that

                                is the pathway I want to change. It gave me 6 hits, all of them

                                comments. Where is that pathway appended to the domain name??

                                 

                                So where in the VideoPhoneLabs.mxml code do I say that I now have the

                                cgi script in http://dartwerks.com/reg.php instead of in

                                http://dartwerks.com/cgi-bin/reg.cgi where it was originally.

                                 

                                Thanks.

                                 

                                joe dart

                                • 13. Re: reg.cgi
                                  joedart Community Member

                                  Michael

                                   

                                  whoops. I found it. In fact I found the basic problem too. I was only

                                  putting the domain name in the web service request. Now it is giving me

                                  a 500 error and that makes sense. As I have not personalized the code in

                                  the php script, it simply doesn't run and gives me a 500. Now maybe I

                                  make some progress. Thanks for all your help and patience. I read a

                                  number of your postings over the years. Glad I don't have your job.

                                   

                                  joe