Git Product home page Git Product logo

Comments (4)

kagminjeong avatar kagminjeong commented on May 20, 2024

I experienced this issue with s3sync's s3cmd script. It may send a content-type header without the value.

Apparently this behavior is intended: http://github.com/richmeyers/s3sync/blob/master/lib/s3sync/S3.rb#L297

Sample request: http://gist.github.com/519415#file_sample%20s3sync%20s3cmd%20request

Backtrace: http://gist.github.com/519415#file_backtrace

Overlay patch: http://gist.github.com/519415#file_rack_content_type_patch.rb

from rack.

kagminjeong avatar kagminjeong commented on May 20, 2024

Patch: http://github.com/richmeyers/rack/commit/e70161d385037dc6a8d7b6cd67d0321e8ca4ff69

Tests: http://github.com/richmeyers/rack/commit/fbfe78a594513d942d2cafbc6d96a5ce01a0ddd2

from rack.

lupine avatar lupine commented on May 20, 2024

I ran into this problem with Sinatra 1.1 / rack-jetty 0.10 / rack 1.2.1 just today, attempting to put a web application together.

It seems that rack-jetty triggers this bug by always setting env['CONTENT_TYPE'] to a string, regardless of the actual HTTP request - if it's not present, it sets it as a blank string (''). This seems to be in order to correct a Rack::Lint error - stating env['CONTENT_TYPE'] can't be nil.

rack/request.rb:44 (and possibly other places too) can't cope with env['CONTENT_TYPE'] = '' though - I think they should either test for this condition and work around it (I guess it's theoretically possible that a HTTP request might include "Content-Type: \r\n", and an easily-avoided backtrace might as well be avoided), or it should be made clear that handlers should prevent a situation where env['CONTENT_TYPE'] == nil - the easiest way probably being to add a Rack::Lint case for it.

In any event, I've patched rack-jetty and sent a pull request to the author, which prevents it from being a burning issue for me, personally, any more - it'd be nice to get it fixed up at this end too though.

from rack.

josh avatar josh commented on May 20, 2024

672396f

from rack.

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.