Skip to content

Commit 7cb75b4

Browse files
committed
update
1 parent 8bb9c84 commit 7cb75b4

8 files changed

Lines changed: 183 additions & 202 deletions

File tree

examples/emulation_firefox.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async fn main() -> wreq::Result<()> {
172172
Http2Options::builder()
173173
.initial_stream_id(15)
174174
.header_table_size(65536)
175-
.initial_stream_window_size(131072)
175+
.initial_window_size(131072)
176176
.max_frame_size(16384)
177177
.initial_connection_window_size(12517377 + 65535)
178178
.headers_stream_dependency(StreamDependency::new(StreamId::from(13), 41, false))

examples/emulation_twitter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async fn main() -> wreq::Result<()> {
5353
// HTTP/2 options config
5454
let http2 = Http2Options::builder()
5555
.initial_stream_id(3)
56-
.initial_stream_window_size(16777216)
56+
.initial_window_size(16777216)
5757
.initial_connection_window_size(16711681 + 65535)
5858
.headers_pseudo_order(
5959
PseudoOrder::builder()

examples/request_with_emulation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async fn main() -> wreq::Result<()> {
5353
// HTTP/2 options config
5454
let http2 = Http2Options::builder()
5555
.initial_stream_id(3)
56-
.initial_stream_window_size(16777216)
56+
.initial_window_size(16777216)
5757
.initial_connection_window_size(16711681 + 65535)
5858
.headers_pseudo_order(
5959
PseudoOrder::builder()

src/core/client/conn/http2.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ where
238238
let h2 = proto::h2::client::handshake(
239239
io,
240240
rx,
241-
&builder.opts.config,
241+
builder.opts.builder,
242+
builder.opts.ping_config,
242243
builder.exec,
243244
builder.timer,
244245
)

src/core/client/options/http1.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::core::proto;
88
#[must_use]
99
#[derive(Debug)]
1010
pub struct Http1OptionsBuilder {
11-
config: Http1Options,
11+
opts: Http1Options,
1212
}
1313

1414
/// HTTP/1 protocol options for customizing connection behavior.
@@ -29,7 +29,7 @@ pub struct Http1Options {
2929
impl Http1OptionsBuilder {
3030
/// Set the `http09_responses` field.
3131
pub fn http09_responses(mut self, enabled: bool) -> Self {
32-
self.config.h09_responses = enabled;
32+
self.opts.h09_responses = enabled;
3333
self
3434
}
3535

@@ -46,7 +46,7 @@ impl Http1OptionsBuilder {
4646
/// Default is `auto`. In this mode crate::core: will try to guess which
4747
/// mode to use
4848
pub fn writev(mut self, writev: Option<bool>) -> Self {
49-
self.config.h1_writev = writev;
49+
self.opts.h1_writev = writev;
5050
self
5151
}
5252

@@ -58,7 +58,7 @@ impl Http1OptionsBuilder {
5858
///
5959
/// Default is false.
6060
pub fn preserve_header_case(mut self, preserve_header_case: bool) -> Self {
61-
self.config.h1_preserve_header_case = preserve_header_case;
61+
self.opts.h1_preserve_header_case = preserve_header_case;
6262
self
6363
}
6464

@@ -76,7 +76,7 @@ impl Http1OptionsBuilder {
7676
///
7777
/// Default is 100.
7878
pub fn max_headers(mut self, max_headers: usize) -> Self {
79-
self.config.h1_max_headers = Some(max_headers);
79+
self.opts.h1_max_headers = Some(max_headers);
8080
self
8181
}
8282

@@ -86,8 +86,8 @@ impl Http1OptionsBuilder {
8686
///
8787
/// Default is an adaptive read buffer.
8888
pub fn read_buf_exact_size(mut self, sz: Option<usize>) -> Self {
89-
self.config.h1_read_buf_exact_size = sz;
90-
self.config.h1_max_buf_size = None;
89+
self.opts.h1_read_buf_exact_size = sz;
90+
self.opts.h1_max_buf_size = None;
9191
self
9292
}
9393

@@ -107,8 +107,8 @@ impl Http1OptionsBuilder {
107107
"the max_buf_size cannot be smaller than the minimum that h1 specifies."
108108
);
109109

110-
self.config.h1_max_buf_size = Some(max);
111-
self.config.h1_read_buf_exact_size = None;
110+
self.opts.h1_max_buf_size = Some(max);
111+
self.opts.h1_read_buf_exact_size = None;
112112
self
113113
}
114114

@@ -130,7 +130,7 @@ impl Http1OptionsBuilder {
130130
///
131131
/// [RFC 7230 Section 3.2.4.]: https://tools.ietf.org/html/rfc7230#section-3.2.4
132132
pub fn allow_spaces_after_header_name_in_responses(mut self, enabled: bool) -> Self {
133-
self.config
133+
self.opts
134134
.h1_parser_config
135135
.allow_spaces_after_header_name_in_responses(enabled);
136136
self
@@ -144,7 +144,7 @@ impl Http1OptionsBuilder {
144144
///
145145
/// Default is false.
146146
pub fn ignore_invalid_headers_in_responses(mut self, enabled: bool) -> Self {
147-
self.config
147+
self.opts
148148
.h1_parser_config
149149
.ignore_invalid_headers_in_responses(enabled);
150150
self
@@ -155,7 +155,7 @@ impl Http1OptionsBuilder {
155155
mut self,
156156
allow_obsolete_multiline_headers_in_responses: bool,
157157
) -> Self {
158-
self.config
158+
self.opts
159159
.h1_parser_config
160160
.allow_obsolete_multiline_headers_in_responses(
161161
allow_obsolete_multiline_headers_in_responses,
@@ -165,15 +165,15 @@ impl Http1OptionsBuilder {
165165

166166
/// Build the `Http1Options` instance.
167167
pub fn build(self) -> Http1Options {
168-
self.config
168+
self.opts
169169
}
170170
}
171171

172172
impl Http1Options {
173173
/// Create a new `Http1OptionsBuilder`.
174174
pub fn builder() -> Http1OptionsBuilder {
175175
Http1OptionsBuilder {
176-
config: Http1Options::default(),
176+
opts: Http1Options::default(),
177177
}
178178
}
179179
}

0 commit comments

Comments
 (0)