From: Cole Helbling Date: Sat, 12 Apr 2025 04:37:11 +0000 (-0700) Subject: curl_get_line: handle lines ending on the buffer boundary X-Git-Tag: curl-8_14_0~296 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=2404a11d85ba8876092a1e7cf5285235156d66cd;p=thirdparty%2Fcurl.git curl_get_line: handle lines ending on the buffer boundary Very similar to 9f8bdd0eae5c1d441d9d901a7cf917a8ee215c7f, but affects e.g. netrc file parsing. Suggested-by: Graham Christensen Add test 744 to verify Closes #17036 --- diff --git a/lib/curl_get_line.c b/lib/curl_get_line.c index 7ee3b65af7..9ed1f05e24 100644 --- a/lib/curl_get_line.c +++ b/lib/curl_get_line.c @@ -70,6 +70,8 @@ int Curl_get_line(struct dynbuf *buf, FILE *input) return 1; /* all good */ } } + else if(Curl_dyn_len(buf)) + return 1; /* all good */ else break; } diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 56845230a9..1ed9ccfab9 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -107,7 +107,7 @@ test700 test701 test702 test703 test704 test705 test706 test707 test708 \ test709 test710 test711 test712 test713 test714 test715 test716 test717 \ test718 test719 test720 test721 test722 test723 test724 test725 test726 \ test727 test728 test729 test730 test731 test732 test733 test734 test735 \ -test736 test737 test738 test739 test740 test741 test742 test743 \ +test736 test737 test738 test739 test740 test741 test742 test743 test744 \ \ test780 test781 test782 test783 test784 test785 test786 test787 test788 \ test789 test790 test791 \ diff --git a/tests/data/test744 b/tests/data/test744 new file mode 100644 index 0000000000..4a22d51ec4 --- /dev/null +++ b/tests/data/test744 @@ -0,0 +1,78 @@ + + + +HTTP +--netrc-file + + + +# +# Server-side + + +HTTP/1.1 200 OK +Date: Tue, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Content-Type: text/html +Funny-head: yesyes +Content-Length: 9 + +contents + + +HTTP/1.1 200 Mighty fine indeed + + + +HTTP/1.1 200 Mighty fine indeed + +HTTP/1.1 200 OK +Date: Tue, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Content-Type: text/html +Funny-head: yesyes +Content-Length: 9 + +contents + + + +# +# Client-side + + +http +http-proxy + + +--netrc-file with a 127 byte line + + +machine foo.host login foo password baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar + + +http://foo.host:%HTTPPORT/%TESTNUMBER -p --proxy1.0 %HOSTIP:%PROXYPORT -A "" --netrc-file %LOGDIR/netrc%TESTNUMBER + + +proxy + + + +# +# Verify data after the test has been "shot" + + +CONNECT foo.host:%HTTPPORT HTTP/1.0 +Host: foo.host:%HTTPPORT +Proxy-Connection: Keep-Alive + + + +GET /%TESTNUMBER HTTP/1.1 +Host: foo.host:%HTTPPORT +Authorization: Basic Zm9vOmJhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYXI= +Accept: */* + + + +