profile
viewpoint
Ivan Nikulin inikulin @Cloudflare London, UK :cat: :dog: :cow: :bird: :rabbit: :horse:

cloudflare/wirefilter 617

An execution engine for Wireshark-like filters

inikulin/callsite-record 152

Create fancy log entries for errors and function call sites

inikulin/elegant-status 130

Create elegant task status for CLI.

inikulin/dmn 95

Janitor for your node_modules

inikulin/gulp-ll 86

Run CPU-consuming Gulp tasks in the separate processes to achieve faster builds.

inikulin/esotope 37

ECMAScript code generator on steroids

inikulin/cookie-compat 28

Browsers RFC 6265 compatibility research - http://inikulin.github.io/cookie-compat.

inikulin/highlight-es 21

Highlight ECMAScript syntax for the console or any other medium.

inikulin/endpoint-utils 17

Utils to deal with TCP ports and hostnames. Safe for everyday use.

inikulin/bin-v8-flags-filter 7

Filters out v8 flags for your Node.js CLIs.

pull request commentsnapview/tungstenite-rs

GH-46 Return the response in case of non-101 response from server

@application-developer-DA with that plan, will it be possible to opt-out from built-in redirect following logic?

inikulin

comment created time in 6 days

push eventcloudflare/lol-html

Joshua Nelson

commit sha 92ffdce26a0d6a8295a8e4d65e19200ffb97ddf4

