mirror of
https://github.com/AskDavis/cyphernode.git
synced 2026-01-02 20:09:47 -08:00
First push from Satoshi Portal's own cyphernode
This commit is contained in:
21
proxy_docker/app/script/responsetoclient.sh
Normal file
21
proxy_docker/app/script/responsetoclient.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./trace.sh
|
||||
|
||||
response_to_client()
|
||||
{
|
||||
trace "Entering response_to_client()..."
|
||||
|
||||
local response=${1}
|
||||
local returncode=${2}
|
||||
|
||||
([ -z "${returncode}" ] || [ "${returncode}" -eq "0" ]) && echo -ne "HTTP/1.1 200 OK\r\n"
|
||||
[ -n "${returncode}" ] && [ "${returncode}" -ne "0" ] && echo -ne "HTTP/1.1 400 Bad Request\r\n"
|
||||
|
||||
echo -e "Content-Type: application/json\r\nContent-Length: ${#response}\r\n\r\n${response}"
|
||||
|
||||
# Small delay needed for the data to be processed correctly by peer
|
||||
sleep 0.2s
|
||||
}
|
||||
|
||||
case "${0}" in *responsetoclient.sh) response_to_client $@;; esac
|
||||
Reference in New Issue
Block a user