提交 f74a83fc 编写于 作者: B Brian Gernhardt 提交者: Junio C Hamano

t/gitweb-lib: Split HTTP response with non-GNU sed

Recognizing \r in a regex is something GNU sed will do, but other sed
implementation's won't (e.g. BSD sed on OS X).  Instead of two sed
invocations, use a single Perl script to split output into headers
and body.
Signed-off-by: NBrian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b629275f
...@@ -52,8 +52,18 @@ gitweb_run () { ...@@ -52,8 +52,18 @@ gitweb_run () {
rm -f gitweb.log && rm -f gitweb.log &&
perl -- "$SCRIPT_NAME" \ perl -- "$SCRIPT_NAME" \
>gitweb.output 2>gitweb.log && >gitweb.output 2>gitweb.log &&
sed -e '/^\r$/q' <gitweb.output >gitweb.headers && perl -w -e '
sed -e '1,/^\r$/d' <gitweb.output >gitweb.body && open O, ">gitweb.headers";
while (<>) {
print O;
last if (/^\r$/ || /^$/);
}
open O, ">gitweb.body";
while (<>) {
print O;
}
close O;
' gitweb.output &&
if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi
# gitweb.log is left for debugging # gitweb.log is left for debugging
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册