Ginés Martínez Sánchez avatar Ginés Martínez Sánchez committed 67efcb2 Draft

developing http server

Comments (0)

Files changed (3)

Add a comment to this file

docs/src/api/wsgi-server.png

Old
Old image
New
New image

ginsfsm/protocols/http/common/response.py

                 'EV_WRITE_OUTPUT_DATA',
                 b'0\r\n\r\n'
             )
+        if self.close_on_finish:
+            self.gsock.close_when_flushed = True
+        self.request._close()
         self.channel.send_event(self.gsock, 'EV_FLUSH_OUTPUT_DATA')
 
     def write(self, data):

ginsfsm/protocols/http/server/c_http_clisrv.py

 
 def ac_http_request(self, event):
     self.stop_inactivity_timer()
+
+    if self.responding_request.error:
+        response = HttpErrorResponse(self.responding_request)
+        response.service()
+        self.clear_request_queue()
+        return
+
     self.start_responseless_timer()
     # TODO: in stratus environment, we need to inform of who srvcli is.
     self.broadcast_event(
 def ac_http_response(self, event):
     response = event.response
     self.stop_responseless_timer()
-    # send response to client
-    response.service()
+    response.service()  # send response to client
     self.responding_request = None
 
     # pull the request queue
                     self.maximum_simultaneous_requests)
             request = HTTPRequestParser(self)
             request.error = InternalServerError(body)
-            task = HttpErrorResponse(self.identity, self.gsock, request)
-            task.service()
-            self.dl_requests.clear()
+            response = HttpErrorResponse(self.identity, self.gsock, request)
+            response.service()
+            self.clear_request_queue()
+
+    def clear_request_queue(self):
+        for request in self.dl_requests:
+            request._close()
+        self.dl_requests.clear()
 
     def start_inactivity_timer(self):
         self.send_event(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.