Permalink
Browse files

make balls::route echo to stdout

rather than write to the socket directly
  • Loading branch information...
1 parent f35298c commit aa3d7edb530bdd7262bed40d8fe6faaf39e46d0f @jneen committed Jan 12, 2011
Showing with 7 additions and 8 deletions.
  1. +6 −7 lib/router.sh
  2. +1 −1 lib/server.sh
View
@@ -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
}
View
@@ -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
}

0 comments on commit aa3d7ed

Please sign in to comment.