File tree 1 file changed +2
-6
lines changed
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ function dbg() {
11
11
}
12
12
self=" $0 "
13
13
read -r method path http
14
- dbg test
15
14
16
15
source_ip=unknown
17
16
while read -r line; do
@@ -43,7 +42,6 @@ function content_type() {
43
42
44
43
function content_length() {
45
44
echo " Content-Length: $1 "
46
- dbg " Sending content length of $1 "
47
45
}
48
46
49
47
function end_headers() {
@@ -56,11 +54,9 @@ function resolve_file() {
56
54
57
55
function send_file() {
58
56
filename=" $( resolve_file " $1 " ) "
59
- dbg Trying to send " $filename "
60
57
content_length $( wc -c " $filename " | cut -d ' ' -f 1)
61
58
end_headers
62
59
cat < " $filename "
63
- dbg Finished sending file
64
60
}
65
61
66
62
function send_heredoc() {
@@ -81,6 +77,7 @@ function send_file_if_exists() {
81
77
}
82
78
83
79
function send_404() {
80
+ dbg 404 hit by $source_ip
84
81
begin_response 404 " Not Found"
85
82
content_type " text/html"
86
83
send_heredoc << -'EOF '
@@ -163,7 +160,7 @@ case "$path" in
163
160
}
164
161
'
165
162
json=" $( jq -n --arg report " Shiggy # $shiggy_id has been reported" --arg ip " $source_ip " " $structure " ) "
166
- curl $REPORT_WEBHOOK -X POST -H " Content-Type: multipart/form-data" -F " payload_json=$json " -F' files[0]=@' " posts/$shiggy_id ;filename=SPOILER_shiggy.png" >&2
163
+ curl $REPORT_WEBHOOK -X POST -H " Content-Type: multipart/form-data" -F " payload_json=$json " -F' files[0]=@' " posts/$shiggy_id ;filename=SPOILER_shiggy.png" >&2
167
164
begin_response 200 Found
168
165
content_type text/html
169
166
send_heredoc << EOF
214
211
send_file 404.png
215
212
;;
216
213
* )
217
- dbg " $path " does not match what i expected
218
214
send_404
219
215
;;
220
216
esac
You can’t perform that action at this time.
0 commit comments