ruby / ruby/webrick

MAX_URI_LENGTH exceeded results in nonsensical error

Open
#113 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
327
Forks
112
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Webrick version 1.7.0

When MAX_URI_LENGTH of 2083 is exceeded, instead of failing with the expected HTTPStatus::RequestURITooLarge it instead fails with:

ERROR TypeError: can't convert nil into an exact number
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.8.1/lib/active_support/core_ext/time/calculations.rb:275:in `-'
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.8.1/lib/active_support/core_ext/time/calculations.rb:275:in `minus_with_duration'
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/activesupport-5.2.8.1/lib/active_support/core_ext/time/calculations.rb:286:in `minus_with_coercion'
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/webrick-1.7.0/lib/webrick/accesslog.rb:112:in `setup_params'
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/webrick-1.7.0/lib/webrick/httpserver.rb:223:in `access_log'
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/webrick-1.7.0/lib/webrick/httpserver.rb:115:in `ensure in run'
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/webrick-1.7.0/lib/webrick/httpserver.rb:115:in `run'
	/Users/matthewhively/.rvm/gems/ruby-2.5.7/gems/webrick-1.7.0/lib/webrick/server.rb:310:in `block in start_thread'

httpserver.rb#run() catches the error, but then as part of the ensure block it throws another error.

So the actual issue I suppose is that the ensure block shouldn't be failing, even with some other error condition.

And an additional question:
Why is the MAX_URI_LENGTH remain at a value from 2010 for internet explorer? https://github.com/ruby/webrick/commit/bd7388dd8e68ba68e74eb0e6f42fcf2753e94deb

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/webrick/httpserver.rb#run and follow its ensure path into access_log, then inspect lib/webrick/accesslog.rb#setup_params. Reproduce a request exceeding MAX_URI_LENGTH and verify that the expected HTTPStatus::RequestURITooLarge is preserved without a secondary TypeError from logging.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.