Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Back to the web server

  1. #1
    Orca Whisperer N1LAF's Avatar
    Join Date
    Jul 2007
    Location
    Ledyard, CT
    Posts
    13,937

    Back to the web server

    Programming a web server, you have to know a little bit about what to expect for incoming packets, and what to send back. My little web server is working, and thought to test with my iPod.

    The text was freaking small, unreadable without magnification. There has to be a simpler way. Fortunately, there is, and it is quite simple to detect mobile phones and send back the appropriate DOCTYPE.

    When the iPod sends a request for page, this is what is received:

    GET / HTTP/1.1
    Host: xxx.xxx.xxx.xxx
    User-Agent: Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16
    Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    Connection: keep-alive


    I can parse out "Mobile" as well as "iPod, iPhone, etc.. to flag mobile device.

    on the outgoing message, I select the appropriate DOCTYPE! for the MobileFlag:

    HTTP/1.1 200 OK
    Date: Tue, Nov 23, 2010 9:37:33 AM
    Server: PAFserver3
    Content-Type: text/html

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
    <html>
    <head>
    ...

    The text on the Safari browser on the iPod is easily readable.

    Soon, I will open this server to the internet for testing, using an obscure port number. Those who are interested on this project, let me know. I would like to sample other mobile devices to make sure I have a good capture code on what is Mobile, and what isn't.
    Last edited by N1LAF; 11-23-2010 at 09:43 AM. Reason: Removed Host Address

  2. #2
    Orca Whisperer N1LAF's Avatar
    Join Date
    Jul 2007
    Location
    Ledyard, CT
    Posts
    13,937
    Just FYI, a windows XP/Firefox request packet:

    GET / HTTP/1.1
    Host: xxx.xxx.xxx.xxx
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Connection: keep-alive
    Cache-Control: max-age=0

  3. #3
    Banned
    Join Date
    May 2009
    Posts
    9,698
    I have a Droid. Let me know when you want me to hit the server with it.

  4. #4
    Orca Whisperer n2ize's Avatar
    Join Date
    Dec 2007
    Location
    Crestwood, New York
    Posts
    33,899
    Any reason you wrote your own web server instead of using Apache or the hundreds (or maybe thousands) of other scaleable and highly configurable ones out there ?
    I keep my 2 feet on the ground, and my head in the twilight zone.

  5. #5
    Orca Whisperer N1LAF's Avatar
    Join Date
    Jul 2007
    Location
    Ledyard, CT
    Posts
    13,937
    Quote Originally Posted by n2ize View Post
    Any reason you wrote your own web server instead of using Apache or the hundreds (or maybe thousands) of other scaleable and highly configurable ones out there ?
    Because this will directly interact with programs I create. I can use a web browser to set parameters in my custom programs. Wait until I create a web interface for my radio, and do other cool stuff. It will be more than dishing out pages, and fully customizable.

  6. #6
    Orca Whisperer N1LAF's Avatar
    Join Date
    Jul 2007
    Location
    Ledyard, CT
    Posts
    13,937
    Quote Originally Posted by N2KKM View Post
    I have a Droid. Let me know when you want me to hit the server with it.
    Droid would be cool! Almost there... need to set my router to pass requests.

  7. #7
    Orca Whisperer N1LAF's Avatar
    Join Date
    Jul 2007
    Location
    Ledyard, CT
    Posts
    13,937
    Droid works... identified and sent proper DOCTYPE!

  8. #8
    Pope Carlo l NQ6U's Avatar
    Join Date
    Jun 2010
    Location
    Maritime Mobile
    Posts
    29,890
    I use an iPhone, but that would be the same user agent as your iPod.
    All the world’s a stage, but obviously the play is unrehearsed and everybody is ad-libbing his lines. Maybe that’s why it’s hard to tell if we’re living in a tragedy or a farce.

  9. #9
    Orca Whisperer n2ize's Avatar
    Join Date
    Dec 2007
    Location
    Crestwood, New York
    Posts
    33,899
    Quote Originally Posted by N1LAF View Post
    Because this will directly interact with programs I create. I can use a web browser to set parameters in my custom programs. Wait until I create a web interface for my radio, and do other cool stuff. It will be more than dishing out pages, and fully customizable.
    But couldn't you take your existing web server and rebuild it ? For instance you can take Apache and you can create a module to do almost anything. You wouldn't even have to rebuild it everytime and it would handle almost anything you can think of.
    I keep my 2 feet on the ground, and my head in the twilight zone.

  10. #10
    Orca Whisperer N1LAF's Avatar
    Join Date
    Jul 2007
    Location
    Ledyard, CT
    Posts
    13,937
    Quote Originally Posted by n2ize View Post
    But couldn't you take your existing web server and rebuild it ? For instance you can take Apache and you can create a module to do almost anything. You wouldn't even have to rebuild it everytime and it would handle almost anything you can think of.
    No, because I am using LabVIEW, and LabVIEW is it's own, distinct programming language. It is not text based.

Posting Permissions

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