×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    http request from the cell to itself

    what i am trying to do is send an http request from a python program on my nokia phone to a something.mymobilesite.net address which would be redirected to the mobile web server running on the same nokia.
    but as you guessed, it doesn't work, i can connect to any other homepage and the server is running (aka i can connect through a browser on my pc), is there some reason why i can't do this or is there a way to do it?
    it's a pretty essential thing of my project and doing it within the cell and not going over http is not an option.

    thanks in advance

    /edit
    so i tested around a bit more and the best i currently get when trying an https connection using httplib is an html page saying: "access control configuration prevents your request from being allowed at this time (...)"
    Last edited by zarzu; 2009-05-02 at 05:18.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: http request from the cell to itself

    Quote Originally Posted by zarzu View Post
    ...
    is there some reason why i can't do this or is there a way to do it?
    As long as you are trying to do that from a separate program and not from a HTTP request handler, there is nothing in principle that prevents you from doing that. If you try to do that from a HTTP request handler on the device that you intend to access you will cause a deadlock, since currently Apache on Symbian is single-threaded.

    Somewhere, either on the MWS UI or the site, you can specify that HTTP access (in addition to HTTPS) to your device is allowed. If you turn that on you can bypass the access-control problems you now seem to be facing.

    Br,
    Johan

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    20

    Re: http request from the cell to itself

    Hi zarzu.

    I've got couple of questions for you...

    Have you tried accessing your own device using address http://127.0.0.1 ? Did I get it right that you are sending the requests to the same device? Was there some reason that you really need to use the something.mymobilesite.net address ("within the cell not an option" comment in your post)?

    What kind of authentication are you using in your server? If you are not accessing public content, how are you providing the credentials in your python program? One possibility is to add username and password to url (https://user:password@something.mymobilesite.net).

  4. #4
    Registered User
    Join Date
    Nov 2008
    Posts
    24

    Re: http request from the cell to itself

    Quote Originally Posted by jhnwkmn View Post
    If you try to do that from a HTTP request handler on the device that you intend to access you will cause a deadlock, since currently Apache on Symbian is single-threaded.
    Do you mean by that, that is not possible for example to create Mashups from resources existing in the same MWS?
    I mean,
    imagine I have an REST API in my mobile web server that has the service getinformation.py, which gives the home location of all my contacts.

    Could I now call a mashup.py that consumes getinformation.py to create a google Maps presentation combining both sercices?

    In this case, I should need two threads, one for the client calling mashup.py, and another for the mashup.py calling http://127.0.0.1/information.py

    Would that create a deadlock? I hope I missunderstood your explanation.

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: http request from the cell to itself

    Quote Originally Posted by didacgil9 View Post
    ...
    Could I now call a mashup.py that consumes getinformation.py to create a google Maps presentation combining both sercices?
    If that mashup.py, running as a request handler under your MWS, would call getinformation.py via the REST API exposed by your same MWS, then currently that would cause a deadlock. Well, probably some timers somewhere would fire at some point and the operation would be aborted.

    If mashup.py is not running under MWS, then there is no problem.
    In this case, I should need two threads, one for the client calling mashup.py, and another for the mashup.py calling http://127.0.0.1/information.py
    Yes, and thread support is there but, as it is a bit shaky, disabled in MWS. If you want to try it out, then open .../conf/httpd.conf and tinker with the following
    Code:
    # The following settings affect the performance and resource
    # consumption of the server:
    #
    #     ThreadLimit
    #     MinSpareThreads
    #     MaxSpareThreads
    #     StartThreads
    #     MaxRequestsPerThread
    #     ThreadStackSize
    #     MaxMemFree
    #
    
    # 
    # ThreadLimit: The maximum number of threads, i.e. the maximum
    # number of _concurrently_served_ clients.
    #
    #  Min:      1
    #  Max:     16
    #  Default:  4
    #
    # NOTE: If mod_php is loaded, then the ThreadLimit will
    #       always be adjusted down to 1, as PHP is currently 
    #       not MT compatible.
    #
    #ThreadLimit 4
    
    #
    # MinSpareThreads: The minimum number of spare threads, i.e. idle
    # threads that can handle sudden request spikes. If the number of
    # idle threads drops below this value, then more will be created.
    #
    #  Min:      1
    #  Max:      Value of ThreadLimit - 1
    #  Default:  1
    #
    # The default value of 1 means in practice that unless the maximum
    # number of threads has been fixed at 1, there will always be at
    # least 2 threads.
    #
    #MinSpareThreads 1
    
    #
    # MaxSpareThreads: The maximum number of spare threads, i.e. idle
    # threads that can handle sudden request spikes. If the number of
    # idle threads grows above this number, then threads will be killed.
    #
    #  Min:      1
    #  Max:      Value of ThreadLimit - 1
    #  Default:  1
    #
    # The default value of 1 means in practice that unless the maximum
    # number of threads has been fixed at 1, there will always be at
    # least 2 threads.
    #
    #MaxSpareThreads 1
    
    #
    # StartThreads: The number of threads that should be started at
    # startup.
    #
    #  Min:     1
    #  Max:     Value of ThreadLimit
    #  Default: 1
    # 
    #StartThreads 1
    
    #
    # MaxRequestsPerThread: The maximum number of requests a thread may 
    # handle before it should exit. A new thread is created in its stead.
    #
    #  Min:     0      (no upper limit)
    #  Max:     maxint
    #  Default: 0
    #
    #MaxRequestsPerThread 0
    
    #
    # ThreadStackSize: The stacksize (in BYTES) of each thread handling
    # client connections.
    #
    #  Default: 0
    #
    # The default value of 0 means that the system default is used.
    # Currently the default is 0x10000.
    #
    #ThreadStackSize 0
    
    #
    # MaxMemFree: The maximum number of free KILOBYTES that the
    # allocators are allowed to hold before freeing the memory.
    #
    #  Default: 0   (no limit)
    #
    # Without a limit, the amount of memory reserved by Apache can
    # only grow, but never shrink.
    #
    #MaxMemFree 0
    Johan

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: http request from the cell to itself

    hey, thanks for the answers everyone, i kind of abandoned this thread after 2 days of no answers and tried a different approach which worked.

    anyway, so the thing of mws being single threaded is obviously not so great, but it wouldn't have been a problem since i was actually sending the request from an outside program on my device.
    i haven't tried allowing http access yet (didn't know it was possible) but i will check it out sometime.

    i have tried localhost and it didn't work.
    i have the whole thing set up without authentication and actually tried to access it with https://user:password@... which didn't make any difference.
    the reason why i needed it to go over http is because the whole thing is a rest interface and the whole sense behind having a rest interface is to actually work with the interface you provide.

    what i was actually trying to implement is a trigger system which checks some url and if there is a resource located at that place, it will do something. for example:
    the rest interface supports an url like: /bluetooth/inquiries/(mac adress),last 2m
    now whenever the specified mac address has been close to the device in the last 2 minutes, this resource will be present and the system would then send some post request to the device (like one that makes it beep).
    the whole thing would have been running on the device, querying it's own rest interface, as that didn't work i just implemented it in java and have it running on my computer atm, the centralized version is obviously far uglier though, but doesn't matter too much atm, it's just a project for college.

  7. #7
    Registered User
    Join Date
    Mar 2009
    Posts
    8

    Re: http request from the cell to itself

    this is kind of awkward but some days ago when i thought about this stuff again, i remembered that even though i needed to access the http port with another program i did actually test it in a request handler because i already had it open and didn't feel like creating a new project... so yea /selfbonk

Similar Threads

  1. Sending HTTP GET request with body
    By moldovan_catalin in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2009-01-13, 18:49
  2. HTTP Post request structure
    By alav in forum Symbian Networking & Messaging (Closed)
    Replies: 7
    Last Post: 2008-08-12, 10:49
  3. asynchronus http request and crash in application
    By vinayakak in forum Symbian C++
    Replies: 1
    Last Post: 2008-02-06, 05:39
  4. How can I call http session simultaneously?
    By gusta72 in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2006-10-19, 19:58
  5. Http get request problem
    By white_dragon in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-12-08, 10:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •