check_chunked revision b8d55029467b9f139d081cf38c6d06ff45e742a9
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# Copyright 2000-2004 Apache Software Foundation
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User# Licensed under the Apache License, Version 2.0 (the "License");
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User# you may not use this file except in compliance with the License.
8c225507766814e78e168b17a24b8a47ca7f8c37Tinderbox User# You may obtain a copy of the License at
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User# Unless required by applicable law or agreed to in writing, software
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# distributed under the License is distributed on an "AS IS" BASIS,
1c57c3f79db0bf0358bbe6d7b5ad650c0c852f4bTinderbox User# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# See the License for the specific language governing permissions and
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# limitations under the License.
38a5df33f461f2379639ef95d282d3658f68ed04Tinderbox User# This is meant to be used on the raw output of an HTTP/1.1 connection
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# to check that the chunks are all correctly laid out. It's easiest
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# to use a tool like netcat to generate the output. This script
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# *insists* that \r exist in the output.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# You can find netcat at avian.org:/src/hacks/nc110.tgz.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# must toss headers
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User m#^([0-9a-f]+) *\r$#i || die "bogus chunklen: $_";
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User read(ARGV, $data, $chunklen) == $chunklen || die "short read!\n";
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User $_ eq "\r\n" || die "missing chunk trailer!\n";