1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6 #include "chain.h"
7 #include "chainparams.h"
8 #include "primitives/block.h"
9 #include "primitives/transaction.h"
10 #include "main.h"
11 #include "httpserver.h"
12 #include "rpc/server.h"
13 #include "streams.h"
14 #include "sync.h"
15 #include "txmempool.h"
16 #include "utilstrencodings.h"
17 #include "version.h"
18
19 #include <boost/algorithm/string.hpp>
20 #include <boost/dynamic_bitset.hpp>
21
22 #include <univalue.h>
23
24 using namespace std;
25
26 static const size_t MAX_GETUTXOS_OUTPOINTS = 15; //allow a max of 15 outpoints to be queried at once
27
28 enum RetFormat {
29 RF_UNDEF,
30 RF_BINARY,
31 RF_HEX,
32 RF_JSON,
33 };
34
35 static const struct {
36 enum RetFormat rf;
37 const char* name;
38 } rf_names[] = {
39 {RF_UNDEF, ""},
40 {RF_BINARY, "bin"},
41 {RF_HEX, "hex"},
42 {RF_JSON, "json"},
43 };
44
45 struct CCoin {
46 uint32_t nTxVer; // Don't call this nVersion, that name has a special meaning inside IMPLEMENT_SERIALIZE
47 uint32_t nHeight;
48 CTxOut out;
49
50 ADD_SERIALIZE_METHODS;
51
52 template <typename Stream, typename Operation>
SerializationOpCCoin53 inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
54 {
55 READWRITE(nTxVer);
56 READWRITE(nHeight);
57 READWRITE(out);
58 }
59 };
60
61 extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
62 extern UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false);
63 extern UniValue mempoolInfoToJSON();
64 extern UniValue mempoolToJSON(bool fVerbose = false);
65 extern void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
66 extern UniValue blockheaderToJSON(const CBlockIndex* blockindex);
67
RESTERR(HTTPRequest * req,enum HTTPStatusCode status,string message)68 static bool RESTERR(HTTPRequest* req, enum HTTPStatusCode status, string message)
69 {
70 req->WriteHeader("Content-Type", "text/plain");
71 req->WriteReply(status, message + "\r\n");
72 return false;
73 }
74
ParseDataFormat(std::string & param,const std::string & strReq)75 static enum RetFormat ParseDataFormat(std::string& param, const std::string& strReq)
76 {
77 const std::string::size_type pos = strReq.rfind('.');
78 if (pos == std::string::npos)
79 {
80 param = strReq;
81 return rf_names[0].rf;
82 }
83
84 param = strReq.substr(0, pos);
85 const std::string suff(strReq, pos + 1);
86
87 for (unsigned int i = 0; i < ARRAYLEN(rf_names); i++)
88 if (suff == rf_names[i].name)
89 return rf_names[i].rf;
90
91 /* If no suffix is found, return original string. */
92 param = strReq;
93 return rf_names[0].rf;
94 }
95
AvailableDataFormatsString()96 static string AvailableDataFormatsString()
97 {
98 string formats = "";
99 for (unsigned int i = 0; i < ARRAYLEN(rf_names); i++)
100 if (strlen(rf_names[i].name) > 0) {
101 formats.append(".");
102 formats.append(rf_names[i].name);
103 formats.append(", ");
104 }
105
106 if (formats.length() > 0)
107 return formats.substr(0, formats.length() - 2);
108
109 return formats;
110 }
111
ParseHashStr(const string & strReq,uint256 & v)112 static bool ParseHashStr(const string& strReq, uint256& v)
113 {
114 if (!IsHex(strReq) || (strReq.size() != 64))
115 return false;
116
117 v.SetHex(strReq);
118 return true;
119 }
120
CheckWarmup(HTTPRequest * req)121 static bool CheckWarmup(HTTPRequest* req)
122 {
123 std::string statusmessage;
124 if (RPCIsInWarmup(&statusmessage))
125 return RESTERR(req, HTTP_SERVICE_UNAVAILABLE, "Service temporarily unavailable: " + statusmessage);
126 return true;
127 }
128
rest_headers(HTTPRequest * req,const std::string & strURIPart)129 static bool rest_headers(HTTPRequest* req,
130 const std::string& strURIPart)
131 {
132 if (!CheckWarmup(req))
133 return false;
134 std::string param;
135 const RetFormat rf = ParseDataFormat(param, strURIPart);
136 vector<string> path;
137 boost::split(path, param, boost::is_any_of("/"));
138
139 if (path.size() != 2)
140 return RESTERR(req, HTTP_BAD_REQUEST, "No header count specified. Use /rest/headers/<count>/<hash>.<ext>.");
141
142 long count = strtol(path[0].c_str(), NULL, 10);
143 if (count < 1 || count > 2000)
144 return RESTERR(req, HTTP_BAD_REQUEST, "Header count out of range: " + path[0]);
145
146 string hashStr = path[1];
147 uint256 hash;
148 if (!ParseHashStr(hashStr, hash))
149 return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr);
150
151 std::vector<const CBlockIndex *> headers;
152 headers.reserve(count);
153 {
154 LOCK(cs_main);
155 BlockMap::const_iterator it = mapBlockIndex.find(hash);
156 const CBlockIndex *pindex = (it != mapBlockIndex.end()) ? it->second : NULL;
157 while (pindex != NULL && chainActive.Contains(pindex)) {
158 headers.push_back(pindex);
159 if (headers.size() == (unsigned long)count)
160 break;
161 pindex = chainActive.Next(pindex);
162 }
163 }
164
165 CDataStream ssHeader(SER_NETWORK, PROTOCOL_VERSION);
166 BOOST_FOREACH(const CBlockIndex *pindex, headers) {
167 ssHeader << pindex->GetBlockHeader();
168 }
169
170 switch (rf) {
171 case RF_BINARY: {
172 string binaryHeader = ssHeader.str();
173 req->WriteHeader("Content-Type", "application/octet-stream");
174 req->WriteReply(HTTP_OK, binaryHeader);
175 return true;
176 }
177
178 case RF_HEX: {
179 string strHex = HexStr(ssHeader.begin(), ssHeader.end()) + "\n";
180 req->WriteHeader("Content-Type", "text/plain");
181 req->WriteReply(HTTP_OK, strHex);
182 return true;
183 }
184 case RF_JSON: {
185 UniValue jsonHeaders(UniValue::VARR);
186 BOOST_FOREACH(const CBlockIndex *pindex, headers) {
187 jsonHeaders.push_back(blockheaderToJSON(pindex));
188 }
189 string strJSON = jsonHeaders.write() + "\n";
190 req->WriteHeader("Content-Type", "application/json");
191 req->WriteReply(HTTP_OK, strJSON);
192 return true;
193 }
194 default: {
195 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: .bin, .hex)");
196 }
197 }
198
199 // not reached
200 return true; // continue to process further HTTP reqs on this cxn
201 }
202
rest_block(HTTPRequest * req,const std::string & strURIPart,bool showTxDetails)203 static bool rest_block(HTTPRequest* req,
204 const std::string& strURIPart,
205 bool showTxDetails)
206 {
207 if (!CheckWarmup(req))
208 return false;
209 std::string hashStr;
210 const RetFormat rf = ParseDataFormat(hashStr, strURIPart);
211
212 uint256 hash;
213 if (!ParseHashStr(hashStr, hash))
214 return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr);
215
216 CBlock block;
217 CBlockIndex* pblockindex = NULL;
218 {
219 LOCK(cs_main);
220 if (mapBlockIndex.count(hash) == 0)
221 return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
222
223 pblockindex = mapBlockIndex[hash];
224 if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0)
225 return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not available (pruned data)");
226
227 if (!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus()))
228 return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
229 }
230
231 CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
232 ssBlock << block;
233
234 switch (rf) {
235 case RF_BINARY: {
236 string binaryBlock = ssBlock.str();
237 req->WriteHeader("Content-Type", "application/octet-stream");
238 req->WriteReply(HTTP_OK, binaryBlock);
239 return true;
240 }
241
242 case RF_HEX: {
243 string strHex = HexStr(ssBlock.begin(), ssBlock.end()) + "\n";
244 req->WriteHeader("Content-Type", "text/plain");
245 req->WriteReply(HTTP_OK, strHex);
246 return true;
247 }
248
249 case RF_JSON: {
250 UniValue objBlock = blockToJSON(block, pblockindex, showTxDetails);
251 string strJSON = objBlock.write() + "\n";
252 req->WriteHeader("Content-Type", "application/json");
253 req->WriteReply(HTTP_OK, strJSON);
254 return true;
255 }
256
257 default: {
258 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: " + AvailableDataFormatsString() + ")");
259 }
260 }
261
262 // not reached
263 return true; // continue to process further HTTP reqs on this cxn
264 }
265
rest_block_extended(HTTPRequest * req,const std::string & strURIPart)266 static bool rest_block_extended(HTTPRequest* req, const std::string& strURIPart)
267 {
268 return rest_block(req, strURIPart, true);
269 }
270
rest_block_notxdetails(HTTPRequest * req,const std::string & strURIPart)271 static bool rest_block_notxdetails(HTTPRequest* req, const std::string& strURIPart)
272 {
273 return rest_block(req, strURIPart, false);
274 }
275
276 // A bit of a hack - dependency on a function defined in rpc/blockchain.cpp
277 UniValue getblockchaininfo(const UniValue& params, bool fHelp);
278
rest_chaininfo(HTTPRequest * req,const std::string & strURIPart)279 static bool rest_chaininfo(HTTPRequest* req, const std::string& strURIPart)
280 {
281 if (!CheckWarmup(req))
282 return false;
283 std::string param;
284 const RetFormat rf = ParseDataFormat(param, strURIPart);
285
286 switch (rf) {
287 case RF_JSON: {
288 UniValue rpcParams(UniValue::VARR);
289 UniValue chainInfoObject = getblockchaininfo(rpcParams, false);
290 string strJSON = chainInfoObject.write() + "\n";
291 req->WriteHeader("Content-Type", "application/json");
292 req->WriteReply(HTTP_OK, strJSON);
293 return true;
294 }
295 default: {
296 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)");
297 }
298 }
299
300 // not reached
301 return true; // continue to process further HTTP reqs on this cxn
302 }
303
rest_mempool_info(HTTPRequest * req,const std::string & strURIPart)304 static bool rest_mempool_info(HTTPRequest* req, const std::string& strURIPart)
305 {
306 if (!CheckWarmup(req))
307 return false;
308 std::string param;
309 const RetFormat rf = ParseDataFormat(param, strURIPart);
310
311 switch (rf) {
312 case RF_JSON: {
313 UniValue mempoolInfoObject = mempoolInfoToJSON();
314
315 string strJSON = mempoolInfoObject.write() + "\n";
316 req->WriteHeader("Content-Type", "application/json");
317 req->WriteReply(HTTP_OK, strJSON);
318 return true;
319 }
320 default: {
321 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)");
322 }
323 }
324
325 // not reached
326 return true; // continue to process further HTTP reqs on this cxn
327 }
328
rest_mempool_contents(HTTPRequest * req,const std::string & strURIPart)329 static bool rest_mempool_contents(HTTPRequest* req, const std::string& strURIPart)
330 {
331 if (!CheckWarmup(req))
332 return false;
333 std::string param;
334 const RetFormat rf = ParseDataFormat(param, strURIPart);
335
336 switch (rf) {
337 case RF_JSON: {
338 UniValue mempoolObject = mempoolToJSON(true);
339
340 string strJSON = mempoolObject.write() + "\n";
341 req->WriteHeader("Content-Type", "application/json");
342 req->WriteReply(HTTP_OK, strJSON);
343 return true;
344 }
345 default: {
346 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)");
347 }
348 }
349
350 // not reached
351 return true; // continue to process further HTTP reqs on this cxn
352 }
353
rest_tx(HTTPRequest * req,const std::string & strURIPart)354 static bool rest_tx(HTTPRequest* req, const std::string& strURIPart)
355 {
356 if (!CheckWarmup(req))
357 return false;
358 std::string hashStr;
359 const RetFormat rf = ParseDataFormat(hashStr, strURIPart);
360
361 uint256 hash;
362 if (!ParseHashStr(hashStr, hash))
363 return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr);
364
365 CTransaction tx;
366 uint256 hashBlock = uint256();
367 if (!GetTransaction(hash, tx, Params().GetConsensus(), hashBlock, true))
368 return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
369
370 CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
371 ssTx << tx;
372
373 switch (rf) {
374 case RF_BINARY: {
375 string binaryTx = ssTx.str();
376 req->WriteHeader("Content-Type", "application/octet-stream");
377 req->WriteReply(HTTP_OK, binaryTx);
378 return true;
379 }
380
381 case RF_HEX: {
382 string strHex = HexStr(ssTx.begin(), ssTx.end()) + "\n";
383 req->WriteHeader("Content-Type", "text/plain");
384 req->WriteReply(HTTP_OK, strHex);
385 return true;
386 }
387
388 case RF_JSON: {
389 UniValue objTx(UniValue::VOBJ);
390 TxToJSON(tx, hashBlock, objTx);
391 string strJSON = objTx.write() + "\n";
392 req->WriteHeader("Content-Type", "application/json");
393 req->WriteReply(HTTP_OK, strJSON);
394 return true;
395 }
396
397 default: {
398 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: " + AvailableDataFormatsString() + ")");
399 }
400 }
401
402 // not reached
403 return true; // continue to process further HTTP reqs on this cxn
404 }
405
rest_getutxos(HTTPRequest * req,const std::string & strURIPart)406 static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
407 {
408 if (!CheckWarmup(req))
409 return false;
410 std::string param;
411 const RetFormat rf = ParseDataFormat(param, strURIPart);
412
413 vector<string> uriParts;
414 if (param.length() > 1)
415 {
416 std::string strUriParams = param.substr(1);
417 boost::split(uriParts, strUriParams, boost::is_any_of("/"));
418 }
419
420 // throw exception in case of a empty request
421 std::string strRequestMutable = req->ReadBody();
422 if (strRequestMutable.length() == 0 && uriParts.size() == 0)
423 return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, "Error: empty request");
424
425 bool fInputParsed = false;
426 bool fCheckMemPool = false;
427 vector<COutPoint> vOutPoints;
428
429 // parse/deserialize input
430 // input-format = output-format, rest/getutxos/bin requires binary input, gives binary output, ...
431
432 if (uriParts.size() > 0)
433 {
434
435 //inputs is sent over URI scheme (/rest/getutxos/checkmempool/txid1-n/txid2-n/...)
436 if (uriParts.size() > 0 && uriParts[0] == "checkmempool")
437 fCheckMemPool = true;
438
439 for (size_t i = (fCheckMemPool) ? 1 : 0; i < uriParts.size(); i++)
440 {
441 uint256 txid;
442 int32_t nOutput;
443 std::string strTxid = uriParts[i].substr(0, uriParts[i].find("-"));
444 std::string strOutput = uriParts[i].substr(uriParts[i].find("-")+1);
445
446 if (!ParseInt32(strOutput, &nOutput) || !IsHex(strTxid))
447 return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, "Parse error");
448
449 txid.SetHex(strTxid);
450 vOutPoints.push_back(COutPoint(txid, (uint32_t)nOutput));
451 }
452
453 if (vOutPoints.size() > 0)
454 fInputParsed = true;
455 else
456 return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, "Error: empty request");
457 }
458
459 switch (rf) {
460 case RF_HEX: {
461 // convert hex to bin, continue then with bin part
462 std::vector<unsigned char> strRequestV = ParseHex(strRequestMutable);
463 strRequestMutable.assign(strRequestV.begin(), strRequestV.end());
464 }
465
466 case RF_BINARY: {
467 try {
468 //deserialize only if user sent a request
469 if (strRequestMutable.size() > 0)
470 {
471 if (fInputParsed) //don't allow sending input over URI and HTTP RAW DATA
472 return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, "Combination of URI scheme inputs and raw post data is not allowed");
473
474 CDataStream oss(SER_NETWORK, PROTOCOL_VERSION);
475 oss << strRequestMutable;
476 oss >> fCheckMemPool;
477 oss >> vOutPoints;
478 }
479 } catch (const std::ios_base::failure& e) {
480 // abort in case of unreadable binary data
481 return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, "Parse error");
482 }
483 break;
484 }
485
486 case RF_JSON: {
487 if (!fInputParsed)
488 return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, "Error: empty request");
489 break;
490 }
491 default: {
492 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: " + AvailableDataFormatsString() + ")");
493 }
494 }
495
496 // limit max outpoints
497 if (vOutPoints.size() > MAX_GETUTXOS_OUTPOINTS)
498 return RESTERR(req, HTTP_INTERNAL_SERVER_ERROR, strprintf("Error: max outpoints exceeded (max: %d, tried: %d)", MAX_GETUTXOS_OUTPOINTS, vOutPoints.size()));
499
500 // check spentness and form a bitmap (as well as a JSON capable human-readable string representation)
501 vector<unsigned char> bitmap;
502 vector<CCoin> outs;
503 std::string bitmapStringRepresentation;
504 boost::dynamic_bitset<unsigned char> hits(vOutPoints.size());
505 {
506 LOCK2(cs_main, mempool.cs);
507
508 CCoinsView viewDummy;
509 CCoinsViewCache view(&viewDummy);
510
511 CCoinsViewCache& viewChain = *pcoinsTip;
512 CCoinsViewMemPool viewMempool(&viewChain, mempool);
513
514 if (fCheckMemPool)
515 view.SetBackend(viewMempool); // switch cache backend to db+mempool in case user likes to query mempool
516
517 for (size_t i = 0; i < vOutPoints.size(); i++) {
518 CCoins coins;
519 uint256 hash = vOutPoints[i].hash;
520 if (view.GetCoins(hash, coins)) {
521 mempool.pruneSpent(hash, coins);
522 if (coins.IsAvailable(vOutPoints[i].n)) {
523 hits[i] = true;
524 // Safe to index into vout here because IsAvailable checked if it's off the end of the array, or if
525 // n is valid but points to an already spent output (IsNull).
526 CCoin coin;
527 coin.nTxVer = coins.nVersion;
528 coin.nHeight = coins.nHeight;
529 coin.out = coins.vout.at(vOutPoints[i].n);
530 assert(!coin.out.IsNull());
531 outs.push_back(coin);
532 }
533 }
534
535 bitmapStringRepresentation.append(hits[i] ? "1" : "0"); // form a binary string representation (human-readable for json output)
536 }
537 }
538 boost::to_block_range(hits, std::back_inserter(bitmap));
539
540 switch (rf) {
541 case RF_BINARY: {
542 // serialize data
543 // use exact same output as mentioned in Bip64
544 CDataStream ssGetUTXOResponse(SER_NETWORK, PROTOCOL_VERSION);
545 ssGetUTXOResponse << chainActive.Height() << chainActive.Tip()->GetBlockHash() << bitmap << outs;
546 string ssGetUTXOResponseString = ssGetUTXOResponse.str();
547
548 req->WriteHeader("Content-Type", "application/octet-stream");
549 req->WriteReply(HTTP_OK, ssGetUTXOResponseString);
550 return true;
551 }
552
553 case RF_HEX: {
554 CDataStream ssGetUTXOResponse(SER_NETWORK, PROTOCOL_VERSION);
555 ssGetUTXOResponse << chainActive.Height() << chainActive.Tip()->GetBlockHash() << bitmap << outs;
556 string strHex = HexStr(ssGetUTXOResponse.begin(), ssGetUTXOResponse.end()) + "\n";
557
558 req->WriteHeader("Content-Type", "text/plain");
559 req->WriteReply(HTTP_OK, strHex);
560 return true;
561 }
562
563 case RF_JSON: {
564 UniValue objGetUTXOResponse(UniValue::VOBJ);
565
566 // pack in some essentials
567 // use more or less the same output as mentioned in Bip64
568 objGetUTXOResponse.push_back(Pair("chainHeight", chainActive.Height()));
569 objGetUTXOResponse.push_back(Pair("chaintipHash", chainActive.Tip()->GetBlockHash().GetHex()));
570 objGetUTXOResponse.push_back(Pair("bitmap", bitmapStringRepresentation));
571
572 UniValue utxos(UniValue::VARR);
573 BOOST_FOREACH (const CCoin& coin, outs) {
574 UniValue utxo(UniValue::VOBJ);
575 utxo.push_back(Pair("txvers", (int32_t)coin.nTxVer));
576 utxo.push_back(Pair("height", (int32_t)coin.nHeight));
577 utxo.push_back(Pair("value", ValueFromAmount(coin.out.nValue)));
578
579 // include the script in a json output
580 UniValue o(UniValue::VOBJ);
581 ScriptPubKeyToJSON(coin.out.scriptPubKey, o, true);
582 utxo.push_back(Pair("scriptPubKey", o));
583 utxos.push_back(utxo);
584 }
585 objGetUTXOResponse.push_back(Pair("utxos", utxos));
586
587 // return json string
588 string strJSON = objGetUTXOResponse.write() + "\n";
589 req->WriteHeader("Content-Type", "application/json");
590 req->WriteReply(HTTP_OK, strJSON);
591 return true;
592 }
593 default: {
594 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: " + AvailableDataFormatsString() + ")");
595 }
596 }
597
598 // not reached
599 return true; // continue to process further HTTP reqs on this cxn
600 }
601
602 static const struct {
603 const char* prefix;
604 bool (*handler)(HTTPRequest* req, const std::string& strReq);
605 } uri_prefixes[] = {
606 {"/rest/tx/", rest_tx},
607 {"/rest/block/notxdetails/", rest_block_notxdetails},
608 {"/rest/block/", rest_block_extended},
609 {"/rest/chaininfo", rest_chaininfo},
610 {"/rest/mempool/info", rest_mempool_info},
611 {"/rest/mempool/contents", rest_mempool_contents},
612 {"/rest/headers/", rest_headers},
613 {"/rest/getutxos", rest_getutxos},
614 };
615
StartREST()616 bool StartREST()
617 {
618 for (unsigned int i = 0; i < ARRAYLEN(uri_prefixes); i++)
619 RegisterHTTPHandler(uri_prefixes[i].prefix, false, uri_prefixes[i].handler);
620 return true;
621 }
622
InterruptREST()623 void InterruptREST()
624 {
625 }
626
StopREST()627 void StopREST()
628 {
629 for (unsigned int i = 0; i < ARRAYLEN(uri_prefixes); i++)
630 UnregisterHTTPHandler(uri_prefixes[i].prefix, false);
631 }
632