Take `self` in HtmlRewriter::end (#68) * Take `self` in HtmlRewriter::end > IIRC there were some problems with C API because of that. Need to check. This was the error: ``` error[E0507]: cannot move out of `*rewriter` which is behind a mutable reference --> src/rewriter.rs:80:31 | 80 | unwrap_or_ret_err_code! { rewriter.end() }; | ^^^^^^^^ move occurs because `*rewriter` has type `lol_html::HtmlRewriter<'_, rewriter::ExternOutputSink>`, which does not implement the `Copy` trait ``` This commit adds a new `Option` wrapper which allows calling `end()` on a mutable reference. As a side effect, calling `free()` multiple has no effect as long as `end()` was called first. This also removes tests that `end()` panics when call twice, and that `write()` panics when called after `read()`, because they no longer compile: ``` error[E0382]: borrow of moved value: `rewriter` --> src/rewriter/mod.rs:610:13 | 607 | let mut rewriter = create_rewriter(512, |_: &[u8]| {}); | ------------ move occurs because `rewriter` has type `rewriter::HtmlRewriter<'_, [closure@src/rewriter/mod.rs:607:53: 607:66]>`, which does not implement the `Copy` trait 608 | 609 | rewriter.end().unwrap(); | ----- `rewriter` moved due to this method call 610 | rewriter.write(b"foo").unwrap(); | ^^^^^^^^ value borrowed here after move error[E0382]: use of moved value: `rewriter` --> src/rewriter/mod.rs:619:13 | 616 | let mut rewriter = create_rewriter(512, |_: &[u8]| {}); | ------------ move occurs because `rewriter` has type `rewriter::HtmlRewriter<'_, [closure@src/rewriter/mod.rs:616:53: 616:66]>`, which does not implement the `Copy` trait 617 | 618 | rewriter.end().unwrap(); | ----- `rewriter` moved due to this method call 619 | rewriter.end().unwrap(); | ^^^^^^^^ value used here after move ``` As a small performance benefit, `finished` can be removed, making the rewriter take up slightly less memory from Rust (but not from C). * Fix fuzz test cases This seems related to https://github.com/cloudflare/lol-html/pull/70, but for some reason only showed up in the CI for https://github.com/cloudflare/lol-html/pull/68.

view details

push time in 7 days

PR merged cloudflare/lol-html

Take `self` in HtmlRewriter::end

IIRC there were some problems with C API because of that. Need to check.

This was the error:

error[E0507]: cannot move out of `*rewriter` which is behind a mutable reference
  --> src/rewriter.rs:80:31
   |
80 |     unwrap_or_ret_err_code! { rewriter.end() };
   |                               ^^^^^^^^ move occurs because `*rewriter` has type `lol_html::HtmlRewriter<'_, rewriter::ExternOutputSink>`, which does not implement the `Copy` trait

This commit combines end() and free() into the same function for the C API. It also removes tests that end() panics when call twice, and that write() panics when called after read(), because they no longer compile:

error[E0382]: borrow of moved value: `rewriter`
   --> src/rewriter/mod.rs:610:13
    |
607 |             let mut rewriter = create_rewriter(512, |_: &[u8]| {});
    |                 ------------ move occurs because `rewriter` has type `rewriter::HtmlRewriter<'_, [closure@src/rewriter/mod.rs:607:53: 607:66]>`, which does not implement the `Copy` trait
608 |
609 |             rewriter.end().unwrap();
    |                      ----- `rewriter` moved due to this method call
610 |             rewriter.write(b"foo").unwrap();
    |             ^^^^^^^^ value borrowed here after move

error[E0382]: use of moved value: `rewriter`
   --> src/rewriter/mod.rs:619:13
    |
616 |             let mut rewriter = create_rewriter(512, |_: &[u8]| {});
    |                 ------------ move occurs because `rewriter` has type `rewriter::HtmlRewriter<'_, [closure@src/rewriter/mod.rs:616:53: 616:66]>`, which does not implement the `Copy` trait
617 |
618 |             rewriter.end().unwrap();
    |                      ----- `rewriter` moved due to this method call
619 |             rewriter.end().unwrap();
    |             ^^^^^^^^ value used here after move

As a small performance benefit, finished can be removed, making the rewriter take up slightly less memory.

Closes https://github.com/cloudflare/lol-html/issues/59. I didn't run the Rust tests because of https://github.com/rustation/pre-commit/issues/2, but the C tests all pass.

This is a breaking change.

+42 -59

12 comments

4 changed files

jyn514

pr closed time in 7 days

issue closedcloudflare/lol-html

HtmlRewriter::end() should take `self`, not `&mut self`

As documented, both end() and write() will panic if you do anything with the rewriter after you call end(). This can be enforced statically by having end() consume the writer.

closed time in 7 days

jyn514

pull request commentcloudflare/lol-html

Take `self` in HtmlRewriter::end

@jyn514 thanks a lot for all the contributions

jyn514

comment created time in 7 days

pull request commentcloudflare/lol-html

Take `self` in HtmlRewriter::end

@jyn514 seems like CI's unhappy for some reason

jyn514

comment created time in 8 days

pull request commentcloudflare/lol-html

Take `self` in HtmlRewriter::end

@jyn514 it needs rebase now

jyn514

comment created time in 8 days

push eventcloudflare/lol-html

Joshua Nelson

commit sha 3567fcf85fb33f515bd82488ba446cef3ccf2fbe

Refactor HTMLRewriter Settings to make `HTMLRewriter::new` infallible (#70) * Refactor HTMLRewriter Settings to make `HTMLRewriter::new` infallible - Add `AsciiCompatibleEncoding` wrapper type - Provide ways to convert between `Ascii...` and `Encoding` - Make `new` infallible - Fix tests, examples, and benches This turned out very well - you only have to worry about fallible conversions if you use an encoding other than the default, which is fairly rare. * Fix C tests and move EncodingError to C Previously, `EncodingError` was part of lol_html proper. Now, it's specific to the C API, which can't pass the rust type `Encoding` and has to pass strings instead.

view details

push time in 8 days

PR merged cloudflare/lol-html

Refactor HTMLRewriter Settings to make `HTMLRewriter::new` infallible
  • Add AsciiCompatibleEncoding wrapper type
  • Provide ways to convert between Ascii... and Encoding
  • Make new infallible
  • Fix tests, examples, and benches

This turned out very well - you only have to worry about fallible conversions if you use an encoding other than the default, which is fairly rare.

This is a breaking change.

Closes https://github.com/cloudflare/lol-html/issues/46.

+436 -429

2 comments

17 changed files

jyn514

pr closed time in 8 days

issue closedcloudflare/lol-html

Refactor HTMLRewriter Settings to deprecate "try_new"

HTMLRewriter's creation interface is a bit clunky, since it requires calling try_new even if you know that an encoding is valid (for example with Default). Encoding should be checked ahead of time via a wrapper type and try_new should be deprecated and replaced with an infallible new to simplify the API.

See the API guidelines on static parameter enforcement.

closed time in 8 days

ObsidianMinor
PullRequestReviewEvent

Pull request review commentcloudflare/lol-html

Take `self` in HtmlRewriter::end

 pub extern "C" fn lol_html_rewriter_build(     };      let output_sink = ExternOutputSink::new(output_sink, output_sink_user_data);-    let rewriter = unwrap_or_ret_null! { HtmlRewriter::try_new(settings, output_sink) };+    let rewriter = unwrap_or_ret_null! { lol_html::HtmlRewriter::try_new(settings, output_sink) }; -    to_ptr_mut(rewriter)+    to_ptr_mut(HtmlRewriter(Some(rewriter))) }  #[no_mangle] pub extern "C" fn lol_html_rewriter_write(-    rewriter: *mut HtmlRewriter<'static, ExternOutputSink>,+    rewriter: *mut HtmlRewriter,     chunk: *const c_char,     chunk_len: size_t, ) -> c_int {     let chunk = to_bytes!(chunk, chunk_len);-    let rewriter = to_ref_mut!(rewriter);+    let rewriter = to_ref_mut!(rewriter)+        .0+        .as_mut()+        .expect("cannot call `lol_html_rewriter_write` after calling `end()`");      unwrap_or_ret_err_code! { rewriter.write(chunk) };      0 }  #[no_mangle]-pub extern "C" fn lol_html_rewriter_end(-    rewriter: *mut HtmlRewriter<'static, ExternOutputSink>,-) -> c_int {-    let rewriter = to_ref_mut!(rewriter);+pub extern "C" fn lol_html_rewriter_end(rewriter: *mut HtmlRewriter) -> c_int {+    let rewriter = to_ref_mut!(rewriter)+        .0+        .take() // Using `take()` allows calling `free()` afterwards (it will be a no-op).+        .expect("cannot call `lol_html_rewriter_end` after calling `end()`");

I guess it should be "after calling lol_html_rewriter_free or lol_html_rewriter_end"?

jyn514

comment created time in 8 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentcloudflare/lol-html

Take `self` in HtmlRewriter::end

If I remember correctly we've tried this approach (with end() performing implicit freeing) initially and there were some issue with C++ RAII or something (don't remember all the details tbh). And folks from the Workers team asked me to introduce explicit free().

