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 <dnj0...@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 > <vgutier...@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 <wka...@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 <dnj0...@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. > > > > > > > >