Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-http_parser.rb for 
openSUSE:Factory checked in at 2022-02-07 23:37:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-http_parser.rb (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-http_parser.rb.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-http_parser.rb"

Mon Feb  7 23:37:42 2022 rev:12 rq:949081 version:0.8.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/rubygem-http_parser.rb/rubygem-http_parser.rb.changes
    2021-08-24 10:55:16.620288830 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-http_parser.rb.new.1898/rubygem-http_parser.rb.changes
  2022-02-07 23:38:44.122179658 +0100
@@ -1,0 +2,6 @@
+Tue Jan 25 07:03:07 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 0.8.0
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  http_parser.rb-0.7.0.gem

New:
----
  http_parser.rb-0.8.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-http_parser.rb.spec ++++++
--- /var/tmp/diff_new_pack.lx5aM7/_old  2022-02-07 23:38:44.674175881 +0100
+++ /var/tmp/diff_new_pack.lx5aM7/_new  2022-02-07 23:38:44.678175854 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-http_parser.rb
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-http_parser.rb
-Version:        0.7.0
+Version:        0.8.0
 Release:        0
 %define mod_name http_parser.rb
 %define mod_full_name %{mod_name}-%{version}

++++++ http_parser.rb-0.7.0.gem -> http_parser.rb-0.8.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile        2021-07-02 11:07:20.000000000 +0200
+++ new/Rakefile        2021-09-01 11:02:04.000000000 +0200
@@ -1,7 +1,8 @@
-# load tasks
 require 'bundler/gem_tasks'
-Dir['tasks/*.rake'].sort.each { |f| load f }
 
 # default task
 task :compile => :submodules
 task :default => [:compile, :spec]
+
+# load tasks
+Dir['tasks/*.rake'].sort.each { |f| load f }
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ext/ruby_http_parser/org/ruby_http_parser/RubyHttpParser.java 
new/ext/ruby_http_parser/org/ruby_http_parser/RubyHttpParser.java
--- old/ext/ruby_http_parser/org/ruby_http_parser/RubyHttpParser.java   
2021-07-02 11:07:20.000000000 +0200
+++ new/ext/ruby_http_parser/org/ruby_http_parser/RubyHttpParser.java   
2021-09-01 11:02:04.000000000 +0200
@@ -8,6 +8,9 @@
 import http_parser.lolevel.ParserSettings;
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.jcodings.Encoding;
 import org.jcodings.specific.UTF8Encoding;
@@ -64,7 +67,6 @@
   private IRubyObject on_body;
   private IRubyObject on_message_complete;
 
-  private IRubyObject status;
   private IRubyObject requestUrl;
   private IRubyObject requestPath;
   private IRubyObject queryString;
@@ -82,6 +84,10 @@
 
   private static final Encoding UTF8 = UTF8Encoding.INSTANCE;
 
+  private static final List<String> VALUE_TYPES = new ArrayList<String>(
+    Arrays.asList("mixed", "arrays", "strings")
+  );
+
   public RubyHttpParser(final Ruby runtime, RubyClass clazz) {
     super(runtime, clazz);
 
@@ -107,18 +113,6 @@
   private void initSettings() {
     this.settings = new ParserSettings();
 
-    this.settings.on_status = new HTTPDataCallback() {
-      public int cb(http_parser.lolevel.HTTPParser p, ByteBuffer buf, int pos, 
int len) {
-        byte[] data = fetchBytes(buf, pos, len);
-        if (runtime.is1_9() || runtime.is2_0()) {
-          ((RubyString) status).cat(data, 0, data.length, UTF8);
-        } else {
-          ((RubyString) status).cat(data);
-        }
-        return 0;
-      }
-    };
-
     this.settings.on_url = new HTTPDataCallback() {
       public int cb(http_parser.lolevel.HTTPParser p, ByteBuffer buf, int pos, 
int len) {
         byte[] data = fetchBytes(buf, pos, len);
@@ -215,14 +209,12 @@
         headers = new RubyHash(runtime);
 
         if (runtime.is1_9() || runtime.is2_0()) {
-          status = RubyString.newEmptyString(runtime, UTF8);
           requestUrl = RubyString.newEmptyString(runtime, UTF8);
           requestPath = RubyString.newEmptyString(runtime, UTF8);
           queryString = RubyString.newEmptyString(runtime, UTF8);
           fragment = RubyString.newEmptyString(runtime, UTF8);
           upgradeData = RubyString.newEmptyString(runtime, UTF8);
         } else {
-          status = RubyString.newEmptyString(runtime);
           requestUrl = RubyString.newEmptyString(runtime);
           requestPath = RubyString.newEmptyString(runtime);
           queryString = RubyString.newEmptyString(runtime);
@@ -324,8 +316,7 @@
     this.parser = new HTTPParser();
     this.parser.HTTP_PARSER_STRICT = true;
     this.headers = null;
-    
-    this.status = runtime.getNil();
+
     this.requestUrl = runtime.getNil();
     this.requestPath = runtime.getNil();
     this.queryString = runtime.getNil();
@@ -462,11 +453,6 @@
     return headers == null ? runtime.getNil() : headers;
   }
 
-  @JRubyMethod(name = "status")
-  public IRubyObject getStatus() {
-    return status == null ? runtime.getNil() : status;
-  }
-
   @JRubyMethod(name = "request_url")
   public IRubyObject getRequestUrl() {
     return requestUrl == null ? runtime.getNil() : requestUrl;
@@ -495,7 +481,7 @@
   @JRubyMethod(name = "header_value_type=")
   public IRubyObject set_header_value_type(IRubyObject val) {
     String valString = val.toString();
-    if (valString != "mixed" && valString != "arrays" && valString != 
"strings") {
+    if (!VALUE_TYPES.contains(valString)) {
       throw runtime.newArgumentError("Invalid header value type");
     }
     header_value_type = val;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/ruby_http_parser/ruby_http_parser.c 
new/ext/ruby_http_parser/ruby_http_parser.c
--- old/ext/ruby_http_parser/ruby_http_parser.c 2021-07-02 11:07:20.000000000 
+0200
+++ new/ext/ruby_http_parser/ruby_http_parser.c 2021-09-01 11:02:04.000000000 
+0200
@@ -316,7 +316,17 @@
   ParserWrapper *wrapper = NULL;
   DATA_GET(self, ParserWrapper, wrapper);
 
-  wrapper->header_value_type = rb_iv_get(CLASS_OF(self), 
"@default_header_value_type");
+  VALUE default_header_value_type = Qnil;
+
+  if (argc > 0 && RB_TYPE_P(argv[argc-1], T_HASH)) {
+    ID keyword_ids[1];
+    keyword_ids[0] = rb_intern("default_header_value_type");
+    rb_get_kwargs(argv[argc-1], keyword_ids, 0, 1, &default_header_value_type);
+    if (default_header_value_type == Qundef) {
+      default_header_value_type = Qnil;
+    }
+    --argc;
+  }
 
   if (argc == 1) {
     wrapper->callback_object = argv[0];
@@ -324,7 +334,13 @@
 
   if (argc == 2) {
     wrapper->callback_object = argv[0];
-    wrapper->header_value_type = argv[1];
+    default_header_value_type = argv[1];
+  }
+
+  if (default_header_value_type == Qnil) {
+    wrapper->header_value_type = rb_iv_get(CLASS_OF(self), 
"@default_header_value_type");
+  } else {
+    wrapper->header_value_type = default_header_value_type;
   }
 
   return self;
@@ -489,6 +505,10 @@
 }
 
 void Init_ruby_http_parser() {
+#ifdef HAVE_RB_EXT_RACTOR_SAFE
+  rb_ext_ractor_safe(true);
+#endif
+
   VALUE mHTTP = rb_define_module("HTTP");
   cParser = rb_define_class_under(mHTTP, "Parser", rb_cObject);
   cRequestParser = rb_define_class_under(mHTTP, "RequestParser", cParser);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/http_parser.rb.gemspec new/http_parser.rb.gemspec
--- old/http_parser.rb.gemspec  2021-07-02 11:07:20.000000000 +0200
+++ new/http_parser.rb.gemspec  2021-09-01 11:02:04.000000000 +0200
@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
   s.name = "http_parser.rb"
-  s.version = "0.7.0"
+  s.version = "0.8.0"
   s.summary = "Simple callback-based HTTP request/response parser"
   s.description = "Ruby bindings to https://github.com/joyent/http-parser and 
https://github.com/http-parser/http-parser.java";
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-07-02 11:07:20.000000000 +0200
+++ new/metadata        2021-09-01 11:02:04.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: http_parser.rb
 version: !ruby/object:Gem::Version
-  version: 0.7.0
+  version: 0.8.0
 platform: ruby
 authors:
 - Marc-Andre Cournoyer
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2021-07-02 00:00:00.000000000 Z
+date: 2021-09-01 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rake-compiler
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/parser_spec.rb new/spec/parser_spec.rb
--- old/spec/parser_spec.rb     2021-07-02 11:07:20.000000000 +0200
+++ new/spec/parser_spec.rb     2021-09-01 11:02:04.000000000 +0200
@@ -31,6 +31,25 @@
     expect(@parser.header_value_type).to eq(:mixed)
   end
 
+  it "should be able to run in non-main ractors" do
+    skip unless Kernel.const_defined?(:Ractor)
+    default_header_value_type = HTTP::Parser.default_header_value_type
+    r = Ractor.new(default_header_value_type) { |type|
+      parser = HTTP::Parser.new(default_header_value_type: type)
+      done = false
+      parser.on_message_complete = proc {
+        done = true
+      }
+      parser <<
+        "GET /ractor HTTP/1.1\r\n" +
+        "Content-Length: 5\r\n" +
+        "\r\n" +
+        "World"
+      done
+    }
+    expect(r.take).to be true
+  end
+
   it "should allow us to set the header value type" do
     [:mixed, :arrays, :strings].each do |type|
       @parser.header_value_type = type
@@ -38,6 +57,9 @@
 
       parser_tmp = HTTP::Parser.new(nil, type)
       expect(parser_tmp.header_value_type).to eq(type)
+
+      parser_tmp2 = HTTP::Parser.new(default_header_value_type: type)
+      expect(parser_tmp2.header_value_type).to eq(type)
     end
   end
 
@@ -384,10 +406,15 @@
         expect(@parser.send("http_minor")).to eq(test["http_minor"])
 
         if test['type'] == 'HTTP_REQUEST'
-          expect(@parser.send("request_url")).to 
eq(test["request_url"].force_encoding(Encoding::BINARY))
+          if defined?(JRUBY_VERSION)
+            expect(@parser.send("request_url")).to eq(test["request_url"])
+          else
+            # It's created by rb_str_new(), so that encoding is 
Encoding::ASCII_8BIT a.k.a Encoding::BINARY
+            expect(@parser.send("request_url")).to 
eq(test["request_url"].force_encoding(Encoding::ASCII_8BIT))
+          end
         else
           expect(@parser.send("status_code")).to eq(test["status_code"])
-          expect(@parser.send("status")).to 
eq(test["status"].force_encoding(Encoding::BINARY))
+          expect(@parser.send("status")).to 
eq(test["status"].force_encoding(Encoding::ASCII_8BIT)) if 
!defined?(JRUBY_VERSION)
         end
 
         expect(@headers.size).to eq(test['num_headers'])

Reply via email to