Mercurial > hg > orthanc
changeset 3700:5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 26 Feb 2020 13:21:41 +0100 |
parents | efa815dd2c20 |
children | 736907ecb626 643b5ee86f92 |
files | Core/DicomNetworking/DicomUserConnection.cpp NEWS OrthancServer/OrthancMoveRequestHandler.cpp |
diffstat | 3 files changed, 57 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomUserConnection.cpp Wed Feb 26 12:19:34 2020 +0100 +++ b/Core/DicomNetworking/DicomUserConnection.cpp Wed Feb 26 13:21:41 2020 +0100 @@ -422,18 +422,36 @@ } // Finally conduct transmission of data - T_DIMSE_C_StoreRSP rsp; + T_DIMSE_C_StoreRSP response; DcmDataset* statusDetail = NULL; Check(DIMSE_storeUser(assoc_, presID, &request, NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL, /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_, - &rsp, &statusDetail, NULL), + &response, &statusDetail, NULL), connection.remoteAet_, "C-STORE"); if (statusDetail != NULL) { delete statusDetail; } + + + /** + * New in Orthanc 1.6.0: Deal with failures during C-STORE. + * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.2.3.html#table_B.2-1 + **/ + + if (response.DimseStatus != 0x0000 && // Success + response.DimseStatus != 0xB000 && // Warning - Coercion of Data Elements + response.DimseStatus != 0xB007 && // Warning - Data Set does not match SOP Class + response.DimseStatus != 0xB006) // Warning - Elements Discarded + { + char buf[16]; + sprintf(buf, "%04X", response.DimseStatus); + throw OrthancException(ErrorCode_NetworkProtocol, + "C-STORE SCU to AET \"" + connection.remoteAet_ + + "\" has failed with DIMSE status 0x" + buf); + } } @@ -652,6 +670,24 @@ } Check(cond, remoteAet, "C-FIND"); + + + /** + * New in Orthanc 1.6.0: Deal with failures during C-FIND. + * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#table_C.4-1 + **/ + + if (response.DimseStatus != 0x0000 && // Success + response.DimseStatus != 0xFF00 && // Pending - Matches are continuing + response.DimseStatus != 0xFF01) // Pending - Matches are continuing + { + char buf[16]; + sprintf(buf, "%04X", response.DimseStatus); + throw OrthancException(ErrorCode_NetworkProtocol, + "C-FIND SCU to AET \"" + remoteAet + + "\" has failed with DIMSE status 0x" + buf); + } + } @@ -838,6 +874,22 @@ } Check(cond, remoteAet_, "C-MOVE"); + + + /** + * New in Orthanc 1.6.0: Deal with failures during C-MOVE. + * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.2.html#table_C.4-2 + **/ + + if (response.DimseStatus != 0x0000 && // Success + response.DimseStatus != 0xFF00) // Pending - Sub-operations are continuing + { + char buf[16]; + sprintf(buf, "%04X", response.DimseStatus); + throw OrthancException(ErrorCode_NetworkProtocol, + "C-MOVE SCU to AET \"" + remoteAet_ + + "\" has failed with DIMSE status 0x" + buf); + } }
--- a/NEWS Wed Feb 26 12:19:34 2020 +0100 +++ b/NEWS Wed Feb 26 13:21:41 2020 +0100 @@ -38,6 +38,7 @@ * More strict C-FIND SCP wrt. the DICOM standard: Forbid wildcard matching on some VRs, ignore main tags below the queried level * Fix issue #65 (Logging improvements) +* Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors) * Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) * Fix issue #154 (Matching against list of UID-s by C-MOVE) * Fix issue #156 (Chunked Dicom-web transfer uses 100% CPU)
--- a/OrthancServer/OrthancMoveRequestHandler.cpp Wed Feb 26 12:19:34 2020 +0100 +++ b/OrthancServer/OrthancMoveRequestHandler.cpp Wed Feb 26 13:21:41 2020 +0100 @@ -142,7 +142,8 @@ position_(0) { job_->SetDescription("C-MOVE"); - job_->SetPermissive(true); + //job_->SetPermissive(true); // This was the behavior of Orthanc < 1.6.0 + job_->SetPermissive(false); job_->SetLocalAet(context.GetDefaultLocalApplicationEntityTitle()); {