Re: Content-Range in Nethttp.Header missing "bytes"
Gerd Stolpmann <[email protected]> Tue, 27 Jan 2015 15:52:03 +0100
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============6226518472904582803==
Content-Type: multipart/signed; micalg="pgp-sha1";
protocol="application/pgp-signature";
boundary="=-p5q3q2XTqd+Z4GGh4Z6V"
--=-p5q3q2XTqd+Z4GGh4Z6V
Content-Type: text/plain; charset="ISO-8859-15"
Content-Transfer-Encoding: quoted-printable
Thanks. This is fixed in svn now.
Gerd
Am Montag, den 26.01.2015, 15:25 +0200 schrieb T=F6r=F6k Edwin:
> Hi,
>=20
> set_content_range in nethttp.ml sets header of the form "Content-Range: 5=
98-3135/3136", but it should set "Content-Range: bytes 598-3135/3136",
> see http://tools.ietf.org/html/rfc7233#section-4.2
>=20
> Interestingly the headers set by Nethttp.set_content_range worked fine wi=
th clients like curl/wget or even browsers.
> Then I tried using my server as an APT http repository and it complained:
> HTTP/1.1 206 Partial Content
> Accept-Ranges: bytes
> Content-Length: 2538
> Content-Range: 598-3135/3136
> Content-Type: binary/octet-stream
> Date: Sun, 25 Jan 2015 09:51:26 GMT
> ETag: "2015-01-23 10:19:24.611:0ad6cf8d3cfc5ebfc5983d6e8c626bc8"
> Last-Modified: Fri, 23 Jan 2015 10:19:24 GMT
> Server: libres3-0.9.beta-68-g137d4f1-dirty
> x-amz-id-2: dm9sLXJlcG8AL2RlYmlhbi9kaXN0cy93aGVlenkvSW5SZWxlYXNlADE0MjIxN=
zk0ODYuNDE=3D
> x-amz-request-id: libres3_d598fe779a57c81f28f25e1dd9802276_14711_1209_142=
2179483.37
>=20
>=20
> 400 URI Failure
> URI: [...]
> Message: The HTTP server sent an invalid Content-Range header
>=20
>=20
> Testcase (make sure Nethttp can parse the header it generates):
>=20
> $ cat >x.ml <<EOF
> #use "topfind"
> #require "netstring"
> let test_bytes b =3D
> let h =3D new Netmime.basic_mime_header [] in
> Nethttp.Header.set_content_range h b;
> let cr =3D h#field "Content-Range" in
> (* if String.length cr < 6 || String.sub cr 0 6 <> "bytes" then
> h#update_field "Content-Range" ("bytes " ^ cr);
> let cr =3D h#field "Content-Range" in*)
> prerr_endline cr;
> assert (Nethttp.Header.get_content_range h =3D b)
>=20
> let () =3D
> test_bytes (`Bytes ((Some (42L, 1233L), Some 1234L)));
> test_bytes (`Bytes ((Some (42L, 1233L), None)));
> test_bytes (`Bytes (None, Some 1234L));
> EOF
> $ ocaml x.ml
> 42-1233/1234
> Exception: Nethttp.Bad_header_field "Nethttp.get_content_range".
>=20
> Best regards,
> --Edwin
>=20
> -------------------------------------------------------------------------=
-----
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is y=
our
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take =
a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ocamlnet-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel
--=20
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany [email protected]
My OCaml site: http://www.camlcity.org
Contact details: http://www.camlcity.org/contact.html
Company homepage: http://www.gerd-stolpmann.de
------------------------------------------------------------
--=-p5q3q2XTqd+Z4GGh4Z6V
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJUx6YTAAoJEAaM4b9ZLB5TpQkH/0tjzvfmFcgec0+Z1aMeoZsU
68zt8Q5kaOzCo+GbrrxNJNsOeq2UY+7bPhuI+nbc6FcyUxPQPTAp571vyZrmeT5e
3StHqxRyWvOaZYu+jaVwpx4dzoPJ2t7l2C77WQx53TGyqPxGC6aWEpIVWCtPuL/z
DURilTrKRa4kgZiQGUWsD47jziW0CdpAzl3V+qk0dPbtDBK/X3dlCI7CqU8AP0jb
HJRyiOgcKQ1zi71Rtj2lgUbSNsubcLbnCJ/dqckvDxZjrikA5tEUrem1pvdrZbZD
kbN2MC04U3pgBmDAXEdvSZripXXMF+OoiZgDXatKWxlcvf9h6F7nEmIBaWTqWxg=
=xj8v
-----END PGP SIGNATURE-----
--=-p5q3q2XTqd+Z4GGh4Z6V--
--===============6226518472904582803==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
--===============6226518472904582803==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Ocamlnet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel
--===============6226518472904582803==--