[ 
https://issues.apache.org/jira/browse/TS-1045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13164974#comment-13164974
 ] 

Brian Geffon edited comment on TS-1045 at 12/8/11 4:12 AM:
-----------------------------------------------------------

You can get headers from a request sent via TSFetchURL using standard ATS APIs

 const char *dataStart = TSFetchRespGet(txn, &dataLen);
 const char *dataEnd = dataStart + dataLen;
 TSHttpParser parser = TSHttpParserCreate();
 TSMBuffer buf = TSMBufferCreate();
 TSMLoc hdrLoc = TSHttpHdrCreate(buf);
 TSHttpHdrTypeSet(buf, hdrLoc, TS_HTTP_TYPE_RESPONSE);
 if (TSHttpHdrParseResp(parser, buf, hdrLoc, &dataStart, dataEnd) == 
TS_PARSE_DONE)
 {
   // you can now access hdrLoc like any other TSMLoc to a header

 }
                
      was (Author: briang):
    You can get headers from a request sent via TSFetchURL using standard ATS 
APIs, I do it all the time:

 const char *dataStart = TSFetchRespGet(txn, &dataLen);
 const char *dataEnd = dataStart + dataLen;
 TSHttpParser parser = TSHttpParserCreate();
 TSMBuffer buf = TSMBufferCreate();
 TSMLoc hdrLoc = TSHttpHdrCreate(buf);
 TSHttpHdrTypeSet(buf, hdrLoc, TS_HTTP_TYPE_RESPONSE);
 if (TSHttpHdrParseResp(parser, buf, hdrLoc, &dataStart, dataEnd) == 
TS_PARSE_DONE)
 {
   // you can now access hdrLoc like any other TSMLoc to a header

 }
                  
> PATCH: add new TSFetchHdrGet API
> --------------------------------
>
>                 Key: TS-1045
>                 URL: https://issues.apache.org/jira/browse/TS-1045
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: HTTP
>            Reporter: James Peach
>            Priority: Minor
>         Attachments: 0007-Add-new-public-API-TSFetchHdrGet.patch
>
>
> TSFetchUrl does not provide any way to get the headers from the result. This 
> patch adds a new API TSFetchHdrGet(), which is analogous to TSFetchRespGet() 
> and returns the headers.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to