白化病是什么原因引起的| 初中学历可以考什么证| 囗腔溃疡吃什么维生素| 通勤什么意思| 嘴苦是什么病的征兆| 止咳化痰吃什么好| 子鼠是什么意思| 老娘们是什么意思| 长命的动物是什么生肖| 撒尿分叉是什么原因| 小孩子坐飞机需要什么证件| 眉头长痘痘是因为什么原因引起的| 耳朵前面有痣代表什么| 辣条是什么意思| 见利忘义是什么生肖| 镀18k金是什么意思| 芳菲的意思是什么| 女孩子命硬有什么表现| 尿酸高什么意思| 挥霍是什么意思| 水手是什么意思| 脸上出油多是什么原因| 小孩脸肿是什么原因引起的| 生育登记有什么用| 藕带是什么| 焦虑挂什么科| 肺部感染吃什么药| 真菌镜检阳性是什么意思| 胸闷气短吃什么特效药| 肾是干什么用的| 什么水果是发物| 菊花有什么作用| 唐氏综合症是什么病| 萎缩性胃炎吃什么药效果好| 失眠有什么特效药| 心急如焚是什么意思| 月经推后是什么原因引起| 狗仗人势是什么生肖| 寒门什么意思| 佝偻病是什么意思| 肠道紊乱有什么症状| 吃哈密瓜有什么好处| 血糖高的人吃什么好| 尿酸高适合吃什么水果| 身体有异味是什么原因| 哮喘不能吃什么| 白痰多是什么原因| 小清新是什么意思啊| 张靓颖什么星座| 什么时候打仗| 强痛定又叫什么| 肌酐偏高是什么意思| 什么芒果好吃| 玄武岩属于什么岩石| 标准偏差是什么意思| 红花有什么功效| 嘴巴起水泡是什么原因| 白带发黄是什么原因引起的| 梦见猫咬我是什么意思| 什么是伤官见官| 扁桃体发炎发烧吃什么药| 低血糖会出现什么症状| 豆腐有什么营养| 面部提升做什么项目最好| 香菜什么时候种最合适| 台风什么时候到福建| 癔症是什么病| 儿童细菌感染吃什么药| 数目是什么意思| preparing是什么意思| 璇字五行属什么| 阴囊湿疹用什么药效果最好| 六级什么时候考| 什么是生活| 自我意识是什么意思| 梦见相亲是什么征兆| 来姨妈为什么是黑色的血| 加盟什么品牌好| 胸腔积液挂什么科| 12月20日什么星座| 检查肝功能挂什么科| 巨细胞病毒抗体阳性是什么意思| 蜂蜜跟什么不能一起吃| 黑匣子什么颜色| 惊厥是什么原因引起的| 腋臭和狐臭有什么区别| 蓁字五行属什么| 蚊子最怕什么| 海贼王什么时候出的| 钢铁锅含眼泪喊修瓢锅这是什么歌| 恭敬地看的词语是什么| 尿的颜色有点红褐色是什么原因| 什么药可以延长性功能| 拔罐挂什么科| 甘油三酯高吃什么能降下来| 智齿发炎吃什么消炎药| 砚是什么东西| 除皱针什么牌子效果最好| 去除扁平疣用什么药膏| 7777什么意思| 石敢当是什么神| 念珠菌阳性是什么病| 眼睛模糊流泪用什么药| 三险一金是什么| 宣府是现在的什么地方| 龟头太敏感吃什么药| 脑血管堵塞有什么症状| 灰指甲什么症状| tv是什么意思| 拉不出来屎是什么原因| 指甲变紫色是什么原因| 胎停有什么症状| 刻板是什么意思| 下雨天适合吃什么| fev1是什么意思| 宝宝蛋白质过敏喝什么奶粉| 鸽子喜欢吃什么食物| 赵本山是什么学历| tcl什么牌子| 什么地方能出生入死| 黄花梨树长什么样| 绝育手术对女性有什么危害| 舌头痒痒的是什么原因| 备孕需要做些什么准备| 急性咽喉炎吃什么药| 肾结石什么症状| 肠胃炎吃什么水果比较好| 1980年属什么生肖| 解离是什么意思| 屁多又臭是什么原因| 息风止痉是什么意思| 飞蚊症是什么原因| michaelkors是什么牌子| 中筛是检查什么项目| 墨迹什么意思| 粘膜充血水肿什么意思| olay是什么品牌| 风风火火是什么生肖| 做梦梦见下大雨是什么意思| 梦见绿豆是什么意思| 芊芊是什么意思| 一动就出汗吃什么药| 什么是抗凝药物| 挑染什么颜色好看| 伤官是什么意思| 阴道瘙痒是什么原因造成的| 痞气是什么意思| 鸡蛋吃多了有什么坏处| 什么叫便溏| 胳膊疼是什么病的前兆| 长骨刺是什么原因导致的| 年少有为什么意思| 胃胀吃什么药最有效| 叶酸吃到什么时候| 乳腺结节是什么| cbt是什么意思| 小儿湿疹是什么原因造成的| c3是什么| 气血不足吃什么补最快| 胶原蛋白起什么作用| 血压偏高吃什么药| 少了一个肾有什么影响| 什么样的肚子疼是癌| 和谐是什么| 枭印什么意思| 落枕是什么意思| 蟋蟀吃什么| 检查幽门螺旋杆菌挂什么科| 7d是什么意思| 扪及是什么意思| 调经止带是什么意思| Fine什么意思中文| 五红汤什么时候喝最好| 胸前有痣代表什么意思| 什么食物含蛋白高| 尿路感染吃什么药| 梦见捡菌子是什么预兆| 增肌吃什么最好| 卡地亚手表什么档次| 大便遇水就散什么原因| 办结婚证需要什么| 74年大溪水命缺什么| hay什么意思| 喆读什么| 穿刺检查是什么意思| 胃疼挂什么科| 花仙子是什么意思| 平板运动试验阳性是什么意思| 50pcs是什么意思| 四百多分能上什么大学| 吃什么助勃药能硬| 回声不均匀是什么意思| 小孩智力发育迟缓挂什么科| 七月十二是什么星座| 丝瓜不能和什么一起吃| 妇科衣原体感染是什么病| 双鱼座的幸运色是什么| 男人手大代表什么| lg是什么| 今年37岁属什么生肖| 一个月一个屯念什么| 香奶奶是什么牌子| 空谷幽兰下一句是什么| 被蚂蚁咬了怎么止痒消肿要擦什么药| 头发汗多是什么原因| 检查妇科清洁度三是什么意思| 阑尾炎做什么检查| 1997年属什么生肖| 15岁可以做什么兼职| 茯苓长什么样子图片| 杀虫剂中毒有什么症状| 二氧化硅是什么晶体| 25岁属什么生肖| 阴道放屁是什么原因| 平血头晕吃什么药最好| 来例假吃什么水果| 竖心旁的字和什么有关| 心火旺吃什么中成药| 梅毒检查什么项目| 了是什么词性| 吃了火龙果不能吃什么| 女性肾功能不好有什么症状| 头发发黄是什么原因造成的| 后背疼去医院挂什么科| 嘴巴下面长痘痘是什么原因引起的| 覆盖的意思是什么| 房门什么颜色好看| 养肝护肝吃什么好| 什么是处女| 送终是什么意思| 硬汉是什么意思| 脑电图是什么| 空调抽真空是什么意思| 米粉和米线有什么区别| 女性适合喝什么茶| 头晕是什么毛病| 吉士是什么| 腰肌劳损挂什么科| 肌酐低是什么意思| 中药龙骨是什么东西| 为什么会打哈欠| 双皮奶是什么| 同型半胱氨酸高有什么症状| 梦见袜子破了是什么意思| 子宫在肚脐眼什么位置| 老虎属于什么科| 白皮书是什么意思| 肝内低密度影是什么意思| 麦冬长什么样子图片| 男人耳朵大代表什么| 异性缘是什么意思| 蓝色配什么颜色好看| 结肠ca是什么意思| 什么水果是寒性的| 咳嗽消炎药吃什么好| 胃疼胃胀吃什么药好| 肠胃感冒吃什么| 减肥用什么好| 殳是什么意思| 三月十号是什么星座| 大便一粒粒的是什么原因| 小叶增生是什么原因导致的| 什么是体外受精| 孕妇晚上饿了吃什么好| 百度
blob: de9867ffa6823e805660e375e480daaeefe4c740 [file] [log] [blame]
Kenichi Ishibashifb675ae2025-08-05 07:21:331// Copyright 2024 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef NET_HTTP_HTTP_STREAM_POOL_JOB_H_
6#define NET_HTTP_HTTP_STREAM_POOL_JOB_H_
7
8#include <memory>
Kenichi Ishibashi7a7b7a412025-08-05 08:00:449#include <vector>
Kenichi Ishibashifb675ae2025-08-05 07:21:3310
11#include "base/memory/raw_ptr.h"
Kenichi Ishibashi3ac361a2025-08-05 11:50:2512#include "base/memory/weak_ptr.h"
Kenichi Ishibashie1486c82025-08-05 09:27:0113#include "base/time/time.h"
Kenichi Ishibashifb675ae2025-08-05 07:21:3314#include "net/base/net_error_details.h"
15#include "net/base/net_export.h"
16#include "net/dns/public/resolve_error_info.h"
17#include "net/http/http_stream_pool.h"
18#include "net/socket/connection_attempts.h"
19#include "net/socket/next_proto.h"
20#include "net/socket/stream_socket.h"
21#include "net/ssl/ssl_info.h"
Kenichi Ishibashi7a7b7a412025-08-05 08:00:4422#include "net/third_party/quiche/src/quiche/quic/core/quic_versions.h"
Kenichi Ishibashifb675ae2025-08-05 07:21:3323
24namespace net {
25
26class HttpStream;
27class SSLCertRequestInfo;
Kenichi Ishibashi7a7b7a412025-08-05 08:00:4428class NetLogWithSource;
Kenichi Ishibashifb675ae2025-08-05 07:21:3329struct NetErrorDetails;
30
Kenichi Ishibashif2c00912025-08-05 05:22:2431// Used by a `Delegate` to handle a stream request or a preconnect for a
32// destination. The destination could be the origin or alternative services.
Kenichi Ishibashifb675ae2025-08-05 07:21:3333class HttpStreamPool::Job {
34 public:
Kenichi Ishibashi8527116b2025-08-05 00:42:1435 // Interface to report Job's results. JobController is the only implementation
36 // of this interface other than tests. We abstract the interface to avoid a
37 // circular dependency.
Kenichi Ishibashifb675ae2025-08-05 07:21:3338 class NET_EXPORT_PRIVATE Delegate {
39 public:
40 virtual ~Delegate() = default;
41
Kenichi Ishibashi8527116b2025-08-05 00:42:1442 // Returns the priority of the job.
43 virtual RequestPriority priority() const = 0;
44
45 // Returns whether the limits should be respected.
46 virtual RespectLimits respect_limits() const = 0;
47
48 // Returns allowed bad certificates.
49 virtual const std::vector<SSLConfig::CertAndStatus>& allowed_bad_certs()
50 const = 0;
51
52 // True when IP-based pooling is enabled.
Kenichi Ishibashibe5f26f2025-08-05 00:48:0453 virtual bool enable_ip_based_pooling_for_h2() const = 0;
Kenichi Ishibashi8527116b2025-08-05 00:42:1454
55 // True when alternative services is enabled.
56 virtual bool enable_alternative_services() const = 0;
57
Kenichi Ishibashi0c22fa152025-08-05 10:47:0758 // Returns the set of ALPNs that are allowed for this job.
59 virtual NextProtoSet allowed_alpns() const = 0;
Kenichi Ishibashi8527116b2025-08-05 00:42:1460
61 // Returns the proxy info.
62 virtual const ProxyInfo& proxy_info() const = 0;
63
Kenichi Ishibashi4b517e72025-08-05 20:05:2264 virtual const NetLogWithSource& net_log() const = 0;
65
Kenichi Ishibashi8527116b2025-08-05 00:42:1466 // Callback methods: Only one of these methods will be called.
Kenichi Ishibashifb675ae2025-08-05 07:21:3367 // Called when a stream is ready.
68 virtual void OnStreamReady(Job* job,
69 std::unique_ptr<HttpStream> stream,
70 NextProto negotiated_protocol) = 0;
Kenichi Ishibashifb675ae2025-08-05 07:21:3371 // Called when stream attempts failed.
72 virtual void OnStreamFailed(Job* job,
73 int status,
74 const NetErrorDetails& net_error_details,
75 ResolveErrorInfo resolve_error_info) = 0;
Kenichi Ishibashifb675ae2025-08-05 07:21:3376 // Called when a stream attempt has failed due to a certificate error.
77 virtual void OnCertificateError(Job* job,
78 int status,
79 const SSLInfo& ssl_info) = 0;
Kenichi Ishibashifb675ae2025-08-05 07:21:3380 // Called when a stream attempt has requested a client certificate.
81 virtual void OnNeedsClientAuth(Job* job, SSLCertRequestInfo* cert_info) = 0;
Kenichi Ishibashif2c00912025-08-05 05:22:2482
83 // Called when the preconnect has completed.
84 virtual void OnPreconnectComplete(Job* job, int status) = 0;
Kenichi Ishibashifb675ae2025-08-05 07:21:3385 };
86
Kenichi Ishibashif2c00912025-08-05 05:22:2487 // `delegate` must outlive `this`. For a stream request, `num_streams` must
88 // not be specified. For a preconnect, `num_streams` must be specified.
Kenichi Ishibashi7a7b7a412025-08-05 08:00:4489 Job(Delegate* delegate,
Kenichi Ishibashifc262402025-08-05 06:33:0290 JobType type,
Kenichi Ishibashicd7f174a2025-08-05 08:29:4391 Group* group,
Kenichi Ishibashi8527116b2025-08-05 00:42:1492 quic::ParsedQuicVersion quic_version,
Kenichi Ishibashi6e3f2ecc2025-08-05 10:35:1093 NextProto expected_protocol,
Kenichi Ishibashif2c00912025-08-05 05:22:2494 const NetLogWithSource& request_net_log,
95 size_t num_streams = 0);
Kenichi Ishibashifb675ae2025-08-05 07:21:3396
Kenichi Ishibashifb675ae2025-08-05 07:21:3397 Job& operator=(const Job&) = delete;
98
99 ~Job();
100
Kenichi Ishibashi7a7b7a412025-08-05 08:00:44101 // Starts this job.
Kenichi Ishibashi8527116b2025-08-05 00:42:14102 void Start();
Kenichi Ishibashi7a7b7a412025-08-05 08:00:44103
Kenichi Ishibashifb675ae2025-08-05 07:21:33104 // Returns the LoadState of this job.
105 LoadState GetLoadState() const;
106
107 // Called when the priority of this job changes.
108 void SetPriority(RequestPriority priority);
109
Kenichi Ishibashifb675ae2025-08-05 07:21:33110 // Add connection attempts to the job.
111 void AddConnectionAttempts(const ConnectionAttempts& attempts);
112
113 // Called by the associated AttemptManager when a stream is ready.
114 void OnStreamReady(std::unique_ptr<HttpStream> stream,
115 NextProto negotiated_protocol);
116
117 // Called by the associated AttemptManager when stream attempts failed.
118 void OnStreamFailed(int rv,
119 const NetErrorDetails& net_error_details,
120 ResolveErrorInfo resolve_error_info);
121
122 // Called by the associated AttemptManager when an stream attempt has failed
123 // due to a certificate error.
124 void OnCertificateError(int status, const SSLInfo& ssl_info);
125
126 // Called by the associated AttemptManager when an stream attempt has
127 // requested a client certificate.
128 void OnNeedsClientAuth(SSLCertRequestInfo* cert_info);
129
Kenichi Ishibashif2c00912025-08-05 05:22:24130 // Called by the associated AttemptManager when the preconnect completed.
131 void OnPreconnectComplete(int status);
132
Kenichi Ishibashi2ef89362025-08-05 06:12:11133 // Helper method to call OnPreconnectComplete asynchronously. Used to avoid
134 // a dangling pointer since calling `delegate_->OnPreconnectComplete()`
135 // deletes `this` synchronously.
136 void CallOnPreconnectCompleteLater(int status);
137
Kenichi Ishibashi8527116b2025-08-05 00:42:14138 RequestPriority priority() const { return delegate_->priority(); }
Kenichi Ishibashif13437562025-08-05 11:16:39139
Kenichi Ishibashi8527116b2025-08-05 00:42:14140 RespectLimits respect_limits() const { return delegate_->respect_limits(); }
Kenichi Ishibashid1939d02025-08-05 21:02:48141
Kenichi Ishibashibe5f26f2025-08-05 00:48:04142 bool enable_ip_based_pooling_for_h2() const {
143 return delegate_->enable_ip_based_pooling_for_h2();
Kenichi Ishibashid1939d02025-08-05 21:02:48144 }
145
Kenichi Ishibashi8527116b2025-08-05 00:42:14146 bool enable_alternative_services() const {
147 return delegate_->enable_alternative_services();
148 }
149
150 const ProxyInfo& proxy_info() const { return delegate_->proxy_info(); }
Kenichi Ishibashif9856f42025-08-05 09:38:31151
Kenichi Ishibashif2c00912025-08-05 05:22:24152 const std::vector<SSLConfig::CertAndStatus>& allowed_bad_certs() const {
153 return delegate_->allowed_bad_certs();
154 }
155
156 const NetLogWithSource& delegate_net_log() const {
157 return delegate_->net_log();
158 }
159
Kenichi Ishibashi4b517e72025-08-05 20:05:22160 const NetLogWithSource& net_log() const { return job_net_log_; }
161
Kenichi Ishibashi5423f3f2025-08-05 03:06:39162 const NetLogWithSource& request_net_log() const { return request_net_log_; }
163
Kenichi Ishibashif2c00912025-08-05 05:22:24164 quic::ParsedQuicVersion quic_version() const { return quic_version_; }
165
Kenichi Ishibashi6feb68d2025-08-05 01:57:29166 const NextProtoSet& allowed_alpns() const { return allowed_alpns_; }
167
Kenichi Ishibashif2c00912025-08-05 05:22:24168 size_t num_streams() const { return num_streams_; }
169
Kenichi Ishibashifc262402025-08-05 06:33:02170 JobType type() const { return type_; }
Kenichi Ishibashif2c00912025-08-05 05:22:24171
Kenichi Ishibashifb675ae2025-08-05 07:21:33172 const ConnectionAttempts& connection_attempts() const {
173 return connection_attempts_;
174 }
175
Kenichi Ishibashie1486c82025-08-05 09:27:01176 base::TimeTicks create_time() const { return create_time_; }
177
Kenichi Ishibashifb675ae2025-08-05 07:21:33178 private:
Kenichi Ishibashifb675ae2025-08-05 07:21:33179 const raw_ptr<Delegate> delegate_;
Kenichi Ishibashifc262402025-08-05 06:33:02180 const JobType type_;
Kenichi Ishibashib3b948882025-08-05 07:32:52181 raw_ptr<AttemptManager> attempt_manager_;
182
Kenichi Ishibashi8527116b2025-08-05 00:42:14183 const quic::ParsedQuicVersion quic_version_;
Kenichi Ishibashi4886fe7672025-08-05 11:16:47184 const NextProtoSet allowed_alpns_;
Kenichi Ishibashi4b517e72025-08-05 20:05:22185 const NetLogWithSource request_net_log_;
186 const NetLogWithSource job_net_log_;
Kenichi Ishibashif2c00912025-08-05 05:22:24187 const size_t num_streams_;
Kenichi Ishibashie1486c82025-08-05 09:27:01188 const base::TimeTicks create_time_;
Kenichi Ishibashifb675ae2025-08-05 07:21:33189
Kenichi Ishibashib5c00a82025-08-05 07:21:33190 std::optional<int> result_;
Kenichi Ishibashi9306d5332025-08-05 06:59:08191 std::optional<NextProto> negotiated_protocol_;
Kenichi Ishibashib5c00a82025-08-05 07:21:33192
Kenichi Ishibashifb675ae2025-08-05 07:21:33193 ConnectionAttempts connection_attempts_;
Kenichi Ishibashi3ac361a2025-08-05 11:50:25194
195 base::WeakPtrFactory<Job> weak_ptr_factory_{this};
Kenichi Ishibashifb675ae2025-08-05 07:21:33196};
197
198} // namespace net
199
200#endif // NET_HTTP_HTTP_STREAM_POOL_JOB_H_
茶毫是什么 99足银是什么意思 什么是热量 a型血和a型血生的孩子是什么血型 小朋友口臭是什么原因
阴道壁是什么样的 yair是什么牌子的空调 浚字五行属什么 营养过剩会导致什么 做腹部彩超挂什么科
新生婴儿吃什么奶粉 什么样的细雨 为什么日语怎么说 舌头干涩是什么病前兆 人才辈出是什么意思
雷字五行属什么 吃饭后肚子疼是什么原因 孩子经常流鼻血是什么原因 十月什么星座 大肠炒什么菜好吃
指甲竖纹是什么原因hcv9jop1ns3r.cn 鼻子上长痘痘是什么原因hcv7jop9ns3r.cn 叶酸在什么食物里最多hcv7jop6ns1r.cn 丧是什么意思xscnpatent.com 蝉又叫什么名字hcv9jop0ns6r.cn
照看是什么意思hcv7jop7ns1r.cn 为什么会梦见前男友hcv8jop9ns0r.cn pd1是什么意思hcv9jop7ns2r.cn 转述句什么意思hcv9jop6ns4r.cn 阿胶补血口服液适合什么人喝hcv8jop2ns6r.cn
狮子被称为什么hcv7jop6ns1r.cn 焕字五行属什么hcv7jop5ns3r.cn 酉读什么hcv8jop6ns5r.cn 高血压中医叫什么hcv8jop8ns4r.cn 牵牛花为什么叫牵牛花mmeoe.com
鱼缸摆放什么位置最佳hcv8jop7ns0r.cn 五险一金指什么helloaicloud.com 干眼症缺乏什么维生素hcv9jop4ns5r.cn BE是什么hcv8jop7ns7r.cn 丙二醇是什么东西hcv9jop6ns4r.cn
百度