You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Tim Ellison <t....@gmail.com> on 2008/12/08 13:04:04 UTC

[classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Kevin Zhou commented on HARMONY-6036:
> I investigated this problem and found that "Accept" property should
> be added in
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.createRequest()
> method.
> 
> From HTTP/1.1 specification,
>> "If no Accept header field is present, then it is assumed that
>> the client accepts all media types".
> 
> if (reqHeader.get("Accept") == null) { //$NON-NLS-1$ 
> output.append("Accept: "text/html, image/gif, image/jpeg, *; "q=.2, 
> */*; q=.2\r\n"); //$NON-NLS-1$ }>

Kevin, can you help me to understand why we would express this set of
preferences in the Accept header for "/"?

Its unclear to me why, by default, we would have that line?
(I understand what it does, just not which problem it solves.)

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Thanks,
Tim

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Kevin Zhou <zh...@gmail.com>.
Tim wrote,
> Is it a problem that we don't reply with that Accept: ?

> Sorry, but I'm still back at questioning why we would express a preference
for test/html, image/gif and image/jpeg at all on the "GET /" request.

No. It is the problem that we don't send Accept header in our request.
Some web servers are not HTTP/1.1 compliant - this causes our http requests
to hang when connecting to it.
It seems like some servers REQUIRE the client to send an "Accept" header.
Our current implementation doesn't send an Accept header.
However, RI sends such Accept headers. In light of this, we should start
sending an Accept header which will accept all content types unless
explicitly overridden in user code.

Kevin Zhou

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Kevin Zhou <zh...@gmail.com>.
Sorry, I don't express so clear.
But Alexei got my idea. Should we be compatible with RI. [1]

[1] https://issues.apache.org/jira/browse/HARMONY-6036

On Tue, Dec 9, 2008 at 12:42 AM, Alexei Fedotov <al...@gmail.com>wrote:

> Tim wrote,
> > why we would express a preference for test/html?
>
> Kevin wrote,
> > I find that RI has such a support, but we doesn't.
>
> If I got Kevin's point correctly he meant us to be compatible with RI. The
> bug description [1] mentions compatibility testing as well.
>
>
> [1] https://issues.apache.org/jira/browse/HARMONY-6036
>
> On Mon, Dec 8, 2008 at 7:35 PM, Tim Ellison <t....@gmail.com> wrote:
>
> > 李竞沁 wrote:
> > > Hi Kevin,
> > > The spec of Http said that "all headers except Host are optional.". And
> I
> > > have investigated in the java api spec. No information about what
> headers
> > > should be sent by the HttpURLConnection. It maybe a different behavior
> > > between RI and harmony.
> > > By the way, user can use setRequestProperty(key, value) method to set
> the
> > > header field which he want to send.
> >
> > Sorry, but I'm still back at questioning why we would express a
> > preference for test/html, image/gif and image/jpeg at all on the "GET /"
> > request.
> >
> > What am I missing?
> > Tim
> >
>
>
>
> --
> С уважением,
> Алексей Федотов,
> ЗАО «Телеком Экспресс»
>

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Alexei Fedotov <al...@gmail.com>.
Tim wrote,
> why we would express a preference for test/html?

Kevin wrote,
> I find that RI has such a support, but we doesn't.

If I got Kevin's point correctly he meant us to be compatible with RI. The
bug description [1] mentions compatibility testing as well.


[1] https://issues.apache.org/jira/browse/HARMONY-6036

On Mon, Dec 8, 2008 at 7:35 PM, Tim Ellison <t....@gmail.com> wrote:

> 李竞沁 wrote:
> > Hi Kevin,
> > The spec of Http said that "all headers except Host are optional.". And I
> > have investigated in the java api spec. No information about what headers
> > should be sent by the HttpURLConnection. It maybe a different behavior
> > between RI and harmony.
> > By the way, user can use setRequestProperty(key, value) method to set the
> > header field which he want to send.
>
> Sorry, but I'm still back at questioning why we would express a
> preference for test/html, image/gif and image/jpeg at all on the "GET /"
> request.
>
> What am I missing?
> Tim
>



-- 
С уважением,
Алексей Федотов,
ЗАО «Телеком Экспресс»

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by 李竞沁 <li...@gmail.com>.
Hi Tim,Should we give some default value to some HTTP headers, such as
Accept: */*?

Actually RI used to have the method URLConnection.
setDefaultRequestProperty(), but now it is deprecated. I have no idea about
it.

On Tue, Dec 9, 2008 at 12:00 PM, Tim Ellison <t....@gmail.com> wrote:

> Kevin Zhou wrote:
> > Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
> > No, I don't think so. RI, IE and Firefox all send Accept header to
> support
> > such servers.
> > Why don't we follow this as well to satisfy with our potential clients?
>
> Thanks for the explanation -- it is starting to make sense now you tell
> me the server is misbehaving.
>
> Remaining question: do we just mimic the RI's accept header which seems
> to have a preference for some mime types, or just go for Accept: */* ?
>
> Regards,
> Tim
>
>


-- 
Yours sincerely,
Charles Lee

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Tim Ellison <t....@gmail.com>.
Kevin Zhou wrote:
> Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
> No, I don't think so. RI, IE and Firefox all send Accept header to support
> such servers.
> Why don't we follow this as well to satisfy with our potential clients?

Thanks for the explanation -- it is starting to make sense now you tell
me the server is misbehaving.

Remaining question: do we just mimic the RI's accept header which seems
to have a preference for some mime types, or just go for Accept: */* ?

Regards,
Tim


Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Kevin Zhou <zh...@gmail.com>.
Hi Tim and Nathan,
Thanks for your advice.
Will try Nathan approach to see whether it works.

2008/12/9 Tim Ellison <t....@gmail.com>

> 李竞沁 wrote:
> > Agree. Maybe our process should be find whether the user has specify a
> > Accept Header, if not use the default one.
>
> For sure, you don't want to overwrite a user defined Accept:, but I'm
> with Nathan that we should default to *, */* unless we see a good reason
> to do otherwise.
>
> Regards,
> Tim
>
> > On Tue, Dec 9, 2008 at 11:58 AM, Nathan Beyer <nd...@apache.org>
> wrote:
> >
> >> 2008/12/8 Kevin Zhou <zh...@gmail.com>:
> >>> Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
> >>> No, I don't think so. RI, IE and Firefox all send Accept header to
> >> support
> >>> such servers.
> >>> Why don't we follow this as well to satisfy with our potential clients?
> >> I don't think the question is about setting Accept or not, it's the
> >> actual value used. It's not surprising that IE and Firefox and most
> >> web browesrs set an Accept that says they know HTML, GIFs and JPEGs -
> >> they are web browsers, that's what they do. This isn't a web browser,
> >> this is just a raw HTTP socket connection. It has no knowledge of what
> >> the code using it would prefer.
> >>
> >> Yes we should be compatible with the RI, but we should also try not to
> >> be silly. I suggest setting Accept to just be a wildcard. This should
> >> satisfy all conditions.
> >>
> >> -Nathan
> >>
> >>> On Tue, Dec 9, 2008 at 9:55 AM, 李竞沁 <li...@gmail.com> wrote:
> >>>
> >>>> Hi Kevin,I have these questions:
> >>>> 1. What will the server, which is not compatible with HTTP 1.1, do if
> it
> >>>> receives a HTTP 1.1 request? ( Our HTTP header has told that it is a
> >> HTTP
> >>>> 1.1 request.)
> >>>> 2. Should this be a server's misbehavior because spec does not insist
> >> send
> >>>> accept header? Or are there any common rules to guide this behavior? (
> >> Do
> >>>> we
> >>>> only miss accept header?)
> >>>>
> >>>> On Tue, Dec 9, 2008 at 9:44 AM, Kevin Zhou <zh...@gmail.com>
> >> wrote:
> >>>>> Charles wrote,
> >>>>>> The spec of Http said that "all headers except Host are optional."
> >> It
> >>>> is
> >>>>> what the RI does.
> >>>>>
> >>>>> Yes, I think we should be compatible with RI's behaviors.
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> Yours sincerely,
> >>>> Charles Lee
> >>>>
> >
> >
> >
>

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Charles Lee <li...@gmail.com>.
Agree.

2008/12/9 Tim Ellison <t....@gmail.com>

> 李竞沁 wrote:
> > Agree. Maybe our process should be find whether the user has specify a
> > Accept Header, if not use the default one.
>
> For sure, you don't want to overwrite a user defined Accept:, but I'm
> with Nathan that we should default to *, */* unless we see a good reason
> to do otherwise.
>
> Regards,
> Tim
>
> > On Tue, Dec 9, 2008 at 11:58 AM, Nathan Beyer <nd...@apache.org>
> wrote:
> >
> >> 2008/12/8 Kevin Zhou <zh...@gmail.com>:
> >>> Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
> >>> No, I don't think so. RI, IE and Firefox all send Accept header to
> >> support
> >>> such servers.
> >>> Why don't we follow this as well to satisfy with our potential clients?
> >> I don't think the question is about setting Accept or not, it's the
> >> actual value used. It's not surprising that IE and Firefox and most
> >> web browesrs set an Accept that says they know HTML, GIFs and JPEGs -
> >> they are web browsers, that's what they do. This isn't a web browser,
> >> this is just a raw HTTP socket connection. It has no knowledge of what
> >> the code using it would prefer.
> >>
> >> Yes we should be compatible with the RI, but we should also try not to
> >> be silly. I suggest setting Accept to just be a wildcard. This should
> >> satisfy all conditions.
> >>
> >> -Nathan
> >>
> >>> On Tue, Dec 9, 2008 at 9:55 AM, 李竞沁 <li...@gmail.com> wrote:
> >>>
> >>>> Hi Kevin,I have these questions:
> >>>> 1. What will the server, which is not compatible with HTTP 1.1, do if
> it
> >>>> receives a HTTP 1.1 request? ( Our HTTP header has told that it is a
> >> HTTP
> >>>> 1.1 request.)
> >>>> 2. Should this be a server's misbehavior because spec does not insist
> >> send
> >>>> accept header? Or are there any common rules to guide this behavior? (
> >> Do
> >>>> we
> >>>> only miss accept header?)
> >>>>
> >>>> On Tue, Dec 9, 2008 at 9:44 AM, Kevin Zhou <zh...@gmail.com>
> >> wrote:
> >>>>> Charles wrote,
> >>>>>> The spec of Http said that "all headers except Host are optional."
> >> It
> >>>> is
> >>>>> what the RI does.
> >>>>>
> >>>>> Yes, I think we should be compatible with RI's behaviors.
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> Yours sincerely,
> >>>> Charles Lee
> >>>>
> >
> >
> >
>



-- 
Yours sincerely,
Charles Lee

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Tim Ellison <t....@gmail.com>.
李竞沁 wrote:
> Agree. Maybe our process should be find whether the user has specify a
> Accept Header, if not use the default one.

For sure, you don't want to overwrite a user defined Accept:, but I'm
with Nathan that we should default to *, */* unless we see a good reason
to do otherwise.

Regards,
Tim

> On Tue, Dec 9, 2008 at 11:58 AM, Nathan Beyer <nd...@apache.org> wrote:
> 
>> 2008/12/8 Kevin Zhou <zh...@gmail.com>:
>>> Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
>>> No, I don't think so. RI, IE and Firefox all send Accept header to
>> support
>>> such servers.
>>> Why don't we follow this as well to satisfy with our potential clients?
>> I don't think the question is about setting Accept or not, it's the
>> actual value used. It's not surprising that IE and Firefox and most
>> web browesrs set an Accept that says they know HTML, GIFs and JPEGs -
>> they are web browsers, that's what they do. This isn't a web browser,
>> this is just a raw HTTP socket connection. It has no knowledge of what
>> the code using it would prefer.
>>
>> Yes we should be compatible with the RI, but we should also try not to
>> be silly. I suggest setting Accept to just be a wildcard. This should
>> satisfy all conditions.
>>
>> -Nathan
>>
>>> On Tue, Dec 9, 2008 at 9:55 AM, 李竞沁 <li...@gmail.com> wrote:
>>>
>>>> Hi Kevin,I have these questions:
>>>> 1. What will the server, which is not compatible with HTTP 1.1, do if it
>>>> receives a HTTP 1.1 request? ( Our HTTP header has told that it is a
>> HTTP
>>>> 1.1 request.)
>>>> 2. Should this be a server's misbehavior because spec does not insist
>> send
>>>> accept header? Or are there any common rules to guide this behavior? (
>> Do
>>>> we
>>>> only miss accept header?)
>>>>
>>>> On Tue, Dec 9, 2008 at 9:44 AM, Kevin Zhou <zh...@gmail.com>
>> wrote:
>>>>> Charles wrote,
>>>>>> The spec of Http said that "all headers except Host are optional."
>> It
>>>> is
>>>>> what the RI does.
>>>>>
>>>>> Yes, I think we should be compatible with RI's behaviors.
>>>>>
>>>>
>>>>
>>>> --
>>>> Yours sincerely,
>>>> Charles Lee
>>>>
> 
> 
> 

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by 李竞沁 <li...@gmail.com>.
Agree. Maybe our process should be find whether the user has specify a
Accept Header, if not use the default one.

On Tue, Dec 9, 2008 at 11:58 AM, Nathan Beyer <nd...@apache.org> wrote:

> 2008/12/8 Kevin Zhou <zh...@gmail.com>:
> > Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
> > No, I don't think so. RI, IE and Firefox all send Accept header to
> support
> > such servers.
> > Why don't we follow this as well to satisfy with our potential clients?
>
> I don't think the question is about setting Accept or not, it's the
> actual value used. It's not surprising that IE and Firefox and most
> web browesrs set an Accept that says they know HTML, GIFs and JPEGs -
> they are web browsers, that's what they do. This isn't a web browser,
> this is just a raw HTTP socket connection. It has no knowledge of what
> the code using it would prefer.
>
> Yes we should be compatible with the RI, but we should also try not to
> be silly. I suggest setting Accept to just be a wildcard. This should
> satisfy all conditions.
>
> -Nathan
>
> >
> > On Tue, Dec 9, 2008 at 9:55 AM, 李竞沁 <li...@gmail.com> wrote:
> >
> >> Hi Kevin,I have these questions:
> >> 1. What will the server, which is not compatible with HTTP 1.1, do if it
> >> receives a HTTP 1.1 request? ( Our HTTP header has told that it is a
> HTTP
> >> 1.1 request.)
> >> 2. Should this be a server's misbehavior because spec does not insist
> send
> >> accept header? Or are there any common rules to guide this behavior? (
> Do
> >> we
> >> only miss accept header?)
> >>
> >> On Tue, Dec 9, 2008 at 9:44 AM, Kevin Zhou <zh...@gmail.com>
> wrote:
> >>
> >> > Charles wrote,
> >> > > The spec of Http said that "all headers except Host are optional."
> It
> >> is
> >> > what the RI does.
> >> >
> >> > Yes, I think we should be compatible with RI's behaviors.
> >> >
> >>
> >>
> >>
> >> --
> >> Yours sincerely,
> >> Charles Lee
> >>
> >
>



-- 
Yours sincerely,
Charles Lee

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Nathan Beyer <nd...@apache.org>.
2008/12/8 Kevin Zhou <zh...@gmail.com>:
> Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
> No, I don't think so. RI, IE and Firefox all send Accept header to support
> such servers.
> Why don't we follow this as well to satisfy with our potential clients?

I don't think the question is about setting Accept or not, it's the
actual value used. It's not surprising that IE and Firefox and most
web browesrs set an Accept that says they know HTML, GIFs and JPEGs -
they are web browsers, that's what they do. This isn't a web browser,
this is just a raw HTTP socket connection. It has no knowledge of what
the code using it would prefer.

Yes we should be compatible with the RI, but we should also try not to
be silly. I suggest setting Accept to just be a wildcard. This should
satisfy all conditions.

-Nathan

>
> On Tue, Dec 9, 2008 at 9:55 AM, 李竞沁 <li...@gmail.com> wrote:
>
>> Hi Kevin,I have these questions:
>> 1. What will the server, which is not compatible with HTTP 1.1, do if it
>> receives a HTTP 1.1 request? ( Our HTTP header has told that it is a HTTP
>> 1.1 request.)
>> 2. Should this be a server's misbehavior because spec does not insist send
>> accept header? Or are there any common rules to guide this behavior? ( Do
>> we
>> only miss accept header?)
>>
>> On Tue, Dec 9, 2008 at 9:44 AM, Kevin Zhou <zh...@gmail.com> wrote:
>>
>> > Charles wrote,
>> > > The spec of Http said that "all headers except Host are optional." It
>> is
>> > what the RI does.
>> >
>> > Yes, I think we should be compatible with RI's behaviors.
>> >
>>
>>
>>
>> --
>> Yours sincerely,
>> Charles Lee
>>
>

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Kevin Zhou <zh...@gmail.com>.
Maybe this violates the HTTP/1.1 spec, should we abandon these servers?
No, I don't think so. RI, IE and Firefox all send Accept header to support
such servers.
Why don't we follow this as well to satisfy with our potential clients?

On Tue, Dec 9, 2008 at 9:55 AM, 李竞沁 <li...@gmail.com> wrote:

> Hi Kevin,I have these questions:
> 1. What will the server, which is not compatible with HTTP 1.1, do if it
> receives a HTTP 1.1 request? ( Our HTTP header has told that it is a HTTP
> 1.1 request.)
> 2. Should this be a server's misbehavior because spec does not insist send
> accept header? Or are there any common rules to guide this behavior? ( Do
> we
> only miss accept header?)
>
> On Tue, Dec 9, 2008 at 9:44 AM, Kevin Zhou <zh...@gmail.com> wrote:
>
> > Charles wrote,
> > > The spec of Http said that "all headers except Host are optional." It
> is
> > what the RI does.
> >
> > Yes, I think we should be compatible with RI's behaviors.
> >
>
>
>
> --
> Yours sincerely,
> Charles Lee
>

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by 李竞沁 <li...@gmail.com>.
Hi Kevin,I have these questions:
1. What will the server, which is not compatible with HTTP 1.1, do if it
receives a HTTP 1.1 request? ( Our HTTP header has told that it is a HTTP
1.1 request.)
2. Should this be a server's misbehavior because spec does not insist send
accept header? Or are there any common rules to guide this behavior? ( Do we
only miss accept header?)

On Tue, Dec 9, 2008 at 9:44 AM, Kevin Zhou <zh...@gmail.com> wrote:

> Charles wrote,
> > The spec of Http said that "all headers except Host are optional." It is
> what the RI does.
>
> Yes, I think we should be compatible with RI's behaviors.
>



-- 
Yours sincerely,
Charles Lee

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Kevin Zhou <zh...@gmail.com>.
Charles wrote,
> The spec of Http said that "all headers except Host are optional." It is
what the RI does.

Yes, I think we should be compatible with RI's behaviors.

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by 李竞沁 <li...@gmail.com>.
Hi Tim,No spec to insist what should be put in the request header. It is
what the RI does.

On Tue, Dec 9, 2008 at 12:35 AM, Tim Ellison <t....@gmail.com> wrote:

> 李竞沁 wrote:
> > Hi Kevin,
> > The spec of Http said that "all headers except Host are optional.". And I
> > have investigated in the java api spec. No information about what headers
> > should be sent by the HttpURLConnection. It maybe a different behavior
> > between RI and harmony.
> > By the way, user can use setRequestProperty(key, value) method to set the
> > header field which he want to send.
>
> Sorry, but I'm still back at questioning why we would express a
> preference for test/html, image/gif and image/jpeg at all on the "GET /"
> request.
>
> What am I missing?
> Tim
>



-- 
Yours sincerely,
Charles Lee

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Tim Ellison <t....@gmail.com>.
李竞沁 wrote:
> Hi Kevin,
> The spec of Http said that "all headers except Host are optional.". And I
> have investigated in the java api spec. No information about what headers
> should be sent by the HttpURLConnection. It maybe a different behavior
> between RI and harmony.
> By the way, user can use setRequestProperty(key, value) method to set the
> header field which he want to send.

Sorry, but I'm still back at questioning why we would express a
preference for test/html, image/gif and image/jpeg at all on the "GET /"
request.

What am I missing?
Tim

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by 李竞沁 <li...@gmail.com>.
Hi Kevin,
The spec of Http said that "all headers except Host are optional.". And I
have investigated in the java api spec. No information about what headers
should be sent by the HttpURLConnection. It maybe a different behavior
between RI and harmony.
By the way, user can use setRequestProperty(key, value) method to set the
header field which he want to send.

On Mon, Dec 8, 2008 at 9:03 PM, Kevin Zhou <zh...@gmail.com> wrote:

> The Accept request-header field can be used to specify certain media types
> which are acceptable for the response.
> The Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 is
> acquired
> when conducting HeaderTest on RI.
> It can be interpreted as: "I prefer any media type, but send me if it is
> the
> best available after an 80% mark-down in quality".
> This is a multi-part message in MIME format.
>
> I find that RI has such a support, but we doesn't.
> Is it necessary to follow RI's behaviors on this?
>
>
> I think our code does not have such a line.
>
> On Mon, Dec 8, 2008 at 8:04 PM, Tim Ellison <t....@gmail.com> wrote:
>
> > Kevin Zhou commented on HARMONY-6036:
> > > I investigated this problem and found that "Accept" property should
> > > be added in
> > >
> >
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.createRequest()
> > > method.
> > >
> > > From HTTP/1.1 specification,
> > >> "If no Accept header field is present, then it is assumed that
> > >> the client accepts all media types".
> > >
> > > if (reqHeader.get("Accept") == null) { //$NON-NLS-1$
> > > output.append("Accept: "text/html, image/gif, image/jpeg, *; "q=.2,
> > > */*; q=.2\r\n"); //$NON-NLS-1$ }>
> >
> > Kevin, can you help me to understand why we would express this set of
> > preferences in the Accept header for "/"?
> >
> > Its unclear to me why, by default, we would have that line?
> > (I understand what it does, just not which problem it solves.)
> >
> > Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
> >
> > Thanks,
> > Tim
> >
>



-- 
Yours sincerely,
Charles Lee

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Tim Ellison <t....@gmail.com>.
Kevin Zhou wrote:
> The Accept request-header field can be used to specify certain media types
> which are acceptable for the response.
> The Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 is acquired
> when conducting HeaderTest on RI.
> It can be interpreted as: "I prefer any media type, but send me if it is the
> best available after an 80% mark-down in quality".
> This is a multi-part message in MIME format.
> 
> I find that RI has such a support, but we doesn't.
> Is it necessary to follow RI's behaviors on this?
> 
> 
> I think our code does not have such a line.
>
> On Mon, Dec 8, 2008 at 8:04 PM, Tim Ellison <t....@gmail.com> wrote:
>> (I understand what it does, just not which problem it solves.)

See above ;-)

Is it a problem that we don't reply with that Accept: ?

Regards,
Tim

Re: [classlib] [luni] HttpURLConnection does not have the "Accept" header (HARMONY-6036)

Posted by Kevin Zhou <zh...@gmail.com>.
The Accept request-header field can be used to specify certain media types
which are acceptable for the response.
The Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 is acquired
when conducting HeaderTest on RI.
It can be interpreted as: "I prefer any media type, but send me if it is the
best available after an 80% mark-down in quality".
This is a multi-part message in MIME format.

I find that RI has such a support, but we doesn't.
Is it necessary to follow RI's behaviors on this?


I think our code does not have such a line.

On Mon, Dec 8, 2008 at 8:04 PM, Tim Ellison <t....@gmail.com> wrote:

> Kevin Zhou commented on HARMONY-6036:
> > I investigated this problem and found that "Accept" property should
> > be added in
> >
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.createRequest()
> > method.
> >
> > From HTTP/1.1 specification,
> >> "If no Accept header field is present, then it is assumed that
> >> the client accepts all media types".
> >
> > if (reqHeader.get("Accept") == null) { //$NON-NLS-1$
> > output.append("Accept: "text/html, image/gif, image/jpeg, *; "q=.2,
> > */*; q=.2\r\n"); //$NON-NLS-1$ }>
>
> Kevin, can you help me to understand why we would express this set of
> preferences in the Accept header for "/"?
>
> Its unclear to me why, by default, we would have that line?
> (I understand what it does, just not which problem it solves.)
>
> Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
>
> Thanks,
> Tim
>