diff --git a/Cargo.lock b/Cargo.lock index 330d9292b..df5157384 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,8 +563,8 @@ name = "hurl_core" version = "4.1.0-SNAPSHOT" dependencies = [ "float-cmp", + "libxml", "regex", - "sxd-document", ] [[package]] @@ -810,12 +810,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" -[[package]] -name = "peresil" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57" - [[package]] name = "pkg-config" version = "0.3.27" @@ -1091,16 +1085,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "sxd-document" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d82f37be9faf1b10a82c4bd492b74f698e40082f0f40de38ab275f31d42078" -dependencies = [ - "peresil", - "typed-arena", -] - [[package]] name = "syn" version = "2.0.32" @@ -1171,12 +1155,6 @@ dependencies = [ "serde", ] -[[package]] -name = "typed-arena" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" - [[package]] name = "typenum" version = "1.16.0" diff --git a/integration/tests_ok/post_xml.curl.ignore b/integration/tests_ok/post_xml.curl.ignore deleted file mode 100644 index 9b73dac9d..000000000 --- a/integration/tests_ok/post_xml.curl.ignore +++ /dev/null @@ -1,2 +0,0 @@ -curl 'http://localhost:8000/post-xml' --header 'Content-Type: application/xml' --data $'\ncafé' -curl 'http://localhost:8000/post-xml-no-prolog' --header 'Content-Type: application/xml' --data 'café' diff --git a/integration/tests_ok/post_xml.html b/integration/tests_ok/post_xml.html index 185dd41a6..6be36c0f5 100644 --- a/integration/tests_ok/post_xml.html +++ b/integration/tests_ok/post_xml.html @@ -1,15 +1,626 @@ -
# POST the following XML
-# <?xml version="1.0"?>
-# <drink>café</drink>
-POST http://localhost:8000/post-xml
+
POST http://localhost:8000/post-xml
 <?xml version="1.0"?>
 <drink>café</drink>
-
-HTTP 200
+HTTP 200
 
 
 POST http://localhost:8000/post-xml-no-prolog
 <drink>café</drink>
