From: Magnus Holm <judofyr@gmail.com>
To: rack-devel <rack-devel@googlegroups.com>
Subject: Re: HTTP_ Headers from clients
Date: Mon, 24 Oct 2016 14:01:23 +0200 [thread overview]
Message-ID: <CAJ367fe3xUPRCr6mnccGEkCn3cUs61hNLyXKYR_Y-O8E+QVmjQ@mail.gmail.com> (raw)
In-Reply-To: <6c68f46f-fdc5-4cd3-b36c-9b2c6bf3e03e@googlegroups.com>
[-- Attachment #1: Type: text/plain, Size: 2175 bytes --]
Hi Arne,
When the client sends a request which looks like this:
GET / HTTP/1.1
Host: example.com
Company: Acme
The server you're using will always create the following environment:
{
'HTTP_COMPANY' => 'Acme',
'HTTP_HOST' => 'example.com',
…
}
If the client sends a request which looks like this:
GET / HTTP/1.1
Host: example.com
Http-Company: Acme
Then the environment will look like this:
{
'HTTP_HTTP_COMPANY' => 'Acme',
'HTTP_HOST' => 'example.com',
…
}.
So yes: If you're using Rack directly, you will need to use HTTP_COMPANY on
the server-side, and that will correspond to the "Company" header sent from
the client.
// Magnus Holm
On Mon, Oct 24, 2016 at 10:16 AM, Olivar Plays <arne.de.herdt@gmail.com>
wrote:
> Hello,
>
> I have a small question about the behaviour of Rack when it comes to
> headers send by clients.
> Are these always prefixed with HTTP_ ? Or do I need to tell my clients to
> explicitly send them as HTTP_ ?
>
> Example, I'm checking on every request in my Rails application whether the
> HTTP_COMPANY header is present, and has the correct value.
> But I've been running into issues with detecting them.
> Right now I have the client app send the headers as COMPANY, and my Rails
> app checks as HTTP_COMPANY.
> Is this the intended behaviour, or will this go wrong again when the
> client suddenly submits the header as HTTP_COMPANY?
>
> e.g is Rack smart enough not to prefix HTTP_COMPANY with HTTTP_ again?
>
> Kind regards,
> Arne
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Rack Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rack-devel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
--
---
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #2: Type: text/html, Size: 3600 bytes --]
next prev parent reply other threads:[~2016-10-24 12:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 8:16 HTTP_ Headers from clients Olivar Plays
2016-10-24 12:01 ` Magnus Holm [this message]
2016-10-24 12:02 ` Lin Jen-Shin (godfat)
2016-10-24 12:28 ` Olivar Plays
2016-10-24 15:32 ` James Tucker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://groups.google.com/group/rack-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJ367fe3xUPRCr6mnccGEkCn3cUs61hNLyXKYR_Y-O8E+QVmjQ@mail.gmail.com \
--to=rack-devel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).