The problem with end() performing freeing is that it doesn't account for the cases when handlers error and the rewriter becomes poisoned. So, you need to free the rewriter without end() ever being called. And in general, I would like to avoid introducing breaking changes in the C API part to not break stuff for Cloudflare Workers.

What we can do instead is consume self on Rust side. But for C API use HtmlRewriterWrapper(Option<HtmlRewriter>) which derefs to rewriter. We'll keep free() which will free the rewriter if it's not None at this point (end() hasn't be called) or will be noop otherwise. And for end() we'll do self.0.take().

jyn514

comment created time in 10 days

push eventcloudflare/lol-html

Joshua Nelson

commit sha e0eaf6c4234af855d3b77e6cb1731f5f33d0d6fb

Allow using `element!` in a separate expression from `rewrite_str` (#69)

view details

push time in 10 days

PR merged cloudflare/lol-html

Allow using `element!` in a separate expression from `rewrite_str`

Closes https://github.com/cloudflare/lol-html/issues/55. This is a breaking change.

+38 -27

1 comment

5 changed files

jyn514

pr closed time in 10 days

issue closedcloudflare/lol-html

`element_content_handlers` is difficult to use

The docs suggest to use element!, let's use element:

    let settings = RewriteStrSettings {
        element_content_handlers: vec![element!("head", head_handler), element!("body", body_handler)],
        ..RewriteStrSettings::default()
    };

    lol_html::rewrite_str(html, settings)
error[E0716]: temporary value dropped while borrowed
  --> src/utils/html.rs:39:40
   |
39 |         element_content_handlers: vec![element!("head", head_handler), element!("body", body_handler)],
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
40 |         ..RewriteStrSettings::default()
41 |     };
   |      - temporary value is freed at the end of this statement
42 | 
43 |     lol_html::rewrite_str(html, settings)
   |                                 -------- borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Hmm, that's weird, I don't see any temporaries. Let's try adding a let binding like the compiler suggests:

    let element_content_handlers = vec![element!("head", head_handler), element!("body", body_handler)];
    let settings = RewriteStrSettings {
        element_content_handlers,
        ..RewriteStrSettings::default()
    };
error[E0716]: temporary value dropped while borrowed
  --> src/utils/html.rs:38:41
   |
38 |     let element_content_handlers = vec![element!("head", head_handler), element!("body", body_handler)];
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                 - temporary value is freed at the end of this statement
   |                                         |
   |                                         creates a temporary which is freed while still in use
39 |     let settings = RewriteStrSettings {
40 |         element_content_handlers,
   |         ------------------------ borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Ok, it seems element! is creating a temporary: https://docs.rs/lol_html/0.2.0/src/lol_html/rewriter/settings.rs.html#111. Here is the version that works:

    let (head_selector, body_selector) = ("head".parse().unwrap(), "body".parse().unwrap());
    let head = (
        &head_selector,
        ElementContentHandlers::default().element(head_handler),
    );
    let body = (
        &body_selector,
        ElementContentHandlers::default().element(body_handler),
    );
    let settings = RewriteStrSettings {
        element_content_handlers: vec![head, body],
        ..RewriteStrSettings::default()
    };

    lol_html::rewrite_str(html, settings)
}

This is a lot more verbose than the original code!

closed time in 10 days

jyn514

pull request commentcloudflare/lol-html

Allow using `element!` in a separate expression from `rewrite_str`

@jyn514 Whoa, that's lots of PRs :) Thanks a lot!

jyn514

comment created time in 10 days

PullRequestReviewEvent

issue commentcloudflare/lol-html

Add blanket `impl<T: Write> OutputSink for T`

@jyn514 sgtm, we already use Box<dyn Error> for handler errors, so let's probably keep it without generics.

jyn514

comment created time in 10 days

startedGoogleChromeLabs/wasmbin

started time in 10 days

issue commentcheeriojs/cheerio

Replacing cloneDeepWidth with alternative

I'm fine with that, though it will be a breaking change and will require a major release

TrySound

comment created time in 10 days

push eventinikulin/tokio-openssl

Ivan Nikulin

commit sha a7c3ba5c4601a2690670940a16e9a66f2679d752

Bump version

view details

push time in 11 days

push eventinikulin/rust-openssl

Ivan Nikulin

commit sha 7d551f51ef87f48f70aede3246ef06344ec44570

Bump version

view details

push time in 11 days

push eventinikulin/hyper-openssl

Ivan Nikulin

commit sha ffbb445c1781130528c8ae6c6f129a58522ccdff

Bump version

view details

push time in 11 days

push eventinikulin/tokio-openssl

Ivan Nikulin

commit sha 671ace6e11abfff2750ccd40932fd03710ff133a

Bump version

view details

push time in 11 days

push eventinikulin/rust-openssl

Ivan Nikulin

commit sha 94d13219570e543a2947d3bb77c1c9cd98015675

Bump deps

view details

push time in 11 days

push eventinikulin/rust-openssl

Ivan Nikulin

commit sha 1acc8ef543de08539f7879acde82aec1b77db278

Bump version

view details

push time in 11 days

push eventinikulin/hyper-openssl

Ivan Nikulin

commit sha 52c5f81c11ed2c1931e0830487bce66af9ac1dfa

Use our rust_openssl fork

view details

push time in 11 days

create barnchinikulin/tokio-openssl

branch : fork-pin

created branch time in 11 days

push eventinikulin/tokio-openssl

Ivan Nikulin

commit sha f115b697ae2b34b46c13bb58c3606e9bb6dbea60

Use our rust-openssl fork

view details

push time in 11 days

fork inikulin/tokio-openssl

OpenSSL bindings for Tokio

fork in 11 days

create barnchinikulin/rust-openssl

branch : set-flags-pin

created branch time in 11 days

fork inikulin/rust-openssl

OpenSSL bindings for Rust

fork in 12 days

issue commenthyperium/http

Support custom status code

As an additional argument, this crate supports arbitrary HTTP methods to which similar IANA considerations apply - https://tools.ietf.org/html/rfc7231#section-8.1. So, spec argument is at least inconsistent.

kamyuentse

comment created time in 13 days

issue commenthyperium/http

Support custom status code

@carllerche

Also, considering that there is an ongoing work on PoC for integration with curl (which handles such codes without an issue), it makes sense to support what all the major UAs support.

In addition, as was pointed above, such codes don't violate RFC7231.

kamyuentse

comment created time in 13 days

issue commenthyperium/http

Support custom status code

linkedin profiles return 999 when not logged in (I assume as a simple bot detection), browsers handle such responses without complaining.

kamyuentse

comment created time in 13 days

push eventinikulin/tokio-tungstenite

Ivan Nikulin

commit sha 07a2a4e44f04edc2c01e795d9703f201e96e7353

Update tangestinite to our fork

view details

push time in 14 days

fork inikulin/tokio-tungstenite

Tokio binding for Tungstenite, the Lightweight stream-based WebSocket implementation

fork in 14 days

create barnchinikulin/tungstenite-rs

branch : gh46-pin

created branch time in 14 days

push eventinikulin/tungstenite-rs

Ivan Nikulin

commit sha b2a477b30538036fe140514bbcbbddf49fb19c40

GH-46 Return the response in case of non-101 response from server Following redirects inside the lib (https://github.com/snapview/tungstenite-rs/pull/148) has few flows: there is no redirect loop prevention in this case, in case of using the lib in proxy it's impossible to return the upstream response to browser, etc. With this change response is propagated to the lib's user, so it can decide what to do with it in case of redirects: either send it to browser for it to follow redirects or implement redirect following on their side.

view details

push time in 14 days

PR opened snapview/tungstenite-rs

GH-46 Return the response in case of non-101 response from server

Following redirects inside the lib (https://github.com/snapview/tungstenite-rs/pull/148) has few flows: there is no redirect loop prevention in this case, in case of using the lib in proxy it's impossible to return the upstream response to browser, etc.

With this change response is propagated to the lib's user, so it can decide what to do with it in case of redirects: either send it to browser for it to follow redirects or implement redirect following on their side.

+27 -17

0 comment

2 changed files

pr created time in 14 days

create barnchinikulin/tungstenite-rs

branch : gh46

created branch time in 14 days

fork inikulin/tungstenite-rs

Lightweight stream-based WebSocket implementation for Rust.

fork in 14 days

delete branch inikulin/hyper

delete branch : gh-2169

delete time in 14 days

push eventinikulin/hyper

Ivan Nikulin

commit sha c7cc4623246d3873c3d9bf3120b01c21cb8bc243

feat(client): allow both IPv6 and IPv4 local addrs Currently HttpConnector::set_local_address method accepts a single argument. Server might not support IPv6 or IPv4. Therefore, the only solution at the moment is to manually perform DNS resolution and pick appropriate local address family. This is inefficient, as leads to 2 DNS lookups per request. This commit allows specifying both IPv4 and IPv6, so connector can decide which one to use based on DNS resolution results.

view details

push time in 14 days

pull request commenthyperium/hyper

feat(client): allow both IPv6 and IPv4 local addresses

@seanmonstar addressed the comments

inikulin

comment created time in 14 days

push eventinikulin/hyper

David Barsky

commit sha 9832aef9eeaeff8979354d5de04b8706ff79a233

feat(lib): Move from `log` to `tracing` in a backwards-compatible way (#2204) I've moved Hyper from `log` to `tracing`. Existing `log`-based users shouldn't notice a difference, but `tracing` users will see higher performance when filtering data. This isn't the _end_ of the `tracing` integration that can happen in `Hyper` (e.g., Hyper can start using spans, typed fields, etc.), but _something_ is better than nothing. I'd rather address those points, including examples, in followups. I've attached a screenshot of the `hello` example working, but the logged information is pulled from `tracing`, not `log`. <img width="514" alt="Screen Shot 2020-05-16 at 1 23 19 PM" src="https://user-images.githubusercontent.com/2067774/82126298-d8103800-9779-11ea-8f0b-57c632c684d6.png">

view details

Sean McArthur

commit sha 8f6d0a2f7ec23882c93a1cc0e1bf40db806f8249

docs(readme): replace irc links with discord links

view details

Sean McArthur

commit sha 4216b2de705f853d566ce185cae01ca99c63c9a1

v0.13.7

view details

Theodore DeRego

commit sha b5d5e21449eb613a3c92dcced6f38d227e405594

feat(server): implement `AsRawFd` for `AddrStream` (#2246) Fixes #2245.

view details

JohnMartin95

commit sha f4f14b30e3190e4b24be685ccea8fc7ce44e007a

chore(dependencies): require tokio 0.2.11 (#2252) Closes #2250

view details

Sean McArthur

commit sha 48f04b62178f5c391213b8047336f4520edb5818

test(h1): add benchmarks for server date checking and rendering

view details

Sean McArthur

commit sha 25a05894b97eca5b5e486cf2f4245e638464d318

refactor(h1): use httpdate for server date header

view details

João Oliveira

commit sha 6e7e4e2cd50197fe2edda22d1646b89b1f6513b3

docs(client): clarify HttpConnector::new_with_resolver doc (#2255) link to hyper::client::connect::dns, closes #2254

view details

Sean McArthur

commit sha 3de81c822e6ac5a5b0640059f53838d0906f68c4

refactor(h1): add spans for parse_headers and encode_headers (#2262)

view details

João Oliveira

commit sha 1ecbcbb119e221f60d37b934b81d18493ebded1b

fix(http1): return error if user body ends prematurely - update proto::h1::end_body to return Result<()> - update Encoder::end to return Error(NotEof) only when there's Content-length left to be addressed Closes #2263

view details

Stefano Buliani

commit sha 66fc127c8d4f81aed9300c9d0f13246b8206067a

docs(server): Example for conn modules (#2277) Add basic, module-level example for the Http struct in the server::conn module that shows how to customize the configuration of the HTTP protocol handling and then serve requests received through a tokio TCP stream.

view details

Danilo Bargen

commit sha 58a25eb7dcf749cdfff1e40d21a72324085f8784

docs(body): Sender: Add a note about abnormal body closing (#2283)

view details

Sean McArthur

commit sha 1edf2af377c40407ed9a4e5ee7ff4d16eda29392

docs(client): fix broken intra doc link for http::Uri

view details

Snarpix

commit sha 187c22afb5a13d4fa9a3b938a1d71b11b337ac97

feat(lib): Setting `http1_writev(true)` will now force writev queue usage Previously, calling `http1_writev(true)` would just keep the default behavior, which was to auto detect if writev was optimal. Now, the auto-detection is still default, but explicitly calling `http1_writev(true)` will skip the auto-detection, and always use writev queue strategy. Closes #2282

view details

Sean McArthur

commit sha d8622e570c908193bf2a23a092cde4650f6e2934

refactor(http1): include bytes in invalid header name panic (#2286)

view details

Sean McArthur

commit sha aea9c5280825c6c26ba2f3a902addd5c676b0923

v0.13.8

view details

Sean McArthur

commit sha 523d66a41ffe0429530241c381070fb490618a4a

refactor(body): fix unused sync_wrapper when stream feature disabled (#2287)

view details

Alexey Kiryushin

commit sha 01103da5d9b15e2a7fdc2f1dfec2c23a890d5c16

fix(client): fix panic when addrs in ConnectingTcpRemote is empty (#2292) Closes #2291

view details

Steven Fackler

commit sha 2dc9768d2d3884afa20c08b7cd8782c870d925d2

feat(client): Add accessors to `Connected` fields (#2290)

view details

Taiki Endo

commit sha 02732bef0c1accb441b9b14c07cb2c494234a682

chore(dependencies): update pin-project to 1.0 (#2298)

view details

push time in 14 days

push eventcloudflare/lol-html

Matt Brubeck

commit sha 3c53085bf9ffe7a2093bfe24fc3acc8848081da5

Update to hashbrown 0.9 (#64) * Update to hashbrown 0.9 The behavior of the `drain_filter` method has changed in this release: https://github.com/rust-lang/hashbrown/issues/186 * Use HashMap::retain instead of drain_filter

view details

push time in 14 days

PR merged cloudflare/lol-html

Update to hashbrown 0.9

The behavior of the drain_filter method has changed in this release:

https://github.com/rust-lang/hashbrown/issues/186

+83 -125

1 comment

8 changed files

mbrubeck

pr closed time in 14 days

PullRequestReviewEvent

pull request commentcloudflare/lol-html

Update to hashbrown 0.9

@mbrubeck thanks! sorry for the delay in review

mbrubeck

comment created time in 14 days

PullRequestReviewEvent

startedmozilla/rust-cascade

started time in 16 days

startedchromium/ct-policy

started time in 17 days

startedagl/crlset-tools

started time in 17 days

startedmozilla/uniffi-rs

started time in 18 days

Pull request review commenthyperium/hyper

feat(client): allow both IPv6 and IPv4 local addresses

 impl<R> HttpConnector<R> {         self.config_mut().recv_buffer_size = size;     } -    /// Set that all sockets are bound to the configured address before connection.+    /// Set that all sockets are bound to the configured addresses before connection.     ///     /// If `None`, the sockets will not be bound.     ///     /// Default is `None`.     #[inline]-    pub fn set_local_address(&mut self, addr: Option<IpAddr>) {-        self.config_mut().local_address = addr;+    pub fn set_local_address(&mut self, addr_ipv4: Option<Ipv4Addr>, addr_ipv6: Option<Ipv6Addr>) {

It could be confusing: such API implies that arbitrary number of egress IPs can be added. However, in reality we only choose between the two. And set_ prefix usually has override semantics when such methods used multiple times.

I guess the best option would be to introduce something like set_locall_address_versioned(Ipv4Addr, Ipv6Addr) (note that arguments are not optional). So, if it's a singular value of either version one would use set_local_address and if they want to specify both versions they would use set_locall_address_versioned

inikulin

comment created time in 20 days

PullRequestReviewEvent

Pull request review commenthyperium/hyper

feat(client): allow both IPv6 and IPv4 local addresses

 impl<R> HttpConnector<R> {         self.config_mut().recv_buffer_size = size;     } -    /// Set that all sockets are bound to the configured address before connection.+    /// Set that all sockets are bound to the configured addresses before connection.     ///     /// If `None`, the sockets will not be bound.     ///     /// Default is `None`.     #[inline]-    pub fn set_local_address(&mut self, addr: Option<IpAddr>) {-        self.config_mut().local_address = addr;+    pub fn set_local_address(&mut self, addr_ipv4: Option<Ipv4Addr>, addr_ipv6: Option<Ipv6Addr>) {

What's your preference here? I would be happy with either.

inikulin

comment created time in 20 days

PullRequestReviewEvent

push eventinikulin/hyper-openssl

Ivan Nikulin

commit sha 38d47def242306ec9391ebf5aaed6a22648c7219

Use our hyper fork (sigh)

view details

push time in 20 days

pull request commenthyperium/hyper

feat(client): allow both IPv6 and IPv4 local addresses

@seanmonstar Sorry for the ping again, your feedback will be appreciated

inikulin

comment created time in 20 days

MemberEvent

issue commentcloudflare/quiche

quiche build is failing on MacOS

Upgrading cmake to 3.18.3 resolves the issue

tiwariashish86

comment created time in 24 days

issue commentcloudflare/quiche

quiche build is failing on MacOS

Seems like cmake can't determine Clang's asm compiler

  -- The ASM compiler identification is unknown

otherwise it should hit this line: https://github.com/google/boringssl/blob/49e9f67d8b7cbeb3953b5548ad1009d15947a523/crypto/CMakeLists.txt#L36

tiwariashish86

comment created time in 24 days

issue commentcloudflare/quiche

quiche build is failing on MacOS

Has the same issue compiling as a dependency on Mac.

tiwariashish86

comment created time in 24 days

startedhundredrabbits/Left

started time in a month

PR closed cloudflare/lol-html

IMPROVE DOCUMENT README.md spam
+1 -1

0 comment

1 changed file

purvish37

pr closed time in a month

pull request commentinikulin/parse5

Make << in comment text parse correctly

@anko thank you!

anko

comment created time in a month

push eventinikulin/parse5

Antti Korpi

commit sha 9c683e154b8bbdc94237580680a934348406d1a2

Make << in comment text parse correctly (#326) Inside comments two consecutive less-than characters (`<<`) parsed wrongly as `<!`, due to what was probably a typo. This fixes that. Added regression test. Fixes #325.

view details

push time in a month

issue closedinikulin/parse5

Bug: Inside comments, `<<` is parsed as `<!`

Module: parse5-sax-parser@6.0.1

Repro steps (Linux):

$ cd $(mktemp --directory)
$ npm i parse5-sax-parser
[... npm output installing parse5-sax-parser@6.0.1 ...]
$ node << 'EOF'
const Parser = require('parse5-sax-parser')
const p = new Parser()
p.on('comment', (c) => console.log(c))
p.end('<!--test <<-->')
EOF
{ text: 'test <!', sourceCodeLocation: undefined }

Expected: test <<, not test <!.

Rationale: I find the above behaviour confusing because the HTML spec on comments does not limit how < can be used inside comments. A comment containing 2 consecutive less-than signs should be legal, but is currently unrepresentable.

Analysis:

I've just walked into the source and don't know the details, but it appears wrong to me that the tokeniser switches state from COMMENT_STATE to COMMENT_LESS_THAN_SIGN_STATE when encountering <. COMMENT_LESS_THAN_SIGN_STATE then treats < as ! and causes the weird output seen above.

Surely COMMENT_STATE represents the state where we're inside the text part of the comment? The only non-error references out of there should be to itself (parsing more content) or to COMMENT_END_DASH_STATE, right?

closed time in a month

anko

PR merged inikulin/parse5

Make << in comment text parse correctly

Inside comments two consecutive less-than characters (<<) parsed wrongly as <!, due to what was probably a typo. This fixes that.

Also added regression test.

Fixes #325.

+10 -1

0 comment

2 changed files

anko

pr closed time in a month

PullRequestReviewEvent

startedsfackler/rust-openssl

started time in a month

startedalexforster/pdu

started time in a month

startedsfackler/hyper-openssl

started time in a month

issue commentinikulin/parse5

Bug: Inside comments, `<<` is parsed as `<!`

I'd feel dumb PRing for a 1-char diff, and it doesn't feel worthwhile even writing a regression test when the wrongness is unsubtle

Don't see anything dumb about it. And it's always worth writing a regression test.

anko

comment created time in a month

issue commentinikulin/parse5

Bug: Inside comments, `<<` is parsed as `<!`

@anko it's indeed a bug, you're right we append the wrong character here: https://github.com/inikulin/parse5/blob/master/packages/parse5/lib/tokenizer/index.js#L1471 It should be <.

Regarding tests - you need to fetch html5lib git submodule by running:

git submodule update --init --recursive  
anko

comment created time in a month

startedundef1nd/sfv

started time in a month

startedmitsuhiko/systemfd

started time in a month

startednovifinancial/serde-reflection

started time in a month

startedhyperium/tonic

started time in a month

issue commenthyperium/mime

Incorrect error on OWS before semicolon

agh, it seems like latest published v0.3.16 is extremely outdated. Is there any plan to publish latest versions?

inikulin

comment created time in a month

issue openedhyperium/mime

Incorrect error on OWS before semicolon

From https://tools.ietf.org/html/rfc7231#section-3.1.1.1:

media-type = type "/" subtype *( OWS ";" OWS parameter )
type       = token
subtype    = token

OWS is allowed before ";", however this errors: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b00e114d37c5de5ab6278ca084a99e8a

created time in a month

startedbagder/docs

started time in 2 months

startedandrew-d/interfaces-rs

started time in 2 months

issue openedrust-lang/rust

Cross-crate compilation optimises away raw pointers

<!-- Thank you for filing a bug report! 🐛 Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --> The issue reproduces only if FatPtr code resides in a separate crate and only if compiled in release configuration.

I tried this code:

fat_ptr's crate lib.rs:

pub struct FatPtr {
    ptr: *mut u8,
    len: usize,
}

impl FatPtr {
    pub fn new(len: usize) -> FatPtr {
        let ptr = Box::into_raw(vec![42u8; len].into_boxed_slice()) as *mut u8;

        FatPtr { ptr, len }
    }
}

impl std::ops::Deref for FatPtr {
    type Target = [u8];

    #[inline]
    fn deref(&self) -> &[u8] {
        unsafe { std::slice::from_raw_parts(self.ptr, self.len) }
    }
}

impl std::ops::Drop for FatPtr {
    fn drop(&mut self) {
        println!("Drop");
    }
}

test's crate main.rs:

use fat_ptr::FatPtr;

fn print(data: &[u8]) {
    println!("{:#?}", data);
}

fn main() {
    let ptr = FatPtr::new(20);
    let data = unsafe { std::slice::from_raw_parts(ptr.as_ptr(), ptr.len()) };

    print(data);
}

I expected to see this happen: 42 printed 20 times.

Instead, this happened: 42 printed 20 times in debug build, but not in release. Instead, slice length appears to be corrupted, so println prints memory dump outside of allocated slice and eventually segfaults. However, if Drop implementation for FatPtr is removed, then slice is truncated to a single byte, which is still incorrect, but doesn't crash the process.

If print(data) call is replaced with println!("{:#?}", data); directly then everything works as intended even on release builds. If FatPtr code placed in the same crate as main then everything works as intended as well.

This reproduces on Linux and MacOS (haven't tried Windows).

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.46.0 (04488afe3 2020-08-24)
binary: rustc
commit-hash: 04488afe34512aa4c33566eb16d8c912a3ae04f9
commit-date: 2020-08-24
host: x86_64-apple-darwin
release: 1.46.0
LLVM version: 10.0

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary>Backtrace</summary> <p>

N/A

</p> </details>

created time in 2 months

startedstevenpack/asroute

started time in 2 months

push eventinikulin/two-rusty-forks

Ivan Nikulin

commit sha 9346a869dab75ce6dad915b088231b4911ef1d99

Attach child stdout to panic message

view details

push time in 2 months

push eventinikulin/two-rusty-forks

Ivan Nikulin

commit sha 48840fbca58155f7fdfb71b538518efcacd7b62b

Attach child stdout to panic message

view details

push time in 2 months

push eventinikulin/two-rusty-forks

Ivan Nikulin

commit sha 64bffa3c657e906c2bd570e4bc03f3bf7968a04b

Fix export

view details

push time in 2 months

push eventinikulin/two-rusty-forks

Ivan Nikulin

commit sha fc680d210176dc74c440abf6c910f8d7af77e634

Fix export

view details

push time in 2 months

push eventinikulin/two-rusty-forks

Ivan Nikulin

commit sha d859f413789152d4f57a4f80405688b9a779f772

Fix export

view details

push time in 2 months

push eventinikulin/two-rusty-forks

Ivan Nikulin

commit sha 52dfa0c2f8da075645f1b8b5a0548db79c82d748

Rename repo

view details

push time in 2 months

push eventinikulin/two-rusty-forks

daxpedda

commit sha 97d2b0b5e08cba206b8046db0882db312c57c9c6

Implement proc macro feature.

view details

Ivan Nikulin

commit sha b45d53bdff099ee0cc39330374cda1a1d06a0722

Rename repo

view details

push time in 2 months

fork inikulin/rusty-fork

Run Rust tests in isolated subprocesses

fork in 2 months

starteddtolnay/paste

started time in 2 months

more