Skip to content
Browse files

Parrot mini-web server now reads local files as binary instead of tex…

…t and closes file handles properly
  • Loading branch information...
1 parent bb8c98f commit f67488b1fef23ae6f0cafdcc67c9699cc913ff13 @azawawi azawawi committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 examples/io/httpd.pir
View
4 examples/io/httpd.pir
@@ -224,12 +224,12 @@ SERVE_file:
set_addr eh, handle_404_exception
eh.'handle_types'(.EXCEPTION_PIO_ERROR)
push_eh eh
- fp = open url, 'r'
+ fp = open url, 'rb'
pop_eh
unless fp goto SERVE_404
len = stat url, .STAT_FILESIZE
read file_content, fp, len
-
+ close fp
SERVE_blob:
response = '200 OK'
send_response(work, response, headers, file_content)

0 comments on commit f67488b

Please sign in to comment.
Something went wrong with that request. Please try again.