Chromium Code Reviews| Index: net/http/http_stream_factory_impl_job.cc |
| =================================================================== |
| --- net/http/http_stream_factory_impl_job.cc (revision 113620) |
| +++ net/http/http_stream_factory_impl_job.cc (working copy) |
| @@ -485,6 +485,10 @@ |
| State state = next_state_; |
| next_state_ = STATE_NONE; |
| switch (state) { |
| + case STATE_START: |
| + DCHECK_EQ(OK, rv); |
| + rv = DoStart(); |
| + break; |
| case STATE_RESOLVE_PROXY: |
| DCHECK_EQ(OK, rv); |
| rv = DoResolveProxy(); |
| @@ -534,21 +538,29 @@ |
| int HttpStreamFactoryImpl::Job::StartInternal() { |
| CHECK_EQ(STATE_NONE, next_state_); |
| - |
| - origin_ = HostPortPair(request_info_.url.HostNoBrackets(), |
| - request_info_.url.EffectiveIntPort()); |
| - origin_url_ = HttpStreamFactory::ApplyHostMappingRules( |
| - request_info_.url, &origin_); |
| - |
| + next_state_ = STATE_START; |
| net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, |
| HttpStreamJobParameters::Create(request_info_.url, |
| origin_url_)); |
|
wtc
2012/01/14 01:34:46
In the original code, we have already initialized
mmenke
2012/01/14 02:19:21
Definitely a bug. Thanks for spotting this.
|
| - next_state_ = STATE_RESOLVE_PROXY; |
| int rv = RunLoop(OK); |
| DCHECK_EQ(ERR_IO_PENDING, rv); |
| return rv; |
| } |
| +int HttpStreamFactoryImpl::Job::DoStart() { |
|
willchan no longer on Chromium
2011/12/12 18:24:16
Almost all the rest of our states have DoFoo() and
mmenke
2011/12/12 18:43:21
Currently it's expected to always return asynchron
willchan no longer on Chromium
2011/12/12 19:04:58
Oh I see. I think I'd like to modify all call site
mmenke
2011/12/12 19:10:03
Sure, will do.
mmenke
2011/12/13 16:35:00
Making this able to fail synchronously is enough o
mmenke
2011/12/13 16:44:32
Or I could just add an OnStartComplete function th
|
| + // Don't connect to restricted ports. |
| + int port = request_info_.url.EffectiveIntPort(); |
| + if (!IsPortAllowedByDefault(port) && !IsPortAllowedByOverride(port)) |
| + return ERR_UNSAFE_PORT; |
|
wtc
2012/01/14 01:34:46
Before DoResolveProxyComplete() returns an error c
mmenke
2012/01/14 02:19:21
I agree. There's no fall through to automatically
|
| + |
| + origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); |
| + origin_url_ = HttpStreamFactory::ApplyHostMappingRules( |
| + request_info_.url, &origin_); |
| + |
| + next_state_ = STATE_RESOLVE_PROXY; |
| + return OK; |
| +} |
| + |
| int HttpStreamFactoryImpl::Job::DoResolveProxy() { |
| DCHECK(!pac_request_); |