-
-HTTP 200
+HTTP 200
+
+
+POST http://localhost:8000/post-xml-large
+<?xml version='1.0' ?>
+<root>
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name>MH of San Francisco,</bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items>
+                8
+            </num_items>
+            <num_bids></num_bids>
+            <started_at>$9</started_at>
+            <bid_increment>$10</bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed>Mon Nov 27, 2:00 pm PT</closed>
+            <id_num>
+                3699803
+            </id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+                $2459
+            </highest_bid_amount>
+            <quantity>1</quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu>
+                900MHz
+            </cpu>
+            <brand>HP Pavilion</brand>
+            <description>The Pavilion 9780C gives you
+                everything you need in a home
+                PC, from the exhilarating
+                multimedia experience of DVD to
+                the customized music-making
+                abilities of the HP CD-Writer
+                Plus - it's all in a hot
+                translucent blue case! Monitor
+                not included.
+
+
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name></bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items></num_items>
+            <num_bids></num_bids>
+            <started_at></started_at>
+            <bid_increment></bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed></closed>
+            <id_num></id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu></cpu>
+            <brand></brand>
+            <description>
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name></bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items></num_items>
+            <num_bids></num_bids>
+            <started_at></started_at>
+            <bid_increment></bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed></closed>
+            <id_num></id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu></cpu>
+            <brand></brand>
+            <description>
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name>tx of Santa Clara</seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name></bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items>2</num_items>
+            <num_bids></num_bids>
+            <started_at></started_at>
+            <bid_increment></bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed>Mon Nov 27, 2:30 pm PT</closed>
+            <id_num>
+                3699948
+            </id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+                $3837
+            </highest_bid_amount>
+            <quantity>2</quantity>
+        </bid_history>
+        <item_info>
+            <memory>128MB high-performance PC133 ECC SDRAM Maximum: 4GB memory
+                capacity (3.3GB maximum usable memory)
+            </memory>
+            <hard_drive>Open bay - none installed or includedSupports 9.1GB and 18.2GB 7,200rpm Ultra2
+                SCSI disk drivesSupports 9.1GB, 18.2GB, and 36.4GB 10,000rpm Ultra2 SCSI disk
+                drives
+            </hard_drive>
+            <cpu>Intel Pentium III 800MHz</cpu>
+            <brand>Hewlett Packard NetServer LH3000 Pentium III 800MHz
+                128MB RAM/Open Bay/32X CD/No OS
+            </brand>
+            <description>
+                HP NetServer LH 3000 Pentium III 800MHzThis rack mount HP
+                NetServer LH 3000 brings higher performance and reliability to
+                meet your demanding departmental server requirements.
+                Incorporating performance, storage, and high-availability
+                technologies, this workhorse is loaded with features you'd
+                expect only in high-end servers.Key Features At a Glance:
+                Extraordinary performance -- dual Intel Pentium III processor
+                capability (one 800MHz processor included)- with 133MHz front
+                side bus, PC 133MHz ECC SDRAM, and performance-boosting
+                integrated RAID controller. Best-in-class reliability and
+                uptime -- with fully hot-swappable/hot-pluggable components,
+                including disk drives, power supplies, fans, and hot-plug PCI
+                slots. Includes widely adopted, fault-tolerant RAID 5
+                technology-using an embedded, dual-channel NetRAID controller
+                with optional battery backup, hardware-based parity (XOR)
+                logic, and 32MB cache-expandable to 128MB. Excellent
+                investment protection -- the HP NetServer LH 3000's design
+                makes it easily upgradable as higher scalability Xeon servers
+                and new processor enhancements become available. HP OpenView
+                ManageX Event Manager -- for simplified NOS and high
+                availability system management. Intelligent management -- a
+                comprehensive tool set to monitor your server hardware and
+                software from anywhere, anytime. Simple installation-rack
+                mount form factor version.
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name>LW of Sugar Land</bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items>1</num_items>
+            <num_bids></num_bids>
+            <started_at>
+                $9
+            </started_at>
+            <bid_increment>
+                $20
+            </bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed>
+                Mon Nov 27, 2:30 pm PT
+            </closed>
+            <id_num>3699893</id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>$2392
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu></cpu>
+            <brand>Hewlett Packard NetServe</brand>
+            <description>Refurbished and warranted by
+                manufacturer! Dual processing
+                capability (one 800MHz Pentium
+                III processor provided)!!!
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name>BT of Los Angeles</bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items>2</num_items>
+            <num_bids></num_bids>
+            <started_at>$9</started_at>
+            <bid_increment>$20</bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed>Mon Nov 27, 2:30 pm PT</closed>
+            <id_num>
+                3699928
+            </id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+                $2475
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory>AM memory
+                expandable to 4GB (128MB
+                provided)
+            </memory>
+            <hard_drive></hard_drive>
+            <cpu>800MHz Pentium III processor</cpu>
+            <brand></brand>
+            <description>Dual processing capability(one
+                800MHz Pentium III processor
+                providedd)!! RAM memory
+                expandable to 4GB (128MB
+                provided)!! Refurbished and
+                warranted by manufacturer!!HP NetServer LC 2000 Pentium III 800MHz -- The rock-solid
+                workgroup server your growing business can depend on --This HP
+                NetServer LC 2000 offers an innovative solution that delivers
+                top quality to corporate workgroups, branch offices and
+                quickly-growing small businesses with: High tech and high
+                touch -- designed to be simple to install, configure and
+                upgrade, all HP NetServer LC 2000 components are easily
+                accessible and designed for tool-less service -- accented by
+                color-coded "touch points" High availability -- created to
+                deliver the most essential uptime-protecting technologies to
+                meet your computing needs. With more hot-swappable and
+                redundant components in a workgroup server, the LC 2000
+                creates a super-reliable foundation for the growing network
+                Intelligent management -- the HP NetServer LC 2000 is
+                complemented by a hardware and NOS management suite that
+                combines unmatched flexibility with simplicity for precise
+                control. HP management tools ensure that your workgroup and
+                remote office IT professionals can manage the LC 2000 from any
+                location. Best-in-class uptime protection -- with up to six
+                hot-swappable disk drive bays, standard redundant,
+                hot-swappable fans, optional hot-swappable redundant power
+                supplies, support for redundant NICS, and duplexing Freedom
+                to expand -- with dual processing capability (one 800MHz
+                Pentium III processor provided), capacity for up to 4GB SDRAM
+                (128MB standard), expandable storage capability and six open
+                PCI slots, the HP NetServer LC 2000 offers room for growth
+                that is unprecedented in a workgroup serverThis LC 2000
+                provides top quality in a server for corporate workgroups,
+                branch offices and quickly growing small businesses that want
+                enterprise-level system reliability features. Designed with
+                simplicity for easy installation, the HP NetServer LC 2000
+                meets the demands of your quickly growing business today and
+                offers the capability to expand as your workplace computing
+                needs increase in the
+                future.********************************** -- F E A T U R E S A
+                T A GLANCE --PROCESSOR:One Intel Pentium III 800MHz (dual
+                capability with upgrade) with 133MHz front-side bus256K on-die
+                write-back cacheMEMORY: Standard: 128MB SDRAM PC-133 DIMM per
+                slotMaximum: 4GB Four DIMM sockets HARD DISK DRIVE : Open
+                baySTORAGE : Diskette drive: 3.5" 1.44MBCD-ROM drive: Maximum
+                32X IDENETWORK CONTROLLER:Integrated 10/100TX NIC (supports
+                redundant NICs)BUS SPEED:133MHz front-side bus EXPANSION
+                SLOTS:Two 64-bit and four 32-bit PCI slotsPeer 32-bit/64-bit
+                PCI buses, both at 33MHzPORTS:One serial portOne 25-pin
+                parallel portOne SCSI knockout port for external
+                connectionsOne server management port (serial)Video
+                port-SVGAMini-DIN keyboard and mouse portsSTORAGE
+                CONTROLLER:Embedded dual channel Ultra-2 SCSIVIDEO:Embedded
+                ATI Rage IIc video controller1024x768, 64K color at 75Hz2MB
+                SGRAMPOWER SUPPLY:349 Watts (Nominal, 100-127/200-240V AC,
+                50/60Hz; range, 90-140/180-264V AC, 47/63Hz)FORM
+                648mm (25.5") without bezelOPERATING SYSTEM:None installed or
+                includedOPTIONAL OPERATING SYSTEMS SUPPORTED:Microsoft Windows
+                NT 4.0Windows2000Novell NetWare 4.2, 5.0Red Hat LinuxSCO
+                OpenServerUnixWare****************************************HP
+                NetServer LC 2000 -- the rock-solid workgroup server your
+                growing business can depend on!
+
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name>RP of Cleveland</bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items>1</num_items>
+            <num_bids></num_bids>
+            <started_at>$9</started_at>
+            <bid_increment>
+                $10
+            </bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed>Mon Nov 27, 3:00 pm PT</closed>
+            <id_num>
+                3697285
+            </id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>$3000
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory>28MB PC133 SDRAM 168-Pin Memory, 3.3 volt Non-ECC, Non-Buffered, 7.5ns
+                Speed
+            </memory>
+            <hard_drive>30GB 7200 RPM IDE Hard Drive with UltraDMA 66 interface to ensure maximum data
+                throughput
+            </hard_drive>
+            <cpu>III 800MHz Processor with 133MHz Bus</cpu>
+            <brand></brand>
+            <description>Elite PC PIII 800MHz 128MB RAM 30GB HD 10X DVD
+                32MB VID/56K/NIC/3D SND/No OS
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name></bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items></num_items>
+            <num_bids></num_bids>
+            <started_at></started_at>
+            <bid_increment></bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed></closed>
+            <id_num></id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu></cpu>
+            <brand></brand>
+            <description>
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name></bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items></num_items>
+            <num_bids></num_bids>
+            <started_at></started_at>
+            <bid_increment></bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed></closed>
+            <id_num></id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu></cpu>
+            <brand></brand>
+            <description>
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name></bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items></num_items>
+            <num_bids></num_bids>
+            <started_at></started_at>
+            <bid_increment></bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed></closed>
+            <id_num></id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu></cpu>
+            <brand></brand>
+            <description>
+            </description>
+        </item_info>
+    </listing>
+
+    <listing>
+        <seller_info>
+            <seller_name></seller_name>
+            <seller_rating></seller_rating>
+        </seller_info>
+        <payment_types>
+        </payment_types>
+        <shipping_info>
+        </shipping_info>
+        <buyer_protection_info>
+        </buyer_protection_info>
+        <auction_info>
+            <current_bid></current_bid>
+            <time_left></time_left>
+            <high_bidder>
+                <bidder_name></bidder_name>
+                <bidder_rating></bidder_rating>
+            </high_bidder>
+            <num_items></num_items>
+            <num_bids></num_bids>
+            <started_at></started_at>
+            <bid_increment></bid_increment>
+            <location></location>
+            <opened></opened>
+            <closed></closed>
+            <id_num></id_num>
+            <notes></notes>
+        </auction_info>
+        <bid_history>
+            <highest_bid_amount>
+            </highest_bid_amount>
+            <quantity></quantity>
+        </bid_history>
+        <item_info>
+            <memory></memory>
+            <hard_drive></hard_drive>
+            <cpu></cpu>
+            <brand></brand>
+            <description>
+            </description>
+        </item_info>
+    </listing>
+</root>
+HTTP 200
 
diff --git a/integration/tests_ok/post_xml.hurl b/integration/tests_ok/post_xml.hurl index 87f405a31..45267b127 100644 --- a/integration/tests_ok/post_xml.hurl +++ b/integration/tests_ok/post_xml.hurl @@ -1,14 +1,625 @@ -# POST the following XML -# -# café POST http://localhost:8000/post-xml café - HTTP 200 POST http://localhost:8000/post-xml-no-prolog café - +HTTP 200 + + +POST http://localhost:8000/post-xml-large + + + + + + + + + + + + + + + + + + MH of San Francisco, + + + + 8 + + + $9 + $10 + + + Mon Nov 27, 2:00 pm PT + + 3699803 + + + + + + $2459 + + 1 + + + + + + 900MHz + + HP Pavilion + The Pavilion 9780C gives you + everything you need in a home + PC, from the exhilarating + multimedia experience of DVD to + the customized music-making + abilities of the HP CD-Writer + Plus - it's all in a hot + translucent blue case! Monitor + not included. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tx of Santa Clara + + + + + + + + + + + + + + + + 2 + + + + + + Mon Nov 27, 2:30 pm PT + + 3699948 + + + + + + $3837 + + 2 + + + 128MB high-performance PC133 ECC SDRAM Maximum: 4GB memory + capacity (3.3GB maximum usable memory) + + Open bay - none installed or includedSupports 9.1GB and 18.2GB 7,200rpm Ultra2 + SCSI disk drivesSupports 9.1GB, 18.2GB, and 36.4GB 10,000rpm Ultra2 SCSI disk + drives + + Intel Pentium III 800MHz + Hewlett Packard NetServer LH3000 Pentium III 800MHz + 128MB RAM/Open Bay/32X CD/No OS + + + HP NetServer LH 3000 Pentium III 800MHzThis rack mount HP + NetServer LH 3000 brings higher performance and reliability to + meet your demanding departmental server requirements. + Incorporating performance, storage, and high-availability + technologies, this workhorse is loaded with features you'd + expect only in high-end servers.Key Features At a Glance: + Extraordinary performance -- dual Intel Pentium III processor + capability (one 800MHz processor included)- with 133MHz front + side bus, PC 133MHz ECC SDRAM, and performance-boosting + integrated RAID controller. Best-in-class reliability and + uptime -- with fully hot-swappable/hot-pluggable components, + including disk drives, power supplies, fans, and hot-plug PCI + slots. Includes widely adopted, fault-tolerant RAID 5 + technology-using an embedded, dual-channel NetRAID controller + with optional battery backup, hardware-based parity (XOR) + logic, and 32MB cache-expandable to 128MB. Excellent + investment protection -- the HP NetServer LH 3000's design + makes it easily upgradable as higher scalability Xeon servers + and new processor enhancements become available. HP OpenView + ManageX Event Manager -- for simplified NOS and high + availability system management. Intelligent management -- a + comprehensive tool set to monitor your server hardware and + software from anywhere, anytime. Simple installation-rack + mount form factor version. + + + + + + + + + + + + + + + + + + + + LW of Sugar Land + + + 1 + + + $9 + + + $20 + + + + + Mon Nov 27, 2:30 pm PT + + 3699893 + + + + $2392 + + + + + + + + Hewlett Packard NetServe + Refurbished and warranted by + manufacturer! Dual processing + capability (one 800MHz Pentium + III processor provided)!!! + + + + + + + + + + + + + + + + + + + + BT of Los Angeles + + + 2 + + $9 + $20 + + + Mon Nov 27, 2:30 pm PT + + 3699928 + + + + + + $2475 + + + + + AM memory + expandable to 4GB (128MB + provided) + + + 800MHz Pentium III processor + + Dual processing capability(one + 800MHz Pentium III processor + providedd)!! RAM memory + expandable to 4GB (128MB + provided)!! Refurbished and + warranted by manufacturer!!HP NetServer LC 2000 Pentium III 800MHz -- The rock-solid + workgroup server your growing business can depend on --This HP + NetServer LC 2000 offers an innovative solution that delivers + top quality to corporate workgroups, branch offices and + quickly-growing small businesses with: High tech and high + touch -- designed to be simple to install, configure and + upgrade, all HP NetServer LC 2000 components are easily + accessible and designed for tool-less service -- accented by + color-coded "touch points" High availability -- created to + deliver the most essential uptime-protecting technologies to + meet your computing needs. With more hot-swappable and + redundant components in a workgroup server, the LC 2000 + creates a super-reliable foundation for the growing network + Intelligent management -- the HP NetServer LC 2000 is + complemented by a hardware and NOS management suite that + combines unmatched flexibility with simplicity for precise + control. HP management tools ensure that your workgroup and + remote office IT professionals can manage the LC 2000 from any + location. Best-in-class uptime protection -- with up to six + hot-swappable disk drive bays, standard redundant, + hot-swappable fans, optional hot-swappable redundant power + supplies, support for redundant NICS, and duplexing Freedom + to expand -- with dual processing capability (one 800MHz + Pentium III processor provided), capacity for up to 4GB SDRAM + (128MB standard), expandable storage capability and six open + PCI slots, the HP NetServer LC 2000 offers room for growth + that is unprecedented in a workgroup serverThis LC 2000 + provides top quality in a server for corporate workgroups, + branch offices and quickly growing small businesses that want + enterprise-level system reliability features. Designed with + simplicity for easy installation, the HP NetServer LC 2000 + meets the demands of your quickly growing business today and + offers the capability to expand as your workplace computing + needs increase in the + future.********************************** -- F E A T U R E S A + T A GLANCE --PROCESSOR:One Intel Pentium III 800MHz (dual + capability with upgrade) with 133MHz front-side bus256K on-die + write-back cacheMEMORY: Standard: 128MB SDRAM PC-133 DIMM per + slotMaximum: 4GB Four DIMM sockets HARD DISK DRIVE : Open + baySTORAGE : Diskette drive: 3.5" 1.44MBCD-ROM drive: Maximum + 32X IDENETWORK CONTROLLER:Integrated 10/100TX NIC (supports + redundant NICs)BUS SPEED:133MHz front-side bus EXPANSION + SLOTS:Two 64-bit and four 32-bit PCI slotsPeer 32-bit/64-bit + PCI buses, both at 33MHzPORTS:One serial portOne 25-pin + parallel portOne SCSI knockout port for external + connectionsOne server management port (serial)Video + port-SVGAMini-DIN keyboard and mouse portsSTORAGE + CONTROLLER:Embedded dual channel Ultra-2 SCSIVIDEO:Embedded + ATI Rage IIc video controller1024x768, 64K color at 75Hz2MB + SGRAMPOWER SUPPLY:349 Watts (Nominal, 100-127/200-240V AC, + 50/60Hz; range, 90-140/180-264V AC, 47/63Hz)FORM + 648mm (25.5") without bezelOPERATING SYSTEM:None installed or + includedOPTIONAL OPERATING SYSTEMS SUPPORTED:Microsoft Windows + NT 4.0Windows2000Novell NetWare 4.2, 5.0Red Hat LinuxSCO + OpenServerUnixWare****************************************HP + NetServer LC 2000 -- the rock-solid workgroup server your + growing business can depend on! + + + + + + + + + + + + + + + + + + + + + RP of Cleveland + + + 1 + + $9 + + $10 + + + + Mon Nov 27, 3:00 pm PT + + 3697285 + + + + + $3000 + + + + + 28MB PC133 SDRAM 168-Pin Memory, 3.3 volt Non-ECC, Non-Buffered, 7.5ns + Speed + + 30GB 7200 RPM IDE Hard Drive with UltraDMA 66 interface to ensure maximum data + throughput + + III 800MHz Processor with 133MHz Bus + + Elite PC PIII 800MHz 128MB RAM 30GB HD 10X DVD + 32MB VID/56K/NIC/3D SND/No OS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HTTP 200 diff --git a/integration/tests_ok/post_xml.json b/integration/tests_ok/post_xml.json index f25086abe..a5c7c9501 100644 --- a/integration/tests_ok/post_xml.json +++ b/integration/tests_ok/post_xml.json @@ -1 +1 @@ -{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/post-xml","body":{"type":"xml","value":"\ncafé"}},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/post-xml-no-prolog","body":{"type":"xml","value":"café"}},"response":{"status":200}}]} +{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/post-xml","body":{"type":"xml","value":"\ncafé"}},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/post-xml-no-prolog","body":{"type":"xml","value":"café"}},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/post-xml-large","body":{"type":"xml","value":"\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n MH of San Francisco,\n \n \n \n 8\n \n \n $9\n $10\n \n \n Mon Nov 27, 2:00 pm PT\n \n 3699803\n \n \n \n \n \n $2459\n \n 1\n \n \n \n \n \n 900MHz\n \n HP Pavilion\n The Pavilion 9780C gives you\n everything you need in a home\n PC, from the exhilarating\n multimedia experience of DVD to\n the customized music-making\n abilities of the HP CD-Writer\n Plus - it's all in a hot\n translucent blue case! Monitor\n not included.\n\n\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n tx of Santa Clara\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n 2\n \n \n \n \n \n Mon Nov 27, 2:30 pm PT\n \n 3699948\n \n \n \n \n \n $3837\n \n 2\n \n \n 128MB high-performance PC133 ECC SDRAM Maximum: 4GB memory\n capacity (3.3GB maximum usable memory)\n \n Open bay - none installed or includedSupports 9.1GB and 18.2GB 7,200rpm Ultra2\n SCSI disk drivesSupports 9.1GB, 18.2GB, and 36.4GB 10,000rpm Ultra2 SCSI disk\n drives\n \n Intel Pentium III 800MHz\n Hewlett Packard NetServer LH3000 Pentium III 800MHz\n 128MB RAM/Open Bay/32X CD/No OS\n \n \n HP NetServer LH 3000 Pentium III 800MHzThis rack mount HP\n NetServer LH 3000 brings higher performance and reliability to\n meet your demanding departmental server requirements.\n Incorporating performance, storage, and high-availability\n technologies, this workhorse is loaded with features you'd\n expect only in high-end servers.Key Features At a Glance:\n Extraordinary performance -- dual Intel Pentium III processor\n capability (one 800MHz processor included)- with 133MHz front\n side bus, PC 133MHz ECC SDRAM, and performance-boosting\n integrated RAID controller. Best-in-class reliability and\n uptime -- with fully hot-swappable/hot-pluggable components,\n including disk drives, power supplies, fans, and hot-plug PCI\n slots. Includes widely adopted, fault-tolerant RAID 5\n technology-using an embedded, dual-channel NetRAID controller\n with optional battery backup, hardware-based parity (XOR)\n logic, and 32MB cache-expandable to 128MB. Excellent\n investment protection -- the HP NetServer LH 3000's design\n makes it easily upgradable as higher scalability Xeon servers\n and new processor enhancements become available. HP OpenView\n ManageX Event Manager -- for simplified NOS and high\n availability system management. Intelligent management -- a\n comprehensive tool set to monitor your server hardware and\n software from anywhere, anytime. Simple installation-rack\n mount form factor version.\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n LW of Sugar Land\n \n \n 1\n \n \n $9\n \n \n $20\n \n \n \n \n Mon Nov 27, 2:30 pm PT\n \n 3699893\n \n \n \n $2392\n \n \n \n \n \n \n \n Hewlett Packard NetServe\n Refurbished and warranted by\n manufacturer! Dual processing\n capability (one 800MHz Pentium\n III processor provided)!!!\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n BT of Los Angeles\n \n \n 2\n \n $9\n $20\n \n \n Mon Nov 27, 2:30 pm PT\n \n 3699928\n \n \n \n \n \n $2475\n \n \n \n \n AM memory\n expandable to 4GB (128MB\n provided)\n \n \n 800MHz Pentium III processor\n \n Dual processing capability(one\n 800MHz Pentium III processor\n providedd)!! RAM memory\n expandable to 4GB (128MB\n provided)!! Refurbished and\n warranted by manufacturer!!HP NetServer LC 2000 Pentium III 800MHz -- The rock-solid\n workgroup server your growing business can depend on --This HP\n NetServer LC 2000 offers an innovative solution that delivers\n top quality to corporate workgroups, branch offices and\n quickly-growing small businesses with: High tech and high\n touch -- designed to be simple to install, configure and\n upgrade, all HP NetServer LC 2000 components are easily\n accessible and designed for tool-less service -- accented by\n color-coded \"touch points\" High availability -- created to\n deliver the most essential uptime-protecting technologies to\n meet your computing needs. With more hot-swappable and\n redundant components in a workgroup server, the LC 2000\n creates a super-reliable foundation for the growing network\n Intelligent management -- the HP NetServer LC 2000 is\n complemented by a hardware and NOS management suite that\n combines unmatched flexibility with simplicity for precise\n control. HP management tools ensure that your workgroup and\n remote office IT professionals can manage the LC 2000 from any\n location. Best-in-class uptime protection -- with up to six\n hot-swappable disk drive bays, standard redundant,\n hot-swappable fans, optional hot-swappable redundant power\n supplies, support for redundant NICS, and duplexing Freedom\n to expand -- with dual processing capability (one 800MHz\n Pentium III processor provided), capacity for up to 4GB SDRAM\n (128MB standard), expandable storage capability and six open\n PCI slots, the HP NetServer LC 2000 offers room for growth\n that is unprecedented in a workgroup serverThis LC 2000\n provides top quality in a server for corporate workgroups,\n branch offices and quickly growing small businesses that want\n enterprise-level system reliability features. Designed with\n simplicity for easy installation, the HP NetServer LC 2000\n meets the demands of your quickly growing business today and\n offers the capability to expand as your workplace computing\n needs increase in the\n future.********************************** -- F E A T U R E S A\n T A GLANCE --PROCESSOR:One Intel Pentium III 800MHz (dual\n capability with upgrade) with 133MHz front-side bus256K on-die\n write-back cacheMEMORY: Standard: 128MB SDRAM PC-133 DIMM per\n slotMaximum: 4GB Four DIMM sockets HARD DISK DRIVE : Open\n baySTORAGE : Diskette drive: 3.5\" 1.44MBCD-ROM drive: Maximum\n 32X IDENETWORK CONTROLLER:Integrated 10/100TX NIC (supports\n redundant NICs)BUS SPEED:133MHz front-side bus EXPANSION\n SLOTS:Two 64-bit and four 32-bit PCI slotsPeer 32-bit/64-bit\n PCI buses, both at 33MHzPORTS:One serial portOne 25-pin\n parallel portOne SCSI knockout port for external\n connectionsOne server management port (serial)Video\n port-SVGAMini-DIN keyboard and mouse portsSTORAGE\n CONTROLLER:Embedded dual channel Ultra-2 SCSIVIDEO:Embedded\n ATI Rage IIc video controller1024x768, 64K color at 75Hz2MB\n SGRAMPOWER SUPPLY:349 Watts (Nominal, 100-127/200-240V AC,\n 50/60Hz; range, 90-140/180-264V AC, 47/63Hz)FORM\n 648mm (25.5\") without bezelOPERATING SYSTEM:None installed or\n includedOPTIONAL OPERATING SYSTEMS SUPPORTED:Microsoft Windows\n NT 4.0Windows2000Novell NetWare 4.2, 5.0Red Hat LinuxSCO\n OpenServerUnixWare****************************************HP\n NetServer LC 2000 -- the rock-solid workgroup server your\n growing business can depend on!\n\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n RP of Cleveland\n \n \n 1\n \n $9\n \n $10\n \n \n \n Mon Nov 27, 3:00 pm PT\n \n 3697285\n \n \n \n \n $3000\n \n \n \n \n 28MB PC133 SDRAM 168-Pin Memory, 3.3 volt Non-ECC, Non-Buffered, 7.5ns\n Speed\n \n 30GB 7200 RPM IDE Hard Drive with UltraDMA 66 interface to ensure maximum data\n throughput\n \n III 800MHz Processor with 133MHz Bus\n \n Elite PC PIII 800MHz 128MB RAM 30GB HD 10X DVD\n 32MB VID/56K/NIC/3D SND/No OS\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"}},"response":{"status":200}}]} diff --git a/integration/tests_ok/post_xml.py b/integration/tests_ok/post_xml.py index 6a0277569..fcae14d08 100644 --- a/integration/tests_ok/post_xml.py +++ b/integration/tests_ok/post_xml.py @@ -19,3 +19,10 @@ def post_xml_no_prolog(): s = request.data.decode("utf-8") assert s == """caf\u00e9""" return "" + + +@app.route("/post-xml-large", methods=["POST"]) +def post_xml_large(): + s = request.data.decode("utf-8") + assert len(s) == 22156 + return "" diff --git a/packages/hurl_core/Cargo.toml b/packages/hurl_core/Cargo.toml index ca05beea4..412eb2498 100644 --- a/packages/hurl_core/Cargo.toml +++ b/packages/hurl_core/Cargo.toml @@ -16,5 +16,5 @@ strict = [] [dependencies] float-cmp = "0.9.0" -sxd-document = "0.3.2" +libxml = "0.3.3" regex = "1.9.5" diff --git a/packages/hurl_core/src/parser/xml.rs b/packages/hurl_core/src/parser/xml.rs index 6d473ec44..3f5cada7e 100644 --- a/packages/hurl_core/src/parser/xml.rs +++ b/packages/hurl_core/src/parser/xml.rs @@ -15,54 +15,182 @@ * limitations under the License. * */ -use sxd_document::parser; +use libxml::bindings::{ + xmlChar, xmlCreatePushParserCtxt, xmlFreeParserCtxt, xmlParseChunk, xmlSAXHandlerPtr, +}; +use std::os::raw::{c_char, c_int, c_void}; +use std::ptr; -use crate::ast::Pos; use crate::parser::error::*; use crate::parser::reader::Reader; use crate::parser::ParseResult; pub fn parse(reader: &mut Reader) -> ParseResult { - let mut buf = String::new(); let start = reader.state.clone(); - match reader.read() { - Some('<') => buf.push('<'), + + // We test if our first character is a start of an XML text. + // If not, we return immediately a recoverable error. + // Otherwise, we start parsing the supposedly XML buffer. Any + // subsequent error will be a non recoverable error. + let c = reader.peek(); + match c { + Some('<') => {} _ => { return Err(Error { - pos: Pos { line: 1, column: 1 }, + pos: start.pos, recoverable: true, inner: ParseError::Xml, }) } } - loop { - match reader.read() { - None => { + let mut buf = String::new(); + let mut parser = new_sax_parser(); + let mut parser_context = ParserContext::new(); + + // We use libxml SAX parser to identify the end of the XML body. + // We feed the SAX parser chars by chars (Rust char), so chunks are UFT-8 bytes, + // 1 byte to 4 bytes long. The detection of the body end is done when receiving a closing + // element event by testing the depth of the XML tree. + unsafe { + let context = xmlCreatePushParserCtxt( + &mut parser as xmlSAXHandlerPtr, + &mut parser_context as *mut ParserContext as *mut c_void, + ptr::null(), + 0, + ptr::null(), + ); + + while let Some(c) = reader.read() { + buf.push(c); + + // We feed the parser chars by chars. + // A buffer of length four is large enough to encode any char. + let mut bytes = [0u8; 4]; + let end = reader.is_eof() as c_int; + let bytes = c.encode_utf8(&mut bytes); + let count = bytes.len() as c_int; + let bytes = bytes.as_ptr() as *const c_char; + let ret = xmlParseChunk(context, bytes, count, end); + if ret != 0 { + xmlFreeParserCtxt(context); + return Err(Error { + pos: start.pos, + recoverable: false, + inner: ParseError::Xml, + }); + } + + // End of the XML body is detected with a closing element event and depth of the tree. + // There is also a closing document event but it's not always raised at the exact + // closing `>` position. + if std::matches!(parser_context.state, ParserState::EndElement) + && parser_context.depth == 0 + { break; } - Some(c) => { - buf.push(c); - if c == '>' && is_valid(buf.as_str()) { - return Ok(buf); - } - } } + + xmlFreeParserCtxt(context); } - Err(Error { - pos: start.pos, - recoverable: false, - inner: ParseError::Xml, - }) + + Ok(buf) } -fn is_valid(s: &str) -> bool { - parser::parse(s).is_ok() +/// A context for the SAX parser, containing a `state` and the current tree `depth`. +struct ParserContext { + depth: usize, + state: ParserState, +} + +impl ParserContext { + fn new() -> ParserContext { + ParserContext { + depth: 0, + state: ParserState::Created, + } + } +} + +enum ParserState { + Created, + StartDocument, + EndDocument, + StartElement, + EndElement, +} + +fn new_sax_parser() -> libxml::bindings::xmlSAXHandler { + libxml::bindings::xmlSAXHandler { + internalSubset: None, + isStandalone: None, + hasInternalSubset: None, + hasExternalSubset: None, + resolveEntity: None, + getEntity: None, + entityDecl: None, + notationDecl: None, + attributeDecl: None, + elementDecl: None, + unparsedEntityDecl: None, + setDocumentLocator: None, + startDocument: Some(on_start_document), + endDocument: Some(on_end_document), + startElement: Some(on_start_element), + endElement: Some(on_end_element), + reference: None, + characters: None, + ignorableWhitespace: None, + processingInstruction: None, + comment: None, + warning: None, + error: None, + fatalError: None, + getParameterEntity: None, + cdataBlock: None, + externalSubset: None, + initialized: libxml::bindings::XML_SAX2_MAGIC, + _private: ptr::null_mut(), + startElementNs: None, + endElementNs: None, + serror: None, + } +} + +/// Called when the document start being processed. +unsafe extern "C" fn on_start_document(ctx: *mut c_void) { + let context: &mut ParserContext = unsafe { &mut *(ctx as *mut ParserContext) }; + context.state = ParserState::StartDocument; +} + +/// Called when the document end has been detected. +unsafe extern "C" fn on_end_document(ctx: *mut c_void) { + let context: &mut ParserContext = unsafe { &mut *(ctx as *mut ParserContext) }; + context.state = ParserState::EndDocument; +} + +/// Called when an opening tag has been processed. +unsafe extern "C" fn on_start_element( + ctx: *mut c_void, + _name: *const xmlChar, + _atts: *mut *const xmlChar, +) { + let context: &mut ParserContext = unsafe { &mut *(ctx as *mut ParserContext) }; + context.state = ParserState::StartElement; + context.depth += 1; +} + +/// Called when the end of an element has been detected. +unsafe extern "C" fn on_end_element(ctx: *mut c_void, _name: *const xmlChar) { + let context: &mut ParserContext = unsafe { &mut *(ctx as *mut ParserContext) }; + context.state = ParserState::EndElement; + context.depth -= 1; } #[cfg(test)] mod tests { use super::*; + use crate::ast::Pos; #[test] fn parse_xml_brute_force_errors() {