Navigation Menu

Skip to content

Commit

Permalink
make balls::route echo to stdout
Browse files Browse the repository at this point in the history
rather than write to the socket directly
  • Loading branch information
jneen committed Jan 12, 2011
1 parent f35298c commit aa3d7ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions lib/router.sh
Expand Up @@ -53,21 +53,20 @@ balls::route() {
echo "$body"
)

echo "$response" >$http_sock
echo "$response"
}
# send the headers to the client
rm -f "$headers_sock"
else
if [[ "$REQUEST_METHOD" = "HEAD" ]]; then
REQUEST_METHOD=GET
balls::route
else
http::status 404 > $http_sock
http::content_type text/plain > $http_sock
http::body > $http_sock
http::status 404 3>&1
http::content_type text/plain 3>&1
echo
fi

echo "No route matched $REQUEST_METHOD $REQUEST_PATH" > $http_sock
echo > $http_sock
echo "No route matched $REQUEST_METHOD $REQUEST_PATH"
echo
fi
}
2 changes: 1 addition & 1 deletion lib/server.sh
Expand Up @@ -12,7 +12,7 @@ balls::server() {
while true; do
cat $http_sock | nc -l -p $BALLS_PORT | (
http::parse_request
balls::route
balls::route > $http_sock
)
done
}
Expand Down

0 comments on commit aa3d7ed

Please sign in to comment.