comparison OrthancServer/Sources/LuaScripting.cpp @ 4606:d01702fb29a9 db-changes

integration mainline->db-changes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 16:34:23 +0200
parents 456ed3fcff81 c8f444e8556d
children 569d9ef165b1
comparison
equal deleted inserted replaced
4604:2c702cfae274 4606:d01702fb29a9
450 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */); 450 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */);
451 451
452 try 452 try
453 { 453 {
454 std::string result; 454 std::string result;
455 if (IHttpHandler::SimpleGet(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 455 if (IHttpHandler::SimpleGet(result, NULL, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
456 RequestOrigin_Lua, uri, headers)) 456 RequestOrigin_Lua, uri, headers) == HttpStatus_200_Ok)
457 { 457 {
458 lua_pushlstring(state, result.c_str(), result.size()); 458 lua_pushlstring(state, result.c_str(), result.size());
459 return 1; 459 return 1;
460 } 460 }
461 } 461 }
503 503
504 try 504 try
505 { 505 {
506 std::string result; 506 std::string result;
507 if (isPost ? 507 if (isPost ?
508 IHttpHandler::SimplePost(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 508 IHttpHandler::SimplePost(result, NULL,
509 RequestOrigin_Lua, uri, bodyData, bodySize, headers) : 509 serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
510 IHttpHandler::SimplePut(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 510 RequestOrigin_Lua, uri, bodyData, bodySize, headers) == HttpStatus_200_Ok :
511 RequestOrigin_Lua, uri, bodyData, bodySize, headers)) 511 IHttpHandler::SimplePut(result, NULL,
512 serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
513 RequestOrigin_Lua, uri, bodyData, bodySize, headers) == HttpStatus_200_Ok)
512 { 514 {
513 lua_pushlstring(state, result.c_str(), result.size()); 515 lua_pushlstring(state, result.c_str(), result.size());
514 return 1; 516 return 1;
515 } 517 }
516 } 518 }
567 std::map<std::string, std::string> headers; 569 std::map<std::string, std::string> headers;
568 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */); 570 LuaContext::GetDictionaryArgument(headers, state, 3, true /* HTTP header key to lower case */);
569 571
570 try 572 try
571 { 573 {
572 if (IHttpHandler::SimpleDelete(serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), 574 if (IHttpHandler::SimpleDelete(NULL, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin),
573 RequestOrigin_Lua, uri, headers)) 575 RequestOrigin_Lua, uri, headers) == HttpStatus_200_Ok)
574 { 576 {
575 lua_pushboolean(state, 1); 577 lua_pushboolean(state, 1);
576 return 1; 578 return 1;
577 } 579 }
578 } 580 }