diff options
| author | Dave Hibberd <hibby@debian.org> | 2025-02-03 22:19:01 +0000 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2025-02-03 22:19:01 +0000 |
| commit | 488e218d34eaea6d5930cb14fcb77187450fb9df (patch) | |
| tree | 992a75adf3a43b2d30406354fe50b546ca9d064a /HTTPcode.c | |
| parent | 3efea8aa1044f8157c3ed4bdf03471feec934f9c (diff) | |
| parent | 64d58d0c5a01551f8bfc52291986d1b8d681aca5 (diff) | |
Update upstream source from tag 'upstream/6.0.24.59a+repack'
Update to upstream version '6.0.24.59a+repack'
with Debian dir 618298da94ae61a579ac668b172d2edb43c7666b
Diffstat (limited to 'HTTPcode.c')
| -rw-r--r-- | HTTPcode.c | 43 |
1 files changed, 39 insertions, 4 deletions
@@ -24,7 +24,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #define DllImport
-#include "CHeaders.h"
+#include "cheaders.h"
#include <stdlib.h>
#include "tncinfo.h"
@@ -70,6 +70,7 @@ char * GetStandardPage(char * FN, int * Len); BOOL SHA1PasswordHash(char * String, char * Hash);
char * byte_base64_encode(char *str, int len);
int APIProcessHTTPMessage(char * response, char * Method, char * URL, char * request, BOOL LOCAL, BOOL COOKIE);
+int RHPProcessHTTPMessage(struct ConnectionInfo * conn, char * response, char * Method, char * URL, char * request, BOOL LOCAL, BOOL COOKIE);
extern struct ROUTE * NEIGHBOURS;
extern int ROUTE_LEN;
@@ -1852,6 +1853,43 @@ int InnerProcessHTTPMessage(struct ConnectionInfo * conn) }
}
+ if (_memicmp(Context, "/rhp/", 5) == 0 || _stricmp(Context, "/rhp") == 0)
+ {
+ {
+ ReplyLen = RHPProcessHTTPMessage(conn, _REPLYBUFFER, Method, Context, MsgPtr, LOCAL, COOKIE);
+
+ if (memcmp(_REPLYBUFFER, "HTTP", 4) == 0)
+ {
+ // Full Message - just send it
+
+ sendandcheck(sock, _REPLYBUFFER, ReplyLen);
+
+ return 0;
+ }
+
+ if (allowDeflate)
+ Compressed = Compressit(_REPLYBUFFER, ReplyLen, &ReplyLen);
+ else
+ Compressed = _REPLYBUFFER;
+
+ HeaderLen = sprintf(Header, "HTTP/1.1 200 OK\r\n"
+ "Content-Length: %d\r\n"
+ "Content-Type: application/json\r\n"
+ "Connection: close\r\n"
+ "Access-Control-Allow-Origin: *\r\n"
+ "%s\r\n", ReplyLen, Encoding);
+
+ sendandcheck(sock, Header, HeaderLen);
+ sendandcheck(sock, Compressed, ReplyLen);
+
+ if (allowDeflate)
+ free (Compressed);
+
+ return 0;
+ }
+ }
+
+
// APRS process internally
if (_memicmp(Context, "/APRS/", 6) == 0 || _stricmp(Context, "/APRS") == 0)
@@ -5135,6 +5173,3 @@ void SHA1PadMessage(SHA1Context *context) }
-
-
-
|
