]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_parsecfg: make get_line handle lines ending on the buffer boundary
authorDaniel Stenberg <daniel@haxx.se>
Fri, 11 Apr 2025 15:10:37 +0000 (17:10 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 11 Apr 2025 20:38:49 +0000 (22:38 +0200)
Add test 743 to verify.

Fixes #17030
Reported-by: Marius Kleidl
Closes #17031

src/tool_parsecfg.c
tests/data/Makefile.am
tests/data/test743 [new file with mode: 0644]

index 7a23f35944b8c8c4412f0904a29edc628c9a291d..b80b867cc8c2b7c318aaecf907ed3be08841de62 100644 (file)
@@ -312,6 +312,8 @@ static bool get_line(FILE *input, struct dynbuf *buf, bool *error)
       else if(feof(input))
         return TRUE; /* all good */
     }
+    else if(curlx_dyn_len(buf))
+      return TRUE; /* all good */
     else
       break;
   }
index bb316e38d49255279b128fc65ecb46ac4b3aec1c..56845230a930b67f73bfc3e9c9eaabfee8ec4988 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 \
+test736 test737 test738 test739 test740 test741 test742 test743 \
 \
 test780 test781 test782 test783 test784 test785 test786 test787 test788 \
 test789 test790 test791 \
diff --git a/tests/data/test743 b/tests/data/test743
new file mode 100644 (file)
index 0000000..fa86a13
--- /dev/null
@@ -0,0 +1,60 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+--config
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data crlf="yes">
+HTTP/1.1 200 OK
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+-foo-
+</data>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+--config with a 127 byte line
+</name>
+<file name="%LOGDIR/config" nonewline="yes">
+-A pointless
+data = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+</file>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER -K %LOGDIR/config
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol crlf="yes" nonewline="yes">
+POST /%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: pointless
+Accept: */*
+Content-Length: 118
+Content-Type: application/x-www-form-urlencoded
+
+%repeat[118 x x]%
+</protocol>
+</verify>
+</testcase>