Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt webserver with POST support
Forum Updated to NodeBB v4.3 + New Features

Qt webserver with POST support

Scheduled Pinned Locked Moved General and Desktop
webserverpost
8 Posts 3 Posters 3.9k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xtingray
    wrote on 18 May 2015, 23:26 last edited by
    #1

    Hi,
    Currently I am implementing a webserver using the QTcpServer class. The basic feature is working pretty well but now I have to support the management of POST requests. For now, I am able to read the header of the client request, but I can't have access to the variables attached to it. Is there any way to implement this feature using Qt?

    I really appreciate any hint. Thanks!


    Qt Developer

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 18 May 2015, 23:43 last edited by mcosta
      #2

      Hi,

      HTTP doesn't define the format of Request body; here you can see an example (after the headers there'a a blank line and after the body).

      This means that, after the header, you'll find a blank line and the body; the format of the body depends on your interface (the most common formats for body are Text, XML and JSON)

      NOTE: if you're writing the server, you have to define the format of the body

      UPDATE: here you'll find more information

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xtingray
        wrote on 20 May 2015, 14:16 last edited by
        #3

        Thank you so much for your answer. Very handy resources! :D


        Qt Developer

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on 20 May 2015, 14:17 last edited by
          #4

          You're welcome,

          Happy coding

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cybercatalyst
            wrote on 21 May 2015, 06:39 last edited by cybercatalyst
            #5

            @xtingray

            I have written a more powerful framework than doing everything from scratch with QTcpServer, might check it out here:

            https://github.com/cybercatalyst/qtwebserver

            And here are examples how to easily use it in your project:

            https://github.com/cybercatalyst/qtwebserver-examples

            Not only does it handle all kind of methods, but also decodes form data and support https out of the box. I wrote it originally to suit my needs, but it has evolved since, so I have have cleaned up the code and generalized it for others to be used.

            1 Reply Last reply
            0
            • X Offline
              X Offline
              xtingray
              wrote on 21 May 2015, 13:10 last edited by
              #6

              Damn it! I was looking for something like this and just found it when I already implemented what I need. Will be your class QtWebServer a future native component of Qt?

              Anyway, nice to see this kind of resources for future developments. Great contribution, congratulations! :)


              Qt Developer

              C 1 Reply Last reply 21 May 2015, 13:16
              0
              • X xtingray
                21 May 2015, 13:10

                Damn it! I was looking for something like this and just found it when I already implemented what I need. Will be your class QtWebServer a future native component of Qt?

                Anyway, nice to see this kind of resources for future developments. Great contribution, congratulations! :)

                C Offline
                C Offline
                cybercatalyst
                wrote on 21 May 2015, 13:16 last edited by cybercatalyst
                #7

                @xtingray
                I think that currently it's not close to being ready for integration into the official framework, but it is optionally being distributed through qt-pods (a standardized package system for smaller, inofficial Qt extensions). See here for more info:

                https://github.com/qt-pods/qt-pods

                The aim of qt-pods (inspired by cocoapods from MacOS) is to have foreign code included in your project with a single click through standardized means. It's in early stage though.

                1 Reply Last reply
                0
                • X Offline
                  X Offline
                  xtingray
                  wrote on 21 May 2015, 13:25 last edited by xtingray
                  #8

                  I had no idea about the qt-pods. Thank you for the handy information. It's incredible how I am learning things every time I check this forum XD


                  Qt Developer

                  1 Reply Last reply
                  0

                  5/8

                  21 May 2015, 06:39

                  • Login

                  • Login or register to search.
                  5 out of 8
                  • First post
                    5/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved