* [ruby-core:92819] [Ruby trunk Bug#15873] FrozenError when using OpenURI.open
[not found] <redmine.issue-15873.20190524091503@ruby-lang.org>
@ 2019-05-24 9:15 ` alexgascon.93
2019-05-24 12:10 ` [ruby-core:92822] " nobu
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: alexgascon.93 @ 2019-05-24 9:15 UTC (permalink / raw)
To: ruby-core
Issue #15873 has been reported by AlexGascon (Alex Gascon).
----------------------------------------
Bug #15873: FrozenError when using OpenURI.open
https://bugs.ruby-lang.org/issues/15873
* Author: AlexGascon (Alex Gascon)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I just updated from Ruby 2.5.1 to 2.6.3 and I encountered a strange problem on a part that was working fine previously. It's on a Rails application, and on one of the tests I'm stubbing (using [webmock](https://github.com/bblimke/webmock)) an HTTP request that we perform to an external URL. However, when trying to access the information by using OpenURI I get a `FrozenError`.
The following block represents a minimal reproducible example of the problem that I'm experiencing
``` ruby
stub_request(:get, "https://files.lol/certificate_doc.pdf").to_return(status: 200, body: "Random information", headers: {})
file_content = open("https://files.lol/certificate_doc.pdf")
FrozenError: can't modify frozen String
from /home/alex/.rbenv/versions/2.6.3/lib/ruby/2.6.0/open-uri.rb:357:in `clear'
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:92822] [Ruby trunk Bug#15873] FrozenError when using OpenURI.open
[not found] <redmine.issue-15873.20190524091503@ruby-lang.org>
2019-05-24 9:15 ` [ruby-core:92819] [Ruby trunk Bug#15873] FrozenError when using OpenURI.open alexgascon.93
@ 2019-05-24 12:10 ` nobu
2019-05-24 12:58 ` [ruby-core:92823] " alexgascon.93
2019-05-24 13:05 ` [ruby-core:92824] " nobu
3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2019-05-24 12:10 UTC (permalink / raw)
To: ruby-core
Issue #15873 has been updated by nobu (Nobuyoshi Nakada).
Does it occur even if the body is `"Random information".dup`?
----------------------------------------
Bug #15873: FrozenError when using OpenURI.open
https://bugs.ruby-lang.org/issues/15873#change-78194
* Author: AlexGascon (Alex Gascon)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I just updated from Ruby 2.5.1 to 2.6.3 and I encountered a strange problem on a part that was working fine previously. It's on a Rails application, and on one of the tests I'm stubbing (using [webmock](https://github.com/bblimke/webmock)) an HTTP request that we perform to an external URL. However, when trying to access the information by using OpenURI I get a `FrozenError`.
The following block represents a minimal reproducible example of the problem that I'm experiencing
``` ruby
stub_request(:get, "https://files.lol/certificate_doc.pdf").to_return(status: 200, body: "Random information", headers: {})
file_content = open("https://files.lol/certificate_doc.pdf")
FrozenError: can't modify frozen String
from /home/alex/.rbenv/versions/2.6.3/lib/ruby/2.6.0/open-uri.rb:357:in `clear'
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:92823] [Ruby trunk Bug#15873] FrozenError when using OpenURI.open
[not found] <redmine.issue-15873.20190524091503@ruby-lang.org>
2019-05-24 9:15 ` [ruby-core:92819] [Ruby trunk Bug#15873] FrozenError when using OpenURI.open alexgascon.93
2019-05-24 12:10 ` [ruby-core:92822] " nobu
@ 2019-05-24 12:58 ` alexgascon.93
2019-05-24 13:05 ` [ruby-core:92824] " nobu
3 siblings, 0 replies; 4+ messages in thread
From: alexgascon.93 @ 2019-05-24 12:58 UTC (permalink / raw)
To: ruby-core
Issue #15873 has been updated by AlexGascon (Alex Gascon).
nobu (Nobuyoshi Nakada) wrote:
> Does it occur even if the body is `"Random information".dup`?
Just tried and no, when using `.dup` it worked as expected!
----------------------------------------
Bug #15873: FrozenError when using OpenURI.open
https://bugs.ruby-lang.org/issues/15873#change-78195
* Author: AlexGascon (Alex Gascon)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I just updated from Ruby 2.5.1 to 2.6.3 and I encountered a strange problem on a part that was working fine previously. It's on a Rails application, and on one of the tests I'm stubbing (using [webmock](https://github.com/bblimke/webmock)) an HTTP request that we perform to an external URL. However, when trying to access the information by using OpenURI I get a `FrozenError`.
The following block represents a minimal reproducible example of the problem that I'm experiencing
``` ruby
stub_request(:get, "https://files.lol/certificate_doc.pdf").to_return(status: 200, body: "Random information", headers: {})
file_content = open("https://files.lol/certificate_doc.pdf")
FrozenError: can't modify frozen String
from /home/alex/.rbenv/versions/2.6.3/lib/ruby/2.6.0/open-uri.rb:357:in `clear'
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:92824] [Ruby trunk Bug#15873] FrozenError when using OpenURI.open
[not found] <redmine.issue-15873.20190524091503@ruby-lang.org>
` (2 preceding siblings ...)
2019-05-24 12:58 ` [ruby-core:92823] " alexgascon.93
@ 2019-05-24 13:05 ` nobu
3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2019-05-24 13:05 UTC (permalink / raw)
To: ruby-core
Issue #15873 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Open to Closed
Probably you are using `frozen-string-literal` pragma.
Since 2.6, OpenURI clears the buffer from `Net::HTTPResponse#read_body` to reduce memory usage.
See [Feature #14320].
----------------------------------------
Bug #15873: FrozenError when using OpenURI.open
https://bugs.ruby-lang.org/issues/15873#change-78198
* Author: AlexGascon (Alex Gascon)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I just updated from Ruby 2.5.1 to 2.6.3 and I encountered a strange problem on a part that was working fine previously. It's on a Rails application, and on one of the tests I'm stubbing (using [webmock](https://github.com/bblimke/webmock)) an HTTP request that we perform to an external URL. However, when trying to access the information by using OpenURI I get a `FrozenError`.
The following block represents a minimal reproducible example of the problem that I'm experiencing
``` ruby
stub_request(:get, "https://files.lol/certificate_doc.pdf").to_return(status: 200, body: "Random information", headers: {})
file_content = open("https://files.lol/certificate_doc.pdf")
FrozenError: can't modify frozen String
from /home/alex/.rbenv/versions/2.6.3/lib/ruby/2.6.0/open-uri.rb:357:in `clear'
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-24 13:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-15873.20190524091503@ruby-lang.org>
2019-05-24 9:15 ` [ruby-core:92819] [Ruby trunk Bug#15873] FrozenError when using OpenURI.open alexgascon.93
2019-05-24 12:10 ` [ruby-core:92822] " nobu
2019-05-24 12:58 ` [ruby-core:92823] " alexgascon.93
2019-05-24 13:05 ` [ruby-core:92824] " nobu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).