.net and other musings

Ben Lovell, an agile developer living in the UK.

HTTP headers and verbs are case-sensitive

with one comment

Reminder to self: HTTP headers and verbs are case-sensitive. Oh yes, big gotcha.

I’ve been working on a .NET Windows Service which consumes a RESTful service hosted via Rails. During the development/test cycle I’ve been pointing my tests to a mocked service hosted locally under IIS. Upon testing against the real REST URIs I ran into a strange issue of a hanging System.Net.HttpWebRequest.

The issue was in sending the verbs in lowercase and not adhering to the HTTP RFC, which IIS rather unhelpfully doesn’t adhere to either. See, IIS will respond to verbs in lowercase, which I guess in some cases, if you don’t leave the wonderful Windows world of case-insensitivity perhaps, can be helpful? Apache (on Linux at least, haven’t tried on Windows) isn’t so flexible which is definitely a Good Thing… :)

The sad thing about this is that I’d ran into this same issue a few years back, but conveniently only remembered after I’d spent a couple of hours debugging this one!

Written by benl

May 4, 2007 at 6:12 pm

Posted in .NET, Bug, Linux

One Response

Subscribe to comments with RSS.

  1. The HTTP method is supposed to be case-sensitive, but the HTTP headers are case-insensitive supposed to be according to RFC 2616.

    If you’ve been sending HTTP headers to a Rails app, and they aren’t being recognized because of casing differences, it is probably a bug in the app or in Rails itself. Assuming its the later you should submit a ticket to http://dev.rubyonrails.org/

    Dan Kubb

    May 5, 2007 at 2:13 am


Leave a Reply