Commit 832c980776b9afd6e2aa0204c4348e76317e6016
1 parent
7d636ab8
new header for file_attached
Showing
2 changed files
with
13 additions
and
2 deletions
Show diff stats
calexium_lib/web/CXM_making_a_web_site.anubis
| ... | ... | @@ -1504,7 +1504,8 @@ public type HTTP_Answer: |
| 1504 | 1504 | String /*content*/), |
| 1505 | 1505 | custom_binary(HTTP_Status /*http_status*/, |
| 1506 | 1506 | String /*mime_type*/, |
| 1507 | - ByteArray /*content*/), | |
| 1507 | + ByteArray /*content*/, | |
| 1508 | + List(HTTP_header)/*other headers*/), | |
| 1508 | 1509 | custom_tree (HTTP_Status /*http_status*/, |
| 1509 | 1510 | String /*mime_type*/, |
| 1510 | 1511 | Printable_tree /*content*/), |
| ... | ... | @@ -4352,10 +4353,11 @@ define Printable_tree |
| 4352 | 4353 | crlf, |
| 4353 | 4354 | content . (Printable_tree)[] |
| 4354 | 4355 | ], |
| 4355 | - custom_binary(HTTP_Status status, String mime_type, ByteArray content) then | |
| 4356 | + custom_binary(HTTP_Status status, String mime_type, ByteArray content, List(HTTP_header) other_headers) then | |
| 4356 | 4357 | [ "HTTP/1.1 " + format(status), crlf, |
| 4357 | 4358 | format_headers(standard_headers), |
| 4358 | 4359 | format_headers(standard_headers_for(mime_type, length(content), failure)), |
| 4360 | + format_headers(other_headers), | |
| 4359 | 4361 | format_headers(additional_headers), |
| 4360 | 4362 | crlf, |
| 4361 | 4363 | content . (Printable_tree)[] | ... | ... |
calexium_lib/web/CXM_multihost_http_server.anubis
| ... | ... | @@ -2323,6 +2323,15 @@ public define List(HTTP_header) |
| 2323 | 2323 | http_header("Content-length", to_decimal(answer_body_size)) |
| 2324 | 2324 | ]. |
| 2325 | 2325 | |
| 2326 | +public define List(HTTP_header) | |
| 2327 | + file_attached_header | |
| 2328 | + ( | |
| 2329 | + String filename | |
| 2330 | + ) = | |
| 2331 | + [ | |
| 2332 | + http_header("Content-Disposition", "attachment; filename=\"" + filename +"\"") | |
| 2333 | + ]. | |
| 2334 | + | |
| 2326 | 2335 | |
| 2327 | 2336 | define One |
| 2328 | 2337 | www_url_answer | ... | ... |