summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/_httpoprequest.cpp
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2012-06-20 18:43:28 -0400
committerMonty Brandenberg <monty@lindenlab.com>2012-06-20 18:43:28 -0400
commita066bc1994fccae7967921980332505aac97953f (patch)
tree19e1e0e5ef0594545b30aa06845b0638bcf445cf /indra/llcorehttp/_httpoprequest.cpp
parent6b4fe9fadc2301eb13a2854457b67fbebe045b08 (diff)
SH-3181 More interface options for API. Also includes returned headers.
Only thing interesting in this changeset is the discovery that a sleep in the fake HTTP server ties up tests. Need to thread that or fail on client disconnect or something to speed that up and make it usable for bigger test scenarios. But good enough for now...
Diffstat (limited to 'indra/llcorehttp/_httpoprequest.cpp')
-rw-r--r--indra/llcorehttp/_httpoprequest.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 516daadf9b..86ecee5b26 100644
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -595,6 +595,10 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi
op->mReplyLength = 0;
op->mReplyFullLength = 0;
op->mStatus = HttpStatus();
+ if (op->mReplyHeaders)
+ {
+ op->mReplyHeaders->mHeaders.clear();
+ }
}
else if (op->mProcFlags & PF_SCAN_RANGE_HEADER)
{
@@ -636,9 +640,19 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi
if (op->mProcFlags & PF_SAVE_HEADERS)
{
// Save headers in response
- // *FIXME: Implement this...
- ;
-
+ if (! op->mReplyHeaders)
+ {
+ op->mReplyHeaders = new HttpHeaders;
+ }
+ size_t wanted_size(hdr_size);
+ if (wanted_size && '\n' == hdr_data[wanted_size - 1])
+ {
+ if (--wanted_size && '\r' == hdr_data[wanted_size - 1])
+ {
+ --wanted_size;
+ }
+ }
+ op->mReplyHeaders->mHeaders.push_back(std::string(hdr_data, wanted_size));
}
return hdr_size;