]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl_get_line: handle lines ending on the buffer boundary
authorCole Helbling <cole.e.helbling@outlook.com>
Sat, 12 Apr 2025 04:37:11 +0000 (21:37 -0700)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 15 Apr 2025 15:48:32 +0000 (17:48 +0200)
Very similar to 9f8bdd0eae5c1d441d9d901a7cf917a8ee215c7f, but affects
e.g. netrc file parsing.

Suggested-by: Graham Christensen <graham@grahamc.com>
Add test 744 to verify

Closes #17036

lib/curl_get_line.c
tests/data/Makefile.am
tests/data/test744 [new file with mode: 0644]

index 7ee3b65af77f123f904ac50314850325005d5e65..9ed1f05e245fd0b91f9f3adfa78ff7c2415e19f1 100644 (file)
@@ -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;
   }
index 56845230a930b67f73bfc3e9c9eaabfee8ec4988..1ed9ccfab995a8e4ebb10e05b6edcd85ecf88146 100644 (file)
@@ -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 (file)
index 0000000..4a22d51
--- /dev/null
@@ -0,0 +1,78 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+--netrc-file
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data>
+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
+</data>
+<connect>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+</connect>
+<datacheck>
+HTTP/1.1 200 Mighty fine indeed\r
+\r
+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
+</datacheck>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+http-proxy
+</server>
+<name>
+--netrc-file with a 127 byte line
+</name>
+<file name="%LOGDIR/netrc%TESTNUMBER" nonewline="yes">
+machine foo.host login foo password baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar
+</file>
+<command>
+http://foo.host:%HTTPPORT/%TESTNUMBER -p --proxy1.0 %HOSTIP:%PROXYPORT -A "" --netrc-file %LOGDIR/netrc%TESTNUMBER
+</command>
+<features>
+proxy
+</features>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<proxy>
+CONNECT foo.host:%HTTPPORT HTTP/1.0\r
+Host: foo.host:%HTTPPORT\r
+Proxy-Connection: Keep-Alive\r
+\r
+</proxy>
+<protocol>
+GET /%TESTNUMBER HTTP/1.1\r
+Host: foo.host:%HTTPPORT\r
+Authorization: Basic Zm9vOmJhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYXI=\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>