Giter VIP home page Giter VIP logo

Comments (9)

robfuller avatar robfuller commented on August 17, 2024

what I did for now is modify agent.prepare_request to look at the host_headers passed and if its a hash, then use that hash to set the passed header(s), if its not leave the current functionality

unless @host_headers.empty?
    @host_headers.each do |name,header|
      if host.match(name)
        if header.is_a(Hash)
          header.each do |header_name, header_value|
            headers[header_name] = header_value
          end
        else
          headers['Host'] = header
        end
      end
    end
end

I think the polite thing for me to do is somehow propose this as a submit request? I'm not sure how to do that (took me a few minutes to figure out how to create/test a local gem to make sure this worked) - so let me know if you would like me to figure out how to submit this as a change

from spidr.

postmodern avatar postmodern commented on August 17, 2024

Going to need a little more info to isolate the root cause. I'm not sure whether it's the site or Spidr::Agent which is not following HTTP/1.1.

from spidr.

robfuller avatar robfuller commented on August 17, 2024

I've run my code on ~85 sites - only had the issue on https://www.logility.com/

Patching Agent.prepare_request with the above code, and then passing in "Accept-Encoding: plain" did work

So my guess is that the server is doing something wrong with its deflate/gzip, so telling it to not encode works. Since I can't change the server, I needed to address on the scanning side.

from spidr.

robfuller avatar robfuller commented on August 17, 2024

I tried a number of them and they all triggered it (can't say for sure its
every url, but I didn't come across any that didn't)

On Wed, Nov 18, 2015 at 8:18 PM, Postmodern [email protected]
wrote:

Is it every URL on logility.com or a specific URL that triggers it?


Reply to this email directly or view it on GitHub
#43 (comment).

from spidr.

postmodern avatar postmodern commented on August 17, 2024

Probably is related to ruby's default headers:

Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept: */*
User-Agent: Ruby

from spidr.

robfuller avatar robfuller commented on August 17, 2024

Right, by default ruby accepts gzip and deflate. Its the decompression
that is failing.

Setting the accepted encoding to only plain, means no compression.

The problem was there is no way in spidr to send the change to the header
(no way to override the ruby default) - the code I shared exposes the
ability to set that request header manually.

On Wed, Nov 18, 2015 at 8:30 PM, Postmodern [email protected]
wrote:

Probably is related to ruby's default headers:

Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept: /
User-Agent: Ruby


Reply to this email directly or view it on GitHub
#43 (comment).

from spidr.

postmodern avatar postmodern commented on August 17, 2024

I wonder if this is a bug in ruby. I may be open to adding another callback to allow setting custom headers. Although, I don't want to change too much just to workaround a bug that may be in Ruby or www.logility.com.

from spidr.

robfuller avatar robfuller commented on August 17, 2024

In searching for that error it has occurred to other libraries as well - so
its sort of a bug in ruby I guess. That said, exposing a request header
makes sense as there could be a lot of reasons you want to force a specific
set.

On Wed, Nov 18, 2015 at 8:39 PM, Postmodern [email protected]
wrote:

I wonder if this is a bug in ruby. I may be open to adding another
callback to allow setting custom headers. Although, I don't want to change
too much just to workaround a bug that may be in Ruby or www.logility.com.


Reply to this email directly or view it on GitHub
#43 (comment).

from spidr.

postmodern avatar postmodern commented on August 17, 2024

Spidr 0.6.0 added Agent#default_headers which is just a Hash of headers that gets added to every request. Setting agent.default_headers['Accept-Encoding'] = 'plain' or passing in default_headers: {'Accept-Encoding' => 'plain'} would fix this.

from spidr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.