You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Dk Jack <dn...@gmail.com> on 2019/12/09 22:54:05 UTC
header values.
Hi,
I am using the atscppapi and I am noticing something weird. When I
send a curl request, here's list of headers curl prints.
------------------------------------------------------------
> GET / HTTP/1.1
> Host: testhost1
> User-Agent: curl/7.47.0
> content-type: woof
> accept-encoding: gzip, deflate
> accept-language: en-ca
> accept: application/json, text/plain, */*
---------------------------------------------------------------
I have the following code to print the headers in my module.
---------------------------------------------------------------------------------
ClientRequest &request = transaction.getClientRequest();
Headers &headers = request.getHeaders();
for (Headers::iterator hdr_itr = headers.begin(); hdr_itr !=
headers.end(); ++hdr_itr) {
log.logInfo("%s:%s", (*hdr_itr).name().c_str(),
(*hdr_itr).values().c_str());
}
------------------------------------------------------------------------------------
Here's what gets printed in the log:
------------------------------------------------------------------------------------
0191209.22h18m52s [INFO] Host:testhost1
20191209.22h18m52s [INFO] User-Agent:curl/7.47.0
20191209.22h18m52s [INFO] Content-Type:woof
20191209.22h18m52s [INFO] Accept-Encoding:gzip,deflate
20191209.22h18m52s [INFO] Accept-Language:en-ca
20191209.22h18m52s [INFO] Accept:application/json,text/plain,*/*
------------------------------------------------------------------------------------------
Notice the spaces are stripped off from all header values. I observed
that the server (origin) receives headers with the spaces being
stripped. Is this behavior specific to atscppapi? Is there a way to
prevent this from happening?
When I captured tcpdump, the incoming request has the spaces. Any help
is appreciated. Thanks.
Dk.
Re: header values.
Posted by Dk Jack <dn...@gmail.com>.
Yeah, something like that would be really useful for modules like ours.
Dk.
> On Dec 18, 2019, at 6:44 AM, Alan Carroll <so...@verizonmedia.com.INVALID> wrote:
>
> I'm trying to think how that could be done. The best option would be to
> save aside the original buffer, which is currently discarded after parsing.
> That might not be too bad to implement, with a configuration switch to
> indicate whether the raw buffer should be preserved.
>
>> On Tue, Dec 17, 2019 at 7:02 PM Dk Jack <dn...@gmail.com> wrote:
>>
>> Thanks Alan. Would be nice to have in future if possible. We have an nginx
>> module as well, where the module can access to original raw string. We’ll
>> have live with this for now.
>>
>> Dk.
>>
>>> On Dec 17, 2019, at 3:56 PM, Alan Carroll
>> <so...@verizonmedia.com.INVALID> wrote:
>>>
>>> I don't see any direct way to do that - the optional white space is
>> mostly
>>> ignored. The one trace that's left is the relationship between the
>> address
>>> of the name and value of the field. Even if these are copied in to the
>>> HdrHeap, they are copied as a pair. Therefore the amount of whitespace
>>> could be computed as (value.data() - (name.data() + name.size())) - 1
>>> (don't count the colon). This won't work for fields where the value has
>>> been changed, because the new value will be independent.
>>>
>>>> On Tue, Dec 17, 2019 at 4:41 PM Dk Jack <dn...@gmail.com> wrote:
>>>>
>>>> Perhaps, I should have started with the use case. Yes, our module is
>>>> sensitive to the space in the headers. Our module implements security
>>>> policies. One of the things we look at is headers and their values. How
>>>> they compare when a normal browser sends them vs when sent using a
>> script
>>>> Etc. We rely on these sort anomalies to tease out the good from the bad.
>>>> Not able extract the exact string that was sent by the client reduces
>> our
>>>> effectiveness. Hope you now understand the motivation behind my
>> question.
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>> On Dec 17, 2019, at 7:23 AM, Alan Carroll
>>>> <so...@verizonmedia.com.INVALID> wrote:
>>>>>
>>>>> You are seeing them "as is" - the view is literally the memory in which
>>>>> those values are stored. The space between the colon and the value is
>> not
>>>>> part of the value, it's part of the syntax no different than the
>> colon.
>>>>> That is, you
>>>>> used "%s:%s" to print the name/value for the field. Note the literal
>>>> colon
>>>>> - that should be a literal colon, space because that is part of the
>>>> syntax.
>>>>> See here - https://tools.ietf.org/html/rfc7230#section-3.2 - note the
>>>>> "value" part of the definition is distinct from the optional white
>> space
>>>>> (OWS).
>>>>>
>>>>> I'm unclear as to what you want to accomplish - if it's printing it
>>>> nicer,
>>>>> just put a space in your printf format string. Do you have some
>>>> application
>>>>> that is sensitive to the amount of white space?
>>>>>
>>>>>> On Mon, Dec 16, 2019 at 6:46 PM Dk Jack <dn...@gmail.com> wrote:
>>>>>>
>>>>>> Thans Alan,
>>>>>>
>>>>>> I can understand when constructing a new field, but the behavior I saw
>>>> was
>>>>>> for
>>>>>> incoming request headers. Is there an option to see the received
>> headers
>>>>>> as is?
>>>>>>
>>>>>>
>>>>
>>
Re: header values.
Posted by Alan Carroll <so...@verizonmedia.com.INVALID>.
I'm trying to think how that could be done. The best option would be to
save aside the original buffer, which is currently discarded after parsing.
That might not be too bad to implement, with a configuration switch to
indicate whether the raw buffer should be preserved.
On Tue, Dec 17, 2019 at 7:02 PM Dk Jack <dn...@gmail.com> wrote:
> Thanks Alan. Would be nice to have in future if possible. We have an nginx
> module as well, where the module can access to original raw string. We’ll
> have live with this for now.
>
> Dk.
>
> > On Dec 17, 2019, at 3:56 PM, Alan Carroll
> <so...@verizonmedia.com.INVALID> wrote:
> >
> > I don't see any direct way to do that - the optional white space is
> mostly
> > ignored. The one trace that's left is the relationship between the
> address
> > of the name and value of the field. Even if these are copied in to the
> > HdrHeap, they are copied as a pair. Therefore the amount of whitespace
> > could be computed as (value.data() - (name.data() + name.size())) - 1
> > (don't count the colon). This won't work for fields where the value has
> > been changed, because the new value will be independent.
> >
> >> On Tue, Dec 17, 2019 at 4:41 PM Dk Jack <dn...@gmail.com> wrote:
> >>
> >> Perhaps, I should have started with the use case. Yes, our module is
> >> sensitive to the space in the headers. Our module implements security
> >> policies. One of the things we look at is headers and their values. How
> >> they compare when a normal browser sends them vs when sent using a
> script
> >> Etc. We rely on these sort anomalies to tease out the good from the bad.
> >> Not able extract the exact string that was sent by the client reduces
> our
> >> effectiveness. Hope you now understand the motivation behind my
> question.
> >> Thanks.
> >>
> >>
> >>
> >>> On Dec 17, 2019, at 7:23 AM, Alan Carroll
> >> <so...@verizonmedia.com.INVALID> wrote:
> >>>
> >>> You are seeing them "as is" - the view is literally the memory in which
> >>> those values are stored. The space between the colon and the value is
> not
> >>> part of the value, it's part of the syntax no different than the
> colon.
> >>> That is, you
> >>> used "%s:%s" to print the name/value for the field. Note the literal
> >> colon
> >>> - that should be a literal colon, space because that is part of the
> >> syntax.
> >>> See here - https://tools.ietf.org/html/rfc7230#section-3.2 - note the
> >>> "value" part of the definition is distinct from the optional white
> space
> >>> (OWS).
> >>>
> >>> I'm unclear as to what you want to accomplish - if it's printing it
> >> nicer,
> >>> just put a space in your printf format string. Do you have some
> >> application
> >>> that is sensitive to the amount of white space?
> >>>
> >>>> On Mon, Dec 16, 2019 at 6:46 PM Dk Jack <dn...@gmail.com> wrote:
> >>>>
> >>>> Thans Alan,
> >>>>
> >>>> I can understand when constructing a new field, but the behavior I saw
> >> was
> >>>> for
> >>>> incoming request headers. Is there an option to see the received
> headers
> >>>> as is?
> >>>>
> >>>>
> >>
>
Re: header values.
Posted by Dk Jack <dn...@gmail.com>.
Thanks Alan. Would be nice to have in future if possible. We have an nginx module as well, where the module can access to original raw string. We’ll have live with this for now.
Dk.
> On Dec 17, 2019, at 3:56 PM, Alan Carroll <so...@verizonmedia.com.INVALID> wrote:
>
> I don't see any direct way to do that - the optional white space is mostly
> ignored. The one trace that's left is the relationship between the address
> of the name and value of the field. Even if these are copied in to the
> HdrHeap, they are copied as a pair. Therefore the amount of whitespace
> could be computed as (value.data() - (name.data() + name.size())) - 1
> (don't count the colon). This won't work for fields where the value has
> been changed, because the new value will be independent.
>
>> On Tue, Dec 17, 2019 at 4:41 PM Dk Jack <dn...@gmail.com> wrote:
>>
>> Perhaps, I should have started with the use case. Yes, our module is
>> sensitive to the space in the headers. Our module implements security
>> policies. One of the things we look at is headers and their values. How
>> they compare when a normal browser sends them vs when sent using a script
>> Etc. We rely on these sort anomalies to tease out the good from the bad.
>> Not able extract the exact string that was sent by the client reduces our
>> effectiveness. Hope you now understand the motivation behind my question.
>> Thanks.
>>
>>
>>
>>> On Dec 17, 2019, at 7:23 AM, Alan Carroll
>> <so...@verizonmedia.com.INVALID> wrote:
>>>
>>> You are seeing them "as is" - the view is literally the memory in which
>>> those values are stored. The space between the colon and the value is not
>>> part of the value, it's part of the syntax no different than the colon.
>>> That is, you
>>> used "%s:%s" to print the name/value for the field. Note the literal
>> colon
>>> - that should be a literal colon, space because that is part of the
>> syntax.
>>> See here - https://tools.ietf.org/html/rfc7230#section-3.2 - note the
>>> "value" part of the definition is distinct from the optional white space
>>> (OWS).
>>>
>>> I'm unclear as to what you want to accomplish - if it's printing it
>> nicer,
>>> just put a space in your printf format string. Do you have some
>> application
>>> that is sensitive to the amount of white space?
>>>
>>>> On Mon, Dec 16, 2019 at 6:46 PM Dk Jack <dn...@gmail.com> wrote:
>>>>
>>>> Thans Alan,
>>>>
>>>> I can understand when constructing a new field, but the behavior I saw
>> was
>>>> for
>>>> incoming request headers. Is there an option to see the received headers
>>>> as is?
>>>>
>>>>
>>
Re: header values.
Posted by Alan Carroll <so...@verizonmedia.com.INVALID>.
I don't see any direct way to do that - the optional white space is mostly
ignored. The one trace that's left is the relationship between the address
of the name and value of the field. Even if these are copied in to the
HdrHeap, they are copied as a pair. Therefore the amount of whitespace
could be computed as (value.data() - (name.data() + name.size())) - 1
(don't count the colon). This won't work for fields where the value has
been changed, because the new value will be independent.
On Tue, Dec 17, 2019 at 4:41 PM Dk Jack <dn...@gmail.com> wrote:
> Perhaps, I should have started with the use case. Yes, our module is
> sensitive to the space in the headers. Our module implements security
> policies. One of the things we look at is headers and their values. How
> they compare when a normal browser sends them vs when sent using a script
> Etc. We rely on these sort anomalies to tease out the good from the bad.
> Not able extract the exact string that was sent by the client reduces our
> effectiveness. Hope you now understand the motivation behind my question.
> Thanks.
>
>
>
> > On Dec 17, 2019, at 7:23 AM, Alan Carroll
> <so...@verizonmedia.com.INVALID> wrote:
> >
> > You are seeing them "as is" - the view is literally the memory in which
> > those values are stored. The space between the colon and the value is not
> > part of the value, it's part of the syntax no different than the colon.
> > That is, you
> > used "%s:%s" to print the name/value for the field. Note the literal
> colon
> > - that should be a literal colon, space because that is part of the
> syntax.
> > See here - https://tools.ietf.org/html/rfc7230#section-3.2 - note the
> > "value" part of the definition is distinct from the optional white space
> > (OWS).
> >
> > I'm unclear as to what you want to accomplish - if it's printing it
> nicer,
> > just put a space in your printf format string. Do you have some
> application
> > that is sensitive to the amount of white space?
> >
> >> On Mon, Dec 16, 2019 at 6:46 PM Dk Jack <dn...@gmail.com> wrote:
> >>
> >> Thans Alan,
> >>
> >> I can understand when constructing a new field, but the behavior I saw
> was
> >> for
> >> incoming request headers. Is there an option to see the received headers
> >> as is?
> >>
> >>
>
Re: header values.
Posted by Dk Jack <dn...@gmail.com>.
Perhaps, I should have started with the use case. Yes, our module is sensitive to the space in the headers. Our module implements security policies. One of the things we look at is headers and their values. How they compare when a normal browser sends them vs when sent using a script Etc. We rely on these sort anomalies to tease out the good from the bad. Not able extract the exact string that was sent by the client reduces our effectiveness. Hope you now understand the motivation behind my question. Thanks.
> On Dec 17, 2019, at 7:23 AM, Alan Carroll <so...@verizonmedia.com.INVALID> wrote:
>
> You are seeing them "as is" - the view is literally the memory in which
> those values are stored. The space between the colon and the value is not
> part of the value, it's part of the syntax no different than the colon.
> That is, you
> used "%s:%s" to print the name/value for the field. Note the literal colon
> - that should be a literal colon, space because that is part of the syntax.
> See here - https://tools.ietf.org/html/rfc7230#section-3.2 - note the
> "value" part of the definition is distinct from the optional white space
> (OWS).
>
> I'm unclear as to what you want to accomplish - if it's printing it nicer,
> just put a space in your printf format string. Do you have some application
> that is sensitive to the amount of white space?
>
>> On Mon, Dec 16, 2019 at 6:46 PM Dk Jack <dn...@gmail.com> wrote:
>>
>> Thans Alan,
>>
>> I can understand when constructing a new field, but the behavior I saw was
>> for
>> incoming request headers. Is there an option to see the received headers
>> as is?
>>
>>
Re: header values.
Posted by Alan Carroll <so...@verizonmedia.com.INVALID>.
You are seeing them "as is" - the view is literally the memory in which
those values are stored. The space between the colon and the value is not
part of the value, it's part of the syntax no different than the colon.
That is, you
used "%s:%s" to print the name/value for the field. Note the literal colon
- that should be a literal colon, space because that is part of the syntax.
See here - https://tools.ietf.org/html/rfc7230#section-3.2 - note the
"value" part of the definition is distinct from the optional white space
(OWS).
I'm unclear as to what you want to accomplish - if it's printing it nicer,
just put a space in your printf format string. Do you have some application
that is sensitive to the amount of white space?
On Mon, Dec 16, 2019 at 6:46 PM Dk Jack <dn...@gmail.com> wrote:
> Thans Alan,
>
> I can understand when constructing a new field, but the behavior I saw was
> for
> incoming request headers. Is there an option to see the received headers
> as is?
>
>
Re: header values.
Posted by Dk Jack <dn...@gmail.com>.
Thans Alan,
I can understand when constructing a new field, but the behavior I saw was for
incoming request headers. Is there an option to see the received headers as is?
On Mon, Dec 16, 2019 at 11:54 AM Alan Carroll
<so...@verizonmedia.com.invalid> wrote:
>
> This behavior is intrinsic to the plugin API. The values returned are the
> equivalent of `std::string_view` and directly reference the appropriate
> parts of the header. The spaces aren't "stripped" per se, it is simply that
> the views don't include the spaces. When constructing a new field the space
> is added automatically as it is part of the specification and not
> considered part of the name or value of the field.
>
> On Mon, Dec 9, 2019 at 5:36 PM Dk Jack <dn...@gmail.com> wrote:
>
> > Does TS maintain two copies of the header values? Because the origin
> > is receiving the unmodified header values i.e. with spaces...
> >
> > On Mon, Dec 9, 2019 at 3:15 PM Valentín Gutierrez
> > <vg...@wikimedia.org> wrote:
> > >
> > > IIRC TS normalizes header names and values to avoid inconsistencies and
> > > potential security issues
> > >
> > > On Tue, Dec 10, 2019, 08:08 Walt Karas <wk...@verizonmedia.com.invalid>
> > > wrote:
> > >
> > > > It looks like TS is discarding spaces that are unnecessary to the
> > meaning
> > > > of the message.
> > > >
> > > > On Mon, Dec 9, 2019 at 4:54 PM Dk Jack <dn...@gmail.com> wrote:
> > > >
> > > > > Hi,
> > > > > I am using the atscppapi and I am noticing something weird. When I
> > > > > send a curl request, here's list of headers curl prints.
> > > > >
> > > > > ------------------------------------------------------------
> > > > > > GET / HTTP/1.1
> > > > > > Host: testhost1
> > > > > > User-Agent: curl/7.47.0
> > > > > > content-type: woof
> > > > > > accept-encoding: gzip, deflate
> > > > > > accept-language: en-ca
> > > > > > accept: application/json, text/plain, */*
> > > > > ---------------------------------------------------------------
> > > > >
> > > > > I have the following code to print the headers in my module.
> > > > >
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------------------
> > > > > ClientRequest &request = transaction.getClientRequest();
> > > > > Headers &headers = request.getHeaders();
> > > > >
> > > > > for (Headers::iterator hdr_itr = headers.begin(); hdr_itr !=
> > > > > headers.end(); ++hdr_itr) {
> > > > > log.logInfo("%s:%s", (*hdr_itr).name().c_str(),
> > > > > (*hdr_itr).values().c_str());
> > > > > }
> > > > >
> > > > >
> > > >
> > ------------------------------------------------------------------------------------
> > > > >
> > > > > Here's what gets printed in the log:
> > > > >
> > > > >
> > > >
> > ------------------------------------------------------------------------------------
> > > > > 0191209.22h18m52s [INFO] Host:testhost1
> > > > > 20191209.22h18m52s [INFO] User-Agent:curl/7.47.0
> > > > > 20191209.22h18m52s [INFO] Content-Type:woof
> > > > > 20191209.22h18m52s [INFO] Accept-Encoding:gzip,deflate
> > > > > 20191209.22h18m52s [INFO] Accept-Language:en-ca
> > > > > 20191209.22h18m52s [INFO] Accept:application/json,text/plain,*/*
> > > > >
> > > > >
> > > >
> > ------------------------------------------------------------------------------------------
> > > > >
> > > > > Notice the spaces are stripped off from all header values. I observed
> > > > > that the server (origin) receives headers with the spaces being
> > > > > stripped. Is this behavior specific to atscppapi? Is there a way to
> > > > > prevent this from happening?
> > > > >
> > > > > When I captured tcpdump, the incoming request has the spaces. Any
> > help
> > > > > is appreciated. Thanks.
> > > > >
> > > > > Dk.
> > > > >
> > > >
> >
Re: header values.
Posted by Alan Carroll <so...@verizonmedia.com.INVALID>.
This behavior is intrinsic to the plugin API. The values returned are the
equivalent of `std::string_view` and directly reference the appropriate
parts of the header. The spaces aren't "stripped" per se, it is simply that
the views don't include the spaces. When constructing a new field the space
is added automatically as it is part of the specification and not
considered part of the name or value of the field.
On Mon, Dec 9, 2019 at 5:36 PM Dk Jack <dn...@gmail.com> wrote:
> Does TS maintain two copies of the header values? Because the origin
> is receiving the unmodified header values i.e. with spaces...
>
> On Mon, Dec 9, 2019 at 3:15 PM Valentín Gutierrez
> <vg...@wikimedia.org> wrote:
> >
> > IIRC TS normalizes header names and values to avoid inconsistencies and
> > potential security issues
> >
> > On Tue, Dec 10, 2019, 08:08 Walt Karas <wk...@verizonmedia.com.invalid>
> > wrote:
> >
> > > It looks like TS is discarding spaces that are unnecessary to the
> meaning
> > > of the message.
> > >
> > > On Mon, Dec 9, 2019 at 4:54 PM Dk Jack <dn...@gmail.com> wrote:
> > >
> > > > Hi,
> > > > I am using the atscppapi and I am noticing something weird. When I
> > > > send a curl request, here's list of headers curl prints.
> > > >
> > > > ------------------------------------------------------------
> > > > > GET / HTTP/1.1
> > > > > Host: testhost1
> > > > > User-Agent: curl/7.47.0
> > > > > content-type: woof
> > > > > accept-encoding: gzip, deflate
> > > > > accept-language: en-ca
> > > > > accept: application/json, text/plain, */*
> > > > ---------------------------------------------------------------
> > > >
> > > > I have the following code to print the headers in my module.
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------------------
> > > > ClientRequest &request = transaction.getClientRequest();
> > > > Headers &headers = request.getHeaders();
> > > >
> > > > for (Headers::iterator hdr_itr = headers.begin(); hdr_itr !=
> > > > headers.end(); ++hdr_itr) {
> > > > log.logInfo("%s:%s", (*hdr_itr).name().c_str(),
> > > > (*hdr_itr).values().c_str());
> > > > }
> > > >
> > > >
> > >
> ------------------------------------------------------------------------------------
> > > >
> > > > Here's what gets printed in the log:
> > > >
> > > >
> > >
> ------------------------------------------------------------------------------------
> > > > 0191209.22h18m52s [INFO] Host:testhost1
> > > > 20191209.22h18m52s [INFO] User-Agent:curl/7.47.0
> > > > 20191209.22h18m52s [INFO] Content-Type:woof
> > > > 20191209.22h18m52s [INFO] Accept-Encoding:gzip,deflate
> > > > 20191209.22h18m52s [INFO] Accept-Language:en-ca
> > > > 20191209.22h18m52s [INFO] Accept:application/json,text/plain,*/*
> > > >
> > > >
> > >
> ------------------------------------------------------------------------------------------
> > > >
> > > > Notice the spaces are stripped off from all header values. I observed
> > > > that the server (origin) receives headers with the spaces being
> > > > stripped. Is this behavior specific to atscppapi? Is there a way to
> > > > prevent this from happening?
> > > >
> > > > When I captured tcpdump, the incoming request has the spaces. Any
> help
> > > > is appreciated. Thanks.
> > > >
> > > > Dk.
> > > >
> > >
>
Re: header values.
Posted by Dk Jack <dn...@gmail.com>.
Does TS maintain two copies of the header values? Because the origin
is receiving the unmodified header values i.e. with spaces...
On Mon, Dec 9, 2019 at 3:15 PM Valentín Gutierrez
<vg...@wikimedia.org> wrote:
>
> IIRC TS normalizes header names and values to avoid inconsistencies and
> potential security issues
>
> On Tue, Dec 10, 2019, 08:08 Walt Karas <wk...@verizonmedia.com.invalid>
> wrote:
>
> > It looks like TS is discarding spaces that are unnecessary to the meaning
> > of the message.
> >
> > On Mon, Dec 9, 2019 at 4:54 PM Dk Jack <dn...@gmail.com> wrote:
> >
> > > Hi,
> > > I am using the atscppapi and I am noticing something weird. When I
> > > send a curl request, here's list of headers curl prints.
> > >
> > > ------------------------------------------------------------
> > > > GET / HTTP/1.1
> > > > Host: testhost1
> > > > User-Agent: curl/7.47.0
> > > > content-type: woof
> > > > accept-encoding: gzip, deflate
> > > > accept-language: en-ca
> > > > accept: application/json, text/plain, */*
> > > ---------------------------------------------------------------
> > >
> > > I have the following code to print the headers in my module.
> > >
> > >
> > >
> > ---------------------------------------------------------------------------------
> > > ClientRequest &request = transaction.getClientRequest();
> > > Headers &headers = request.getHeaders();
> > >
> > > for (Headers::iterator hdr_itr = headers.begin(); hdr_itr !=
> > > headers.end(); ++hdr_itr) {
> > > log.logInfo("%s:%s", (*hdr_itr).name().c_str(),
> > > (*hdr_itr).values().c_str());
> > > }
> > >
> > >
> > ------------------------------------------------------------------------------------
> > >
> > > Here's what gets printed in the log:
> > >
> > >
> > ------------------------------------------------------------------------------------
> > > 0191209.22h18m52s [INFO] Host:testhost1
> > > 20191209.22h18m52s [INFO] User-Agent:curl/7.47.0
> > > 20191209.22h18m52s [INFO] Content-Type:woof
> > > 20191209.22h18m52s [INFO] Accept-Encoding:gzip,deflate
> > > 20191209.22h18m52s [INFO] Accept-Language:en-ca
> > > 20191209.22h18m52s [INFO] Accept:application/json,text/plain,*/*
> > >
> > >
> > ------------------------------------------------------------------------------------------
> > >
> > > Notice the spaces are stripped off from all header values. I observed
> > > that the server (origin) receives headers with the spaces being
> > > stripped. Is this behavior specific to atscppapi? Is there a way to
> > > prevent this from happening?
> > >
> > > When I captured tcpdump, the incoming request has the spaces. Any help
> > > is appreciated. Thanks.
> > >
> > > Dk.
> > >
> >
Re: header values.
Posted by Valentín Gutierrez <vg...@wikimedia.org>.
IIRC TS normalizes header names and values to avoid inconsistencies and
potential security issues
On Tue, Dec 10, 2019, 08:08 Walt Karas <wk...@verizonmedia.com.invalid>
wrote:
> It looks like TS is discarding spaces that are unnecessary to the meaning
> of the message.
>
> On Mon, Dec 9, 2019 at 4:54 PM Dk Jack <dn...@gmail.com> wrote:
>
> > Hi,
> > I am using the atscppapi and I am noticing something weird. When I
> > send a curl request, here's list of headers curl prints.
> >
> > ------------------------------------------------------------
> > > GET / HTTP/1.1
> > > Host: testhost1
> > > User-Agent: curl/7.47.0
> > > content-type: woof
> > > accept-encoding: gzip, deflate
> > > accept-language: en-ca
> > > accept: application/json, text/plain, */*
> > ---------------------------------------------------------------
> >
> > I have the following code to print the headers in my module.
> >
> >
> >
> ---------------------------------------------------------------------------------
> > ClientRequest &request = transaction.getClientRequest();
> > Headers &headers = request.getHeaders();
> >
> > for (Headers::iterator hdr_itr = headers.begin(); hdr_itr !=
> > headers.end(); ++hdr_itr) {
> > log.logInfo("%s:%s", (*hdr_itr).name().c_str(),
> > (*hdr_itr).values().c_str());
> > }
> >
> >
> ------------------------------------------------------------------------------------
> >
> > Here's what gets printed in the log:
> >
> >
> ------------------------------------------------------------------------------------
> > 0191209.22h18m52s [INFO] Host:testhost1
> > 20191209.22h18m52s [INFO] User-Agent:curl/7.47.0
> > 20191209.22h18m52s [INFO] Content-Type:woof
> > 20191209.22h18m52s [INFO] Accept-Encoding:gzip,deflate
> > 20191209.22h18m52s [INFO] Accept-Language:en-ca
> > 20191209.22h18m52s [INFO] Accept:application/json,text/plain,*/*
> >
> >
> ------------------------------------------------------------------------------------------
> >
> > Notice the spaces are stripped off from all header values. I observed
> > that the server (origin) receives headers with the spaces being
> > stripped. Is this behavior specific to atscppapi? Is there a way to
> > prevent this from happening?
> >
> > When I captured tcpdump, the incoming request has the spaces. Any help
> > is appreciated. Thanks.
> >
> > Dk.
> >
>
Re: header values.
Posted by Walt Karas <wk...@verizonmedia.com.INVALID>.
It looks like TS is discarding spaces that are unnecessary to the meaning
of the message.
On Mon, Dec 9, 2019 at 4:54 PM Dk Jack <dn...@gmail.com> wrote:
> Hi,
> I am using the atscppapi and I am noticing something weird. When I
> send a curl request, here's list of headers curl prints.
>
> ------------------------------------------------------------
> > GET / HTTP/1.1
> > Host: testhost1
> > User-Agent: curl/7.47.0
> > content-type: woof
> > accept-encoding: gzip, deflate
> > accept-language: en-ca
> > accept: application/json, text/plain, */*
> ---------------------------------------------------------------
>
> I have the following code to print the headers in my module.
>
>
> ---------------------------------------------------------------------------------
> ClientRequest &request = transaction.getClientRequest();
> Headers &headers = request.getHeaders();
>
> for (Headers::iterator hdr_itr = headers.begin(); hdr_itr !=
> headers.end(); ++hdr_itr) {
> log.logInfo("%s:%s", (*hdr_itr).name().c_str(),
> (*hdr_itr).values().c_str());
> }
>
> ------------------------------------------------------------------------------------
>
> Here's what gets printed in the log:
>
> ------------------------------------------------------------------------------------
> 0191209.22h18m52s [INFO] Host:testhost1
> 20191209.22h18m52s [INFO] User-Agent:curl/7.47.0
> 20191209.22h18m52s [INFO] Content-Type:woof
> 20191209.22h18m52s [INFO] Accept-Encoding:gzip,deflate
> 20191209.22h18m52s [INFO] Accept-Language:en-ca
> 20191209.22h18m52s [INFO] Accept:application/json,text/plain,*/*
>
> ------------------------------------------------------------------------------------------
>
> Notice the spaces are stripped off from all header values. I observed
> that the server (origin) receives headers with the spaces being
> stripped. Is this behavior specific to atscppapi? Is there a way to
> prevent this from happening?
>
> When I captured tcpdump, the incoming request has the spaces. Any help
> is appreciated. Thanks.
>
> Dk.
>