Sha256: 86d620c4f9f4e05820dea38b5f6a24d78d179159a48f865df68cd836ff015fc9

Contents?: true

Size: 1.85 KB

Versions: 21

Compression:

Stored size: 1.85 KB

Contents

package http_parser;

import http_parser.lolevel.*;
import http_parser.lolevel.HTTPParser;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.Arrays;

/**
 */
public class HTTPParserUrl {

  public int field_set;
  public int port;

  public FieldData[] field_data = new FieldData[]{
    new FieldData(0,0),
    new FieldData(0,0),
    new FieldData(0,0),
    new FieldData(0,0),
    new FieldData(0,0),
    new FieldData(0,0)
  }; //UF_MAX

  public HTTPParserUrl(){}

  public HTTPParserUrl(int field_set, int port, FieldData[] field_data){
    this.field_set = field_set;
    this.port = port;
    this.field_data = field_data;
  }

  public String getFieldValue(HTTPParser.UrlFields field, ByteBuffer data) throws UnsupportedEncodingException {
    FieldData fd = this.field_data[field.getIndex()];
    if(fd.off == 0 & fd.len == 0) return "";
    byte[] dst = new byte[fd.len];
    int current_pos = data.position();
    data.position(fd.off);
    data.get(dst,0,fd.len);
    data.position(current_pos);
    String v = new String(dst, "UTF8");
    return v;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    HTTPParserUrl that = (HTTPParserUrl) o;

    if (field_set != that.field_set) return false;
    if (port != that.port) return false;
    if (!Arrays.equals(field_data, that.field_data)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = field_set;
    result = 31 * result + port;
    result = 31 * result + Arrays.hashCode(field_data);
    return result;
  }

  @Override
  public String toString() {
    return "HTTPParserUrl{" +
        "field_set=" + field_set +
        ", port=" + port +
        ", field_data=" + (field_data == null ? null : Arrays.asList(field_data)) +
        '}';
  }
}

Version data entries

21 entries across 21 versions & 7 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/http_parser.rb-0.8.0/ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/http_parser.rb-0.8.0/ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/http_parser.rb-0.8.0/ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/http_parser.rb-0.8.0/ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/http_parser.rb-0.8.0/ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
http_parser.rb-0.8.0 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
http_parser.rb-0.7.0 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
midori_http_parser-0.6.1.3 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
midori_http_parser-0.6.1.3-java ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
midori_http_parser-0.6.1.2-java ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
midori_http_parser-0.6.1.2 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
midori_http_parser-0.6.1.1-java ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
midori_http_parser-0.6.1.1 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
midori_http_parser-0.6.1 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
http_parser.rb-0.6.0-java ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
http_parser.rb-0.6.0 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
http_parser.rb-0.6.0.beta.2-java ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java
http_parser.rb-0.6.0.beta.2 ext/ruby_http_parser/vendor/http-parser-java/src/impl/http_parser/HTTPParserUrl.java