Skip to content
Snippets Groups Projects
Commit fe468eff authored by Junio C Hamano's avatar Junio C Hamano
Browse files

Merge branch 'mk/http-backend-content-length'

The earlier attempt barfed when given a CONTENT_LENGTH that is
set to an empty string.  RFC 3875 is fairly clear that in this
case we should not read any message body, but we've been reading
through to the EOF in previous versions (which did not even pay
attention to the environment variable), so keep that behaviour for
now in this late update.

* mk/http-backend-content-length:
  http-backend: allow empty CONTENT_LENGTH
parents c05048d4 574c513e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -353,7 +353,7 @@ static ssize_t get_content_length(void)
ssize_t val = -1;
const char *str = getenv("CONTENT_LENGTH");
 
if (str && !git_parse_ssize_t(str, &val))
if (str && *str && !git_parse_ssize_t(str, &val))
die("failed to parse CONTENT_LENGTH: %s", str);
return val;
}
Loading
Loading
Loading
Loading
@@ -153,4 +153,15 @@ test_expect_success 'CONTENT_LENGTH overflow ssite_t' '
grep "fatal:.*CONTENT_LENGTH" err
'
 
test_expect_success 'empty CONTENT_LENGTH' '
env \
QUERY_STRING=/repo.git/HEAD \
PATH_TRANSLATED="$PWD"/.git/HEAD \
GIT_HTTP_EXPORT_ALL=TRUE \
REQUEST_METHOD=GET \
CONTENT_LENGTH="" \
git http-backend <empty_body >act.out 2>act.err &&
verify_http_result "200 OK"
'
test_done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment