[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[patch] Re: [patch] dbootstrap/http-fetch



Michael Vogt wrote:
> On Tue, Mar 21, 2000 at 11:36:24PM +0100, Stefan Gybas wrote:
> > Michael Vogt wrote:
> > 
> > > http-fetch.c uses a absolute-URI regardless if it connects to
> > > a proxy or a host. This violates rfc1945:
> > > "The absoluteURI form is only allowed when the request is
> > > being made to a proxy." (Section 5.1.2).
> > 
> > The request should include a Host: header when not using a proxy so this
> > will also work with virtual hosts:
> > 
> > snprintf(buf, sizeof buf - 1, "Host: %s\nGET /%s/%s HTTP/1.0\n\n",
> >          server_host, remote_path, remote_filename);
> I don't think, that this is conform to rfc1945. If we close the request
> with HTTP/1.0, we should really send out HTTP/1.0.
> The "Host" Feature is HTTP/1.1 (see rfc2616, 14.23).

Hmmm, in rfc1945: section 5.2:

    Request-Header field names can be extended reliably only in
    combination with a change in the protocol version. However, new or
    experimental header fields may be given the semantics of request
    header fields if all parties in the communication recognize them to
    be request header fields. Unrecognized header fields are treated as
    Entity-Header fields.

and in section 7.1:

    The extension-header mechanism allows additional Entity-Header fields
    to be defined without changing the protocol, but these fields cannot
    be assumed to be recognizable by the recipient. Unrecognized header
    fields should be ignored by the recipient and forwarded by proxies.

So, I don't think Stefan's suggestion violates rfc1945 (save that rfc1945
recommends that Request-Header fields precede Entity-Header fields).

Certainly, leaving out a Host header breaks virtual hosts, so I would
like it included in the request.  Patch below; I will build another
set of floppies including the patch and, if it works and there are no
objections, commit it in a couple of days.

Regards,

Mark.


Index: utilities/dbootstrap/http-fetch.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/http-fetch.c,v
retrieving revision 1.12
diff -u -r1.12 http-fetch.c
--- utilities/dbootstrap/http-fetch.c   2000/03/24 07:28:35     1.12
+++ utilities/dbootstrap/http-fetch.c   2000/04/05 23:43:37
@@ -251,10 +251,6 @@
     return -1;
   }
 
-  // snprintf(buf, sizeof buf - 1,
-  //          "GET http://%s:%d/%s/%s HTTP/1.0\n\n",
-  //          server_host, server_port, remote_path, remote_filename);
-
   if (use_proxy) {
     snprintf(buf, sizeof buf - 1,
              "GET http://%s:%d/%s/%s HTTP/1.0\n\n",
@@ -262,7 +258,8 @@
   }
   else {
     snprintf(buf, sizeof buf - 1,
-             "GET /%s/%s HTTP/1.0\n\n", remote_path, remote_filename);
+             "GET /%s/%s HTTP/1.0\nHost: %s\n\n",
+             server_host, remote_path, remote_filename);
   }
 
   if (nf_http_write(sock, buf) < 0) {

(end)


Reply to: