Results 1 to 5 of 5

Thread: Build an HTTP server

  1. #1
    Join Date
    Sep 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Build an HTTP server

    Is there a way to embed an HTTP server into my QT4 cross-platform (Linux and Win) application?
    I'd like to answer to GET/POST requests from the net when my application is running.

    Can I use QHTTP or I have to use an external library? Any suggestion?

    Thanks,
    the_bis

  2. #2
    Join Date
    Jan 2006
    Posts
    128
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Build an HTTP server

    You would have to write it yourself, as QHttp is client only..

    What do you need it for?
    (I have written a Qt4 Http-Server, but it is not as complete, not documented as I would like...but maybe you could use it...depending on your use-case...)

  3. #3
    Join Date
    Sep 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Build an HTTP server

    Quote Originally Posted by camel View Post
    You would have to write it yourself, as QHttp is client only..
    Ok, so this is the problem.

    Quote Originally Posted by camel View Post
    What do you need it for?
    I have to answer to "wget" command request to distribute binary files. Very very simple.

    Quote Originally Posted by camel View Post
    (I have written a Qt4 Http-Server, but it is not as complete, not documented as I would like...but maybe you could use it...depending on your use-case...)
    This is very interesting, thanks. I can try to use it in my application.
    Before you send me the code you have to know that maybe, in the future, my application will be a closed QT application (not opensource)...

    Let me say if you agree with me and if you can send me the source code,
    thanks again,
    the_bis

  4. #4
    Join Date
    Jan 2006
    Posts
    128
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Build an HTTP server

    Quote Originally Posted by the_bis View Post
    I have to answer to "wget" command request to distribute binary files. Very very simple.
    Ok, the GET part is really easy, you would not need the server I have written for it, as it would be overkill. (I would imaging you do not need pipelining/multithreadding and all that stuff ;-)

    But a very simple server (tailored to your needs) is not too hard to write:
    • Create a TcpServer,
    • listen for requests,
    • read the request,
    • parse the request using QHttpRequestHeader,
    • analyze it,
    • send the response header
    • send the file (i.e. read from a qfile and copy the bytes to the socket)
    • close the connection


    To learn a bit about Http check out this page: HTTP Made Really Easy


    Quote Originally Posted by the_bis View Post
    This is very interesting, thanks. I can try to use it in my application.
    Before you send me the code you have to know that maybe, in the future, my application will be a closed QT application (not opensource)...
    There would be a problem since my server is (and will stay that way at least until I am satisfied with it) under the GPL.

  5. #5
    Join Date
    Sep 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Build an HTTP server

    Quote Originally Posted by camel View Post
    Ok, the GET part is really easy, you would not need the server I have written for it, as it would be overkill. (I would imaging you do not need pipelining/multithreadding and all that stuff ;-)

    But a very simple server (tailored to your needs) is not too hard to write:
    • Create a TcpServer,
    • listen for requests,
    • read the request,
    • parse the request using QHttpRequestHeader,
    • analyze it,
    • send the response header
    • send the file (i.e. read from a qfile and copy the bytes to the socket)
    • close the connection


    To learn a bit about Http check out this page: HTTP Made Really Easy
    Ok, thank you very much.

    Quote Originally Posted by camel View Post
    There would be a problem since my server is (and will stay that way at least until I am satisfied with it) under the GPL.
    I understand and I agree with your choice

    Bye,
    the_bis

Similar Threads

  1. How a server can write "Hello" to a browser ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2006, 14:43
  2. Sql Server cannot retrieve data from select
    By Atomino in forum Qt Programming
    Replies: 10
    Last Post: 7th September 2006, 16:37
  3. QMAKE: Specifying Build Dependencies
    By JohnSuykerbuyk in forum Qt Programming
    Replies: 1
    Last Post: 5th May 2006, 09:46
  4. synching client readings to server output
    By OnionRingOfDoom in forum Qt Programming
    Replies: 14
    Last Post: 28th January 2006, 18:15
  5. http trouble again, segfaults when no internet
    By Bojan in forum Qt Programming
    Replies: 6
    Last Post: 18th January 2006, 20:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.