Permalink
Browse files

detailed comments for things to consider in yaws_response_bridge

  • Loading branch information...
1 parent 4940ef2 commit ce3cf9e07838a9b312d639c3677d0c1a86e05f54 @choptastic committed Oct 24, 2011
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/yaws_bridge_modules/yaws_response_bridge.erl
@@ -29,18 +29,28 @@ build_response(_Arg, Res) ->
]);
{file, Path} ->
+ %% Note: This section should only be entered in the event that a static file is
+ %% requested that isn't found in the 'appmod' section of the yaws.conf file.
+ %% I've not found a way to "pass the buck" back to yaws and say "even though this
+ %% directory isn't found in the appmod, I want you to serve it anyway". This
+ %% means that with the current implementation, you don't want to be serving files
+ %% big files that aren't covered in the appmod section, primarily because this little
+ %% snippet loads the entire file into memory then passes it off to yaws to be served,
+ %% rather than streaming it. I'll need to look further into to either 1) Pass the buck
+ %% completely back to Yaws, or 2) how the streamcontent return types work as define in
+ %% yaws_server:handle_out_reply
%% Calculate expire date far into future...
Seconds = calendar:datetime_to_gregorian_seconds(calendar:local_time()),
TenYears = 10 * 365 * 24 * 60 * 60,
Seconds1 = calendar:gregorian_seconds_to_datetime(Seconds + TenYears),
ExpireDate = httpd_util:rfc1123_date(Seconds1),
- %OutSocket = yaws_api:arg_clisock(_Arg),
+ %% Docroot needed to find file in Path
Docroot = yaws_api:arg_docroot(_Arg),
-
FullPath = [Docroot,Path],
+ %% Get the content type as defined by yaws
ContentType = yaws_api:mime_type(Path),
%% Get the file content

0 comments on commit ce3cf9e

Please sign in to comment.