Uploaded image for project: 'Qt Cloud'
  1. Qt Cloud
  2. CLOUD-15

Simple HTTP Server

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P2: Important
    • None
    • None
    • Backend

    Description

      Related to #3.

      This webserver should listen to a specific port and receive incoming requests from Gitlab. Once the requests are received, based on the type of the event, it should show to the user in Qt creator UI - relevant updates.

      In future, it should also run any specific actions defined by the user.

      Example of such relevant updates are:

      • build finished
      • build failed, view details

      At this moment, we are using the Simple HTTP web server implementation from python with a custom router.

      Example code in our context:

      ```
      global webhook_path, webhook_token

      import http.server as CuteHttpServer
      import socketserver as CuteSocketServer
      from urllib.parse import urlparse as UrlParser
      from urllib.parse import parse_qs as QueryStringParser

      class CuteRouter (CuteHttpServer.SimpleHTTPRequestHandler):
      def do_GET (self):
      self.send_response(200)
      self.send_header("Content-type", "text/html")
      self.end_headers();
      self.wfile.write ("You asked for path: {0}".format(self.path))

      def do_POST (self):
      path = self.path
      path.startsWith("/gitlab-incoming"):

      1. get the token and check it with token generated earlier
        self.send_response (200)
        self.end_headers()
        self.wfile.write("OK")

      try:
      httpd_server = CuteSocketServer.TCPServer((host, port), CuteRouter)
      https_server.serve_forever()
      except KeyboardInterrupt:
      httpd_server.server_close()
      ```

      All relevant issues or tasks - related to HTTP Server should be created under this.

      Attachments

        Activity

          People

            as33ms Aseem Shakuntal
            anttisiukola Antti Siukola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: