htgen-paste: allow setting of Content-Type
This commit is contained in:
parent
d3b1504169
commit
40345c34bf
@ -15,8 +15,9 @@ abs_path=${Request_URI%%\?*}
|
|||||||
case "$Method $abs_path" in
|
case "$Method $abs_path" in
|
||||||
"GET /"[0-9a-z]*)
|
"GET /"[0-9a-z]*)
|
||||||
if item=$(find_item ${abs_path#/}); then
|
if item=$(find_item ${abs_path#/}); then
|
||||||
|
content_type=$(cat "$item".content_type 2>/dev/null || file -ib "$item")
|
||||||
printf 'HTTP/1.1 200 OK\r\n'
|
printf 'HTTP/1.1 200 OK\r\n'
|
||||||
printf 'Content-Type: %s\r\n' "$(file -ib $item)"
|
printf 'Content-Type: %s\r\n' "$content_type"
|
||||||
printf 'Server: %s\r\n' "$Server"
|
printf 'Server: %s\r\n' "$Server"
|
||||||
printf 'Connection: close\r\n'
|
printf 'Connection: close\r\n'
|
||||||
printf 'Content-Length: %d\r\n' $(wc -c < $item)
|
printf 'Content-Length: %d\r\n' $(wc -c < $item)
|
||||||
@ -45,6 +46,10 @@ case "$Method $abs_path" in
|
|||||||
cp -v $content $item >&2
|
cp -v $content $item >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -n ${reg_content_type-}; then
|
||||||
|
echo -n "$req_content_type" > "$item".content_type
|
||||||
|
fi
|
||||||
|
|
||||||
base32short=$(echo $base32 | cut -b-7)
|
base32short=$(echo $base32 | cut -b-7)
|
||||||
if item=$(find_item $base32short); then
|
if item=$(find_item $base32short); then
|
||||||
ref=$(echo "$ref"; echo "http://$req_host/$base32short")
|
ref=$(echo "$ref"; echo "http://$req_host/$base32short")
|
||||||
|
Loading…
Reference in New Issue
Block a user