The TS API provides a couple of different functions to get HTTP
request and response data.  Thus I can get a Request using
TSHttpTxnClientReqGet, TSHttpTxnServerReqGet or
TSHttpTxnCachedReqGet.  I'm looking for the Client data, and
the semantics of TSHttpTxnClientReqGet seem inconsistent.

I can demonstrate inconsistency in a pseudo-code:

  len1 = TSHttpTxnClientReqHdrBytesGet(txnp);

  TSHttpTxnClientReqGet(txnp, &buf, &hdr);
  TSHttpHdrPrint(buf, hdr, iobuf);
  reader = TSIOBufferReaderAlloc(iobuf);
  blockp = TSIOBufferReaderStart(reader);
  len2 = TSIOBufferBlockReadAvail(block, reader);
  len3 = len2;
  data = TSIOBufferBlockReadStart(block, reader, &len3);

  print [len1, len2, len3]

==>  [139, 167, 167]

Why does len1 differ from len2 and len3?  And what is the
actual length of the request?

Diagnosis:

len1 is the length of the actual Client request:

GET /trafficserver/ HTTP/1.1
Host: myproxy
[other stuff]

But the buffer returned by TSHttpTxnClientReqGet is the proxy's request:

GET http://trafficserver.apache.org/ HTTP/1.1
Host: trafficserver.apache.org
[other stuff]

Yes, it really is in the form of a forward-proxy request, although
no actual forward proxy is involved!

Apart from these apparently-inconsistent semantics being confusing,
the version I'm looking for is the first one, and I don't seem able to get it!

Is this a bug?

-- 
Nick Kew

Reply via email to