Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Issue 1604011: Use HttpRequestHeaders for extra_headers. (Closed)

Created:
10 years, 8 months ago by willchan no longer on Chromium
Modified:
9 years, 7 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Use HttpRequestHeaders for extra_headers. BUG=22588 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=45096

Patch Set 1 #

Total comments: 55

Patch Set 2 : Address eroman's comments. #

Patch Set 3 : GetHeader #

Total comments: 12

Patch Set 4 : Address eroman comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+409 lines, -372 lines) Patch
M base/string_util.cc View 1 chunk +0 lines, -14 lines 0 comments Download
M net/http/http_auth_handler.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_auth_sspi_win.h View 2 chunks +1 line, -2 lines 0 comments Download
M net/http/http_basic_stream.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_cache.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_cache_transaction.cc View 1 2 5 chunks +38 lines, -45 lines 0 comments Download
M net/http/http_cache_unittest.cc View 1 2 42 chunks +62 lines, -73 lines 0 comments Download
M net/http/http_network_layer_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download
M net/http/http_network_transaction.cc View 1 2 3 6 chunks +20 lines, -32 lines 0 comments Download
M net/http/http_network_transaction_unittest.cc View 4 chunks +8 lines, -4 lines 0 comments Download
M net/http/http_request_headers.h View 1 2 3 3 chunks +70 lines, -21 lines 0 comments Download
M net/http/http_request_headers.cc View 1 2 3 4 chunks +63 lines, -20 lines 0 comments Download
M net/http/http_request_headers_unittest.cc View 2 3 3 chunks +24 lines, -4 lines 0 comments Download
M net/http/http_request_info.h View 2 chunks +4 lines, -7 lines 0 comments Download
M net/http/http_stream.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_stream_parser.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_transaction.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_transaction_unittest.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_util.h View 1 chunk +5 lines, -0 lines 0 comments Download
M net/http/http_util.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M net/http/http_vary_data.h View 1 chunk +1 line, -1 line 0 comments Download
M net/http/http_vary_data.cc View 1 2 3 2 chunks +7 lines, -21 lines 0 comments Download
M net/http/http_vary_data_unittest.cc View 4 chunks +8 lines, -7 lines 0 comments Download
M net/http/partial_data.h View 1 4 chunks +9 lines, -8 lines 0 comments Download
M net/http/partial_data.cc View 1 2 5 chunks +27 lines, -23 lines 0 comments Download
M net/spdy/spdy_network_transaction_unittest.cc View 1 4 chunks +7 lines, -55 lines 0 comments Download
M net/spdy/spdy_session.h View 1 chunk +1 line, -1 line 0 comments Download
M net/spdy/spdy_session.cc View 1 2 chunks +7 lines, -7 lines 0 comments Download
M net/url_request/url_request_http_job.cc View 1 8 chunks +32 lines, -19 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
willchan no longer on Chromium
eroman: Please review it all in general. rvargas: Please review all the HttpCache related files.
10 years, 8 months ago (2010-04-04 10:23:06 UTC) #1
eroman
nice change! my important comments are: http://codereview.chromium.org/1604011/diff/1/12#newcode216 http://codereview.chromium.org/1604011/diff/1/14#newcode32 http://codereview.chromium.org/1604011/diff/1/29#newcode339 http://codereview.chromium.org/1604011/diff/1/7 File net/http/http_cache_transaction.cc (right): http://codereview.chromium.org/1604011/diff/1/7#newcode84 net/http/http_cache_transaction.cc:84: ...
10 years, 8 months ago (2010-04-04 22:14:42 UTC) #2
willchan no longer on Chromium
I think I've addressed almost all your comments. I haven't analyzed the GetHeader() comments yet. ...
10 years, 8 months ago (2010-04-05 18:35:25 UTC) #3
willchan no longer on Chromium
Updated GetHeader() now. http://codereview.chromium.org/1604011/diff/1/13 File net/http/http_request_headers.h (right): http://codereview.chromium.org/1604011/diff/1/13#newcode93 net/http/http_request_headers.h:93: const std::string* GetHeader(const base::StringPiece& key) const; ...
10 years, 8 months ago (2010-04-05 20:28:43 UTC) #4
eroman
lgtm http://codereview.chromium.org/1604011/diff/1/7 File net/http/http_cache_transaction.cc (right): http://codereview.chromium.org/1604011/diff/1/7#newcode84 net/http/http_cache_transaction.cc:84: const std::string* header_value = headers.GetHeader(search->name); On 2010/04/05 18:35:25, ...
10 years, 8 months ago (2010-04-06 05:49:54 UTC) #5
rvargas (doing something else)
LGTM. Http-cache-unittest.cc(2373): nit. It looks better with "\r\n" added to the previous line. Http-cache-unittest.cc(767): removing ...
10 years, 8 months ago (2010-04-07 21:50:17 UTC) #6
willchan no longer on Chromium
On 2010/04/07 21:50:17, rvargas wrote: > LGTM. > Http-cache-unittest.cc(2373): nit. It looks better with "\r\n" ...
10 years, 8 months ago (2010-04-07 22:01:52 UTC) #7
rvargas1
Just make sure that the PDF plugin works as usual... displaying pdfs instead of downloading ...
10 years, 8 months ago (2010-04-07 23:58:19 UTC) #8
willchan no longer on Chromium
On Wed, Apr 7, 2010 at 2:50 PM, <rvargas@chromium.org> wrote: > LGTM. > Http-cache-unittest.cc(2373): nit. ...
10 years, 8 months ago (2010-04-08 00:10:41 UTC) #9
rvargas1
That basically answers the question about other headers. There are two types of values for ...
10 years, 8 months ago (2010-04-08 00:32:08 UTC) #10
willchan no longer on Chromium
Oops, I had dropped everyone else. I've added them back. Eric, please chime in if ...
10 years, 8 months ago (2010-04-08 07:31:32 UTC) #11
willchan no longer on Chromium
On 2010/04/08 07:31:32, willchan wrote: > Oops, I had dropped everyone else. I've added them ...
10 years, 8 months ago (2010-04-16 00:10:36 UTC) #12
willchan no longer on Chromium
http://codereview.chromium.org/1604011/diff/1/12 File net/http/http_request_headers.cc (right): http://codereview.chromium.org/1604011/diff/1/12#newcode216 net/http/http_request_headers.cc:216: if (!base::strncasecmp(key.data(), it->key.data(), key.length())) On 2010/04/06 05:49:54, eroman wrote: ...
10 years, 8 months ago (2010-04-16 00:10:55 UTC) #13
rvargas (doing something else)
On 2010/04/16 00:10:36, willchan wrote: > On 2010/04/08 07:31:32, willchan wrote: > > Oops, I ...
10 years, 8 months ago (2010-04-16 00:54:53 UTC) #14
willchan no longer on Chromium
On 2010/04/16 00:54:53, rvargas wrote: > On 2010/04/16 00:10:36, willchan wrote: > > On 2010/04/08 ...
10 years, 8 months ago (2010-04-16 01:09:23 UTC) #15
rvargas (doing something else)
On 2010/04/16 01:09:23, willchan wrote: > On 2010/04/16 00:54:53, rvargas wrote: > > On 2010/04/16 ...
10 years, 8 months ago (2010-04-16 01:36:49 UTC) #16
willchan no longer on Chromium
10 years, 8 months ago (2010-04-16 22:41:38 UTC) #17
Ok, does everyone agree to punt this next step to another CL?  Let me know, and
if so, I'll commit this, pending eroman's LGTM.

