[Opensrf-commits] r1906 - trunk/src/gateway (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 27 22:14:34 EST 2010
Author: dbs
Date: 2010-01-27 22:14:32 -0500 (Wed, 27 Jan 2010)
New Revision: 1906
Modified:
trunk/src/gateway/osrf_http_translator.c
Log:
Provide a thread if the translator wasn't passed one in the request headers
The OpenSRF-over-HTTP spec says that the translator will generate a thread
in the response if one wasn't passed in the request; however, we were trying
to pass a null pointer back and that doesn't work so well.
As we're already generating a reasonably unique string for the purposes
of delim in the multipart data response, let's also use that for the
response thread when necessary.
Modified: trunk/src/gateway/osrf_http_translator.c
===================================================================
--- trunk/src/gateway/osrf_http_translator.c 2010-01-28 03:10:23 UTC (rev 1905)
+++ trunk/src/gateway/osrf_http_translator.c 2010-01-28 03:14:32 UTC (rev 1906)
@@ -127,7 +127,6 @@
trans->handle = osrfSystemGetTransportClient();
trans->recipient = apr_table_get(apreq->headers_in, OSRF_HTTP_HEADER_TO);
trans->service = apr_table_get(apreq->headers_in, OSRF_HTTP_HEADER_SERVICE);
- trans->thread = apr_table_get(apreq->headers_in, OSRF_HTTP_HEADER_THREAD); /* XXX create thread if necessary */
const char* timeout = apr_table_get(apreq->headers_in, OSRF_HTTP_HEADER_TIMEOUT);
if(timeout)
@@ -145,6 +144,11 @@
snprintf(buf, sizeof(buf), "%d%ld", getpid(), time(NULL));
trans->delim = md5sum(buf);
+ /* Use thread if it has been passed in; otherwise, just use the delimiter */
+ trans->thread = apr_table_get(apreq->headers_in, OSRF_HTTP_HEADER_THREAD)
+ ? apr_table_get(apreq->headers_in, OSRF_HTTP_HEADER_THREAD)
+ : (const char*)trans->delim;
+
return trans;
}
More information about the opensrf-commits
mailing list