summaryrefslogtreecommitdiffstats
path: root/src/ogClient.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-06-13 10:51:42 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-06-14 14:50:55 +0200
commit0c03d82ca8792e5e0c41460f3aa5cdf6990a3412 (patch)
tree10e7e6d2433a46c945b6ffa3e7e574264b3295cb /src/ogClient.py
parent926a73cf33896ae62f8255a8f2aca2e0d9a54038 (diff)
ogclient: add support for X-Sequence headerv1.3.0
Enable parsing of "X-Sequence" HTTP headers from incoming requests. Add "seq" field in restRequest class. Enable adding "X-Sequence" to outgoing responses. Add "seq" field inside restResponse class. Store current client sequence number inside ogClient class. Ideally, the restRequest object should be used to retrieve the sequence number but not all processing functions inside ogRest.py receive the request as parameter (eg: process_refresh). In the other hand, all processing functions receive the ogClient object.
Diffstat (limited to 'src/ogClient.py')
-rw-r--r--src/ogClient.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ogClient.py b/src/ogClient.py
index 04b6d01..31ee5d3 100644
--- a/src/ogClient.py
+++ b/src/ogClient.py
@@ -47,6 +47,7 @@ class ogClient:
self.ip = self.CONFIG['opengnsys']['ip']
self.port = self.CONFIG['opengnsys']['port']
self.ogrest = ogRest(self.CONFIG)
+ self.seq = None
def get_socket(self):
return self.sock
@@ -144,6 +145,8 @@ class ogClient:
if 'Content-Length' in headers.keys():
self.content_len = int(headers['Content-Length'])
+ if 'X-Sequence' in headers.keys():
+ self.seq = int(headers['X-Sequence'])
self.trailer = True
# Add 4 because self.data.find("\r\n\r\n") does not count