On 2010/04/16 01:36:49, rvargas wrote:
> On 2010/04/16 01:09:23, willchan wrote:
> > On 2010/04/16 00:54:53, rvargas wrote:
> > > On 2010/04/16 00:10:36, willchan wrote:
> > > > On 2010/04/08 07:31:32, willchan wrote:
> > > > > Oops, I had dropped everyone else.  I've added them back.  Eric,
> > > > > please chime in if you have an opinion.  I'll think some more about
> > > > > this and reply tomorrow.
> > > > > 
> > > > > 2010/4/8 Ricardo Vargas <rvargas@google.com>:
> > > > > > I basically agree with everything you said.
> > > > > > Maybe we can have a different method to replace a header, and
another
> > one
> > > to
> > > > > > append a value at the end (plus the current set+dcheck). That way
the
> > > caller
> > > > > > can use the right one without having to split the headers in two:
from
> > net
> > > > > > it doesn't matter who set a header, but usually there is a separate
> code
> > > > > > path for a header already present.
> > > > > > On second thought, we could have only two methods and require the
use
> of
> > > > > > remove+set to replace a header... at least from net I don't think we
> > > should
> > > > > > replace something set by the caller unless we do it intentionally.
> > > > 
> > > > I'm not sure either of these methods work unless you have two separate
> > > > HttpRequestHeaders instances.  Let me know if I'm missing something. 
What
> > I'm
> > > > thinking is that, if we keep the extra_headers field as our working
copy,
> as
> > > > opposed to being a non_network_stack_set_headers, then as we update
> > > > extra_headers with SetHeader() and friends, we don't know if we are
> > > > deleting/overwriting/appending to a header set within the network stack
as
> > > > opposed to one outside the network stack.  This is because, as we move
> later
> > > on
> > > > through the network stack code, we won't know, for a given header in
> > > > extra_headers, whether or not it was set by the net/ or non-net/ code.
> > > 
> > > We could have separate headers as you describe, but my point is that for a
> > given
> > > piece of code at layer x on the net stack:
> > > 
> > > 1. If we are interested in a given header, we should see if that header is
> > > already set by a higher layer (net/browser/renderer/plugin) and if the
> > previous
> > > setting is something that we want to override, or something that changes
our
> > > behavior somehow. In other words I don't see clearly why net_layer_x
should
> > care
> > > if the header was set by net_layer_y or not.
> > > 2. If we decide to override, we do it explicitly
> > > 3. If we can keep both values we append to this header
> > > 4. If we are just setting the header, we'll DCHECK if the header was
already
> > > set.
> > 
> > I guess I don't see how 4 is ever valid, since it's possible for _any_
header
> to
> > already have been set by an XHR, so I don't think we can ever DCHECK on it. 
> > Let's take Cache-Control/Content-Length/Referer/Host/etc for example.  I
think
> > we these headers should only be set in BuildRequestHeaders() in
> > net/http/http_network_transaction.cc.  I want to DCHECK if other net code is
> > setting this.  If an XHR set it, I do not want to DCHECK (since I suspect
it's
> > valid, albeit stupid, for an XHR to set headers like this [or does WebKit
> strip
> > this guys out?]).  I don't see in your system how I would accomplish this.
> > 
> 
> 4 just means that 1 takes place... in other words, that we don't call
> SetHeader() without first looking at the headers already set.
> 
> Yes, with one approach you cannot DCHECK if somebody in the net stack sets a
> given header
> 
> With the other approach you cannot DCHECK if somebody in the net stack sets a
> given header that is already provided by the browser without realizing it. 
> 
> It's probably as easy for somebody to add one of the headers you mention from
> the net module as it is from the browser or plugin code, and there is no way
to
> DCHECK that.
> 
> To be fair, I see the two approaches very similar and don't mind either one
(nor
> do I think that they should be implemented with this CL).

Powered by Google App Engine
This is Rietveld 408576698