diff options
| author | Nyx Linden <nyx@lindenlab.com> | 2013-06-18 16:15:03 -0400 | 
|---|---|---|
| committer | Nyx Linden <nyx@lindenlab.com> | 2013-06-18 16:15:03 -0400 | 
| commit | 69b062b90889fe581de0d10d60b979cb7883b4a0 (patch) | |
| tree | 6286fc967bc0f551a9e67b8377bdfbc743f090b2 /indra/llcorehttp/_httpoprequest.cpp | |
| parent | c67db8e75511de879c69de0faf06a88ac3cc731d (diff) | |
| parent | 425ff28e4bc38ba3f7bfeade4a72dce4eba63b54 (diff) | |
merge with viewer-release
Diffstat (limited to 'indra/llcorehttp/_httpoprequest.cpp')
| -rwxr-xr-x | indra/llcorehttp/_httpoprequest.cpp | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 51a8eaf998..95e0f72c0b 100755 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -4,7 +4,7 @@   *   * $LicenseInfo:firstyear=2012&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2012, Linden Research, Inc. + * Copyright (C) 2012-2013, Linden Research, Inc.   *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public @@ -44,7 +44,7 @@  #include "_httplibcurl.h"  #include "_httpinternal.h" -#include "llhttpstatuscodes.h" +#include "llhttpconstants.h"  #include "llproxy.h"  namespace @@ -479,6 +479,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  			curl_easy_setopt(mCurlHandle, CURLOPT_INFILESIZE, data_size);  			curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, (void *) NULL);  			mCurlHeaders = curl_slist_append(mCurlHeaders, "Expect:"); +			// *TODO: Should this be 'Keep-Alive' ?  			mCurlHeaders = curl_slist_append(mCurlHeaders, "Connection: keep-alive");  			mCurlHeaders = curl_slist_append(mCurlHeaders, "Keep-alive: 300");  		} @@ -609,7 +610,8 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi  	const size_t hdr_size(size * nmemb);  	const char * hdr_data(static_cast<const char *>(data));		// Not null terminated - +	bool is_header(true); +	  	if (hdr_size >= status_line_len && ! strncmp(status_line, hdr_data, status_line_len))  	{  		// One of possibly several status lines.  Reset what we know and start over @@ -620,8 +622,9 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi  		op->mStatus = HttpStatus();  		if (op->mReplyHeaders)  		{ -			op->mReplyHeaders->mHeaders.clear(); +			op->mReplyHeaders->clear();  		} +		is_header = false;  	}  	// Nothing in here wants a final CR/LF combination.  Remove @@ -636,18 +639,18 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi  	}  	// Save header if caller wants them in the response -	if (op->mProcFlags & PF_SAVE_HEADERS) +	if (is_header && op->mProcFlags & PF_SAVE_HEADERS)  	{  		// Save headers in response  		if (! op->mReplyHeaders)  		{  			op->mReplyHeaders = new HttpHeaders;  		} -		op->mReplyHeaders->mHeaders.push_back(std::string(hdr_data, wanted_hdr_size)); +		op->mReplyHeaders->appendNormal(hdr_data, wanted_hdr_size);  	}  	// Detect and parse 'Content-Range' headers -	if (op->mProcFlags & PF_SCAN_RANGE_HEADER) +	if (is_header && op->mProcFlags & PF_SCAN_RANGE_HEADER)  	{  		char hdr_buffer[128];			// Enough for a reasonable header  		size_t frag_size((std::min)(wanted_hdr_size, sizeof(hdr_buffer) - 1)); | 
