From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from mail-ua0-f188.google.com (mail-ua0-f188.google.com [209.85.217.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id E48981FBB0 for ; Mon, 24 Oct 2016 12:25:15 +0000 (UTC) Received: by mail-ua0-f188.google.com with SMTP id m26sf5634053uaa.1 for ; Mon, 24 Oct 2016 05:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:mime-version:in-reply-to:references:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=YB1klJ8IzcDGfi5rgsvAWuGBxIDOdL4X2xMCNucW9fg=; b=viL+62eqkPGllUwzrSx/Zio/xgGDgi2YL7sXINYiRNH8EQKxI7aGEXET/X3LeOrDrM L7wuAxSHa9ZGjtZbqY7yU49RA108oSy7OWLPoyn0vcnSnscht+Ra/1IvHjeLM/5F6m8q dzpIcB0tOOk8zQ3ubvd9KIY7mY9fq7iP8h86N+2hVIOOJYa/BktHfxAjUtBlu714X0Fl CvdQXDPqKs4eX6L49BYjSJU3eCFlsue82BZZqtzHbOVx8D3IBl/wNP54+YBWWA4hhUD1 WxXilBrgWQwwv2Lbck3JjlYK3SA6GUt2a5YfGrokbXZ9Wkhnk0yELgtpEt7Az1w0pXeq EPww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=sender:x-gm-message-state:mime-version:in-reply-to:references:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=YB1klJ8IzcDGfi5rgsvAWuGBxIDOdL4X2xMCNucW9fg=; b=RxkQTTfFJ21vVHn+0+UuQ3CFX0D2Ifj/TLZXqo2F0tBwb72U5je6eySaUCBtTM35eh URnLSOsz3cov6HS+SmChhRR1wY5LtRKk7Mfoe1t3SiWmww5EuqobBUPFh2APScd4tQ3z qP30yC6PwbIP5YvX8Q456gIOe/V5OAy+HH/r4aKPg2z1eBmJ9r8vIPAY55xnlSVmm+TP G9fGoicFbIKETIhM9VDyTKSmnjnuEKj/ud43g8HMEkebO/gxuU70udJD9MmGguIIra3V JLRafi2R1SeLbdI9JNIcLfTYyQkTKWtMLLFRz8vlSYDtaEfK+oZEB9Z1FPjNeMn2V6MR bGhw== Sender: rack-devel@googlegroups.com X-Gm-Message-State: ABUngvczNucg0NopnoeOCwYhHsv7yg8Wk24rna/+MwnnkD6FG0mq600O+qUL3k5SDx/sTQ== X-Received: by 10.157.60.235 with SMTP id t40mr1910326otf.0.1477311915076; Mon, 24 Oct 2016 05:25:15 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.157.63.102 with SMTP id m93ls11801395otc.2.gmail; Mon, 24 Oct 2016 05:25:14 -0700 (PDT) X-Received: by 10.129.102.137 with SMTP id a131mr10911806ywc.80.1477311914753; Mon, 24 Oct 2016 05:25:14 -0700 (PDT) Received: by 10.55.78.74 with SMTP id c71msqkb; Mon, 24 Oct 2016 05:03:13 -0700 (PDT) X-Received: by 10.28.209.4 with SMTP id i4mr2101257wmg.3.1477310593300; Mon, 24 Oct 2016 05:03:13 -0700 (PDT) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com. [2a00:1450:400c:c09::234]) by gmr-mx.google.com with ESMTPS id h82si534037wmh.2.2016.10.24.05.03.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 05:03:12 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c09::234 is neither permitted nor denied by best guess record for domain of godfat@godfat.org) client-ip=2a00:1450:400c:c09::234; Received: by mail-wm0-x234.google.com with SMTP id c78so100473301wme.0 for ; Mon, 24 Oct 2016 05:03:12 -0700 (PDT) X-Received: by 10.28.10.202 with SMTP id 193mr18337562wmk.24.1477310592561; Mon, 24 Oct 2016 05:03:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.179.6 with HTTP; Mon, 24 Oct 2016 05:02:41 -0700 (PDT) In-Reply-To: <6c68f46f-fdc5-4cd3-b36c-9b2c6bf3e03e@googlegroups.com> References: <6c68f46f-fdc5-4cd3-b36c-9b2c6bf3e03e@googlegroups.com> From: "Lin Jen-Shin (godfat)" Date: Mon, 24 Oct 2016 20:02:41 +0800 Message-ID: Subject: Re: HTTP_ Headers from clients To: rack-devel@googlegroups.com Content-Type: text/plain; charset=UTF-8 X-Original-Sender: godfat@godfat.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=temperror (no key for signature) header.i=@godfat.org; spf=neutral (google.com: 2a00:1450:400c:c09::234 is neither permitted nor denied by best guess record for domain of godfat@godfat.org) smtp.mailfrom=godfat@godfat.org Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: X-Google-Group-Id: 486215384060 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Hi, On Mon, Oct 24, 2016 at 4:16 PM, Olivar Plays 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_ ? I think according to Rack SPEC, all headers sent from client should be prefixed with HTTP_, and if your client prefix HTTP_, then you'll end up seeing HTTP_HTTP_ in your Rack application. > 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. This is intended. > 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? As stated above, if your client is sending HTTP_COMPANY, then you'll need to access it via HTTP_HTTP_COMPANY in your Rack application. Rack should not try to remove the prefix, otherwise HTTP_COMPANY and COMPANY would be ambiguous. It's designed this way to mix HTTP headers into env unambiguously. > 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.