| 734 | | // Read calendar from file |
| 735 | | cdstring data = dout.GetData(); |
| 736 | | std::istrstream is(data.c_str()); |
| 737 | | cal.Parse(is); |
| 738 | | |
| 739 | | // Update ETag |
| 740 | | if (request->GetNewETag() != NULL) |
| 741 | | { |
| 742 | | cdstring temp(*request->GetNewETag()); |
| 743 | | |
| 744 | | // Handle server bug: ETag value MUST be quoted per HTTP/1.1 €3.11 |
| 745 | | if (!temp.isquoted()) |
| 746 | | temp.quote(true); |
| 747 | | |
| 748 | | cal.SetETag(temp); |
| 749 | | } |
| 750 | | else |
| 751 | | cal.SetETag(cdstring::null_str); |
| 752 | | |
| 753 | | // Check read-only status |
| 754 | | auto_ptr<http::webdav::CWebDAVOptions> optrequest(new http::webdav::CWebDAVOptions(this, rurl)); |
| 755 | | |
| 756 | | // Process it |
| 757 | | RunSession(optrequest.get()); |
| 758 | | |
| 759 | | |
| 760 | | // Check response status |
| 761 | | switch(optrequest->GetStatusCode()) |
| 762 | | { |
| 763 | | case http::eStatus_OK: |
| 764 | | case http::eStatus_NoContent: |
| 765 | | // Do default action |
| 766 | | break; |
| 767 | | case eStatus_NotImplemented: |
| 768 | | // Ignore failure |
| 769 | | return; |
| 770 | | default: |
| 771 | | // Handle error and exit here |
| 772 | | HandleHTTPError(optrequest.get()); |
| 773 | | return; |
| 774 | | } |
| 775 | | |
| 776 | | // Look for PUT |
| 777 | | cal.SetReadOnly(!optrequest->IsAllowed(http::cRequestPUT)); |
| | 746 | if (changed) |
| | 747 | { |
| | 748 | // Read calendar from file |
| | 749 | cdstring data = dout.GetData(); |
| | 750 | std::istrstream is(data.c_str()); |
| | 751 | cal.Parse(is); |
| | 752 | |
| | 753 | // Update ETag |
| | 754 | if (request->GetNewETag() != NULL) |
| | 755 | { |
| | 756 | cdstring temp(*request->GetNewETag()); |
| | 757 | |
| | 758 | // Handle server bug: ETag value MUST be quoted per HTTP/1.1 €3.11 |
| | 759 | if (!temp.isquoted()) |
| | 760 | temp.quote(true); |
| | 761 | |
| | 762 | cal.SetETag(temp); |
| | 763 | } |
| | 764 | else |
| | 765 | cal.SetETag(cdstring::null_str); |
| | 766 | |
| | 767 | // Check read-only status |
| | 768 | auto_ptr<http::webdav::CWebDAVOptions> optrequest(new http::webdav::CWebDAVOptions(this, rurl)); |
| | 769 | |
| | 770 | // Process it |
| | 771 | RunSession(optrequest.get()); |
| | 772 | |
| | 773 | |
| | 774 | // Check response status |
| | 775 | switch(optrequest->GetStatusCode()) |
| | 776 | { |
| | 777 | case http::eStatus_OK: |
| | 778 | case http::eStatus_NoContent: |
| | 779 | // Do default action |
| | 780 | break; |
| | 781 | case eStatus_NotImplemented: |
| | 782 | // Ignore failure |
| | 783 | return; |
| | 784 | default: |
| | 785 | // Handle error and exit here |
| | 786 | HandleHTTPError(optrequest.get()); |
| | 787 | return; |
| | 788 | } |
| | 789 | |
| | 790 | // Look for PUT |
| | 791 | cal.SetReadOnly(!optrequest->IsAllowed(http::cRequestPUT)); |
| | 792 | } |