trunk: sync from 1.4.3

make & cmake fixes
This commit is contained in:
Marian Krivos 2012-02-04 17:03:09 +00:00
parent 0afd04898b
commit 8b70c37260
55 changed files with 2797 additions and 2229 deletions

View File

@ -1,14 +1,32 @@
//
// ApacheApplication.h
//
// $Id: //poco/Main/ApacheConnector/include/ApacheApplication.h#2 $
// $Id: //poco/1.4/ApacheConnector/include/ApacheApplication.h#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheChannel.h
//
// $Id: //poco/Main/ApacheConnector/include/ApacheChannel.h#1 $
// $Id: //poco/1.4/ApacheConnector/include/ApacheChannel.h#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheConnector.h
//
// $Id: //poco/Main/ApacheConnector/include/ApacheConnector.h#3 $
// $Id: //poco/1.4/ApacheConnector/include/ApacheConnector.h#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
@ -47,7 +65,7 @@ public:
void setContentType(const std::string& mediaType);
/// Sets the response content type.
void redirect(const std::string& uri);
void redirect(const std::string& uri, int status);
/// Redirects the response to the given uri.
void sendErrorResponse(int status);

View File

@ -1,14 +1,32 @@
//
// ApacheRequestHandlerFactory.h
//
// $Id: //poco/Main/ApacheConnector/include/ApacheRequestHandlerFactory.h#5 $
// $Id: //poco/1.4/ApacheConnector/include/ApacheRequestHandlerFactory.h#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheServerRequest.h
//
// $Id: //poco/Main/ApacheConnector/include/ApacheServerRequest.h#6 $
// $Id: //poco/1.4/ApacheConnector/include/ApacheServerRequest.h#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheServerResponse.h
//
// $Id: //poco/Main/ApacheConnector/include/ApacheServerResponse.h#6 $
// $Id: //poco/1.4/ApacheConnector/include/ApacheServerResponse.h#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
@ -87,8 +105,10 @@ public:
/// Must not be called after send(), sendFile()
/// or redirect() has been called.
void redirect(const std::string& uri);
/// Sets the status code to 302 (Found)
void redirect(const std::string& uri, Poco::Net::HTTPResponse::HTTPStatus status);
/// Sets the status code, which must be one of
/// HTTP_MOVED_PERMANENTLY (301), HTTP_FOUND (302),
/// or HTTP_SEE_OTHER (303),
/// and sets the "Location" header field
/// to the given URI, which according to
/// the HTTP specification, must be absolute.

View File

@ -1,14 +1,32 @@
//
// ApacheStream.h
//
// $Id: //poco/Main/ApacheConnector/include/ApacheStream.h#5 $
// $Id: //poco/1.4/ApacheConnector/include/ApacheStream.h#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// FormServer.cpp
//
// $Id: //poco/Main/ApacheConnector/samples/FormServer/src/FormServer.cpp#2 $
// $Id: //poco/1.4/ApacheConnector/samples/FormServer/src/FormServer.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// TimeServer.cpp
//
// $Id: //poco/Main/ApacheConnector/samples/TimeServer/src/TimeServer.cpp#1 $
// $Id: //poco/1.4/ApacheConnector/samples/TimeServer/src/TimeServer.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheApplication.cpp
//
// $Id: //poco/Main/ApacheConnector/src/ApacheApplication.cpp#2 $
// $Id: //poco/1.4/ApacheConnector/src/ApacheApplication.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheApplication.cpp
//
// $Id: //poco/Main/ApacheConnector/src/ApacheChannel.cpp#1 $
// $Id: //poco/1.4/ApacheConnector/src/ApacheChannel.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheConnector.cpp
//
// $Id: //poco/Main/ApacheConnector/src/ApacheConnector.cpp#6 $
// $Id: //poco/1.4/ApacheConnector/src/ApacheConnector.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
@ -18,6 +36,7 @@
#include "ApacheServerResponse.h"
#include "ApacheRequestHandlerFactory.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include <memory>
#include "httpd.h"
#include "http_connection.h"
#include "http_config.h"
@ -35,7 +54,6 @@
#include "http_request.h"
#include "util_filter.h"
#include <memory>
using Poco::Net::HTTPServerRequest;
using Poco::Net::HTTPServerResponse;
@ -70,11 +88,11 @@ void ApacheRequestRec::writeResponse(const char* buffer, int length)
}
void ApacheRequestRec::redirect(const std::string& uri)
void ApacheRequestRec::redirect(const std::string& uri, int status)
{
apr_table_set(_pRec->headers_out, "Location", uri.c_str());
_pRec->connection->keepalive = AP_CONN_CLOSE;
_pRec->status = 302;
_pRec->status = status;
ap_set_keepalive(_pRec);
ap_send_error_response(_pRec, 0);
}
@ -153,7 +171,7 @@ void ApacheRequestRec::copyHeaders(ApacheServerRequest& request)
void ApacheConnector::log(const char* file, int line, int level, int status, const char *text)
{
ap_log_error(file, line, level, 0, NULL, text);
ap_log_error(file, line, level, 0, NULL, "%s", text);
}

View File

@ -1,14 +1,32 @@
//
// ApacheRequestHandlerFactory.cpp
//
// $Id: //poco/Main/ApacheConnector/src/ApacheRequestHandlerFactory.cpp#8 $
// $Id: //poco/1.4/ApacheConnector/src/ApacheRequestHandlerFactory.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheServerRequest.cpp
//
// $Id: //poco/Main/ApacheConnector/src/ApacheServerRequest.cpp#9 $
// $Id: //poco/1.4/ApacheConnector/src/ApacheServerRequest.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -1,14 +1,32 @@
//
// ApacheServerResponse.cpp
//
// $Id: //poco/Main/ApacheConnector/src/ApacheServerResponse.cpp#8 $
// $Id: //poco/1.4/ApacheConnector/src/ApacheServerResponse.cpp#3 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
@ -102,7 +120,7 @@ void ApacheServerResponse::sendBuffer(const void* pBuffer, std::size_t length)
}
void ApacheServerResponse::redirect(const std::string& uri)
void ApacheServerResponse::redirect(const std::string& uri, HTTPStatus status)
{
poco_assert (!_pStream);
@ -110,7 +128,7 @@ void ApacheServerResponse::redirect(const std::string& uri)
try
{
_pApacheRequest->redirect(uri);
_pApacheRequest->redirect(uri, status);
}
catch (Poco::Exception&)
{

View File

@ -1,14 +1,32 @@
//
// ApacheStream.h
//
// $Id: //poco/Main/ApacheConnector/src/ApacheStream.cpp#9 $
// $Id: //poco/1.4/ApacheConnector/src/ApacheStream.cpp#2 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

View File

@ -17,7 +17,7 @@ SET(PROJECT_VERSION ${COMPLETE_VERSION})
if(NOT MSVC_IDE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release" FORCE)
endif()
message(STATUS "Setting Poco build type - ${CMAKE_BUILD_TYPE}")

View File

@ -41,7 +41,7 @@
#include <openssl/rand.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#if SSLEAY_VERSION_NUMBER >= 0x0907000L
#if OPENSSL_VERSION_NUMBER >= 0x0907000L
#include <openssl/conf.h>
#endif

View File

@ -16,7 +16,7 @@ objects = Binder Extractor SessionImpl Connector \
MySQLStatementImpl ResultMetadata MySQLException \
SessionHandle StatementExecutor
target = PocoMySQL
target = PocoDataMySQL
target_version = $(LIBVERSION)
target_libs = PocoData PocoFoundation

View File

@ -44,7 +44,7 @@ objects = Binder ConnectionHandle Connector EnvironmentHandle \
Extractor ODBCMetaColumn ODBCException ODBCStatementImpl \
Parameter Preparator SessionImpl TypeInfo Unicode Utility
target = PocoODBC
target = PocoDataODBC
target_version = $(LIBVERSION)
target_libs = PocoData PocoFoundation

View File

@ -17,7 +17,7 @@ objects = Binder Extractor SessionImpl Connector \
SQLiteException SQLiteStatementImpl Utility \
sqlite3
target = PocoSQLite
target = PocoDataSQLite
target_version = $(LIBVERSION)
target_libs = PocoData PocoFoundation

View File

@ -60,6 +60,10 @@
// #define POCO_NO_SHAREDMEMORY
// Define if no <locale> header is available (such as on WinCE)
// #define POCO_NO_LOCALE
// Define to desired default thread stack size
// Zero means OS default
#ifndef POCO_THREAD_STACK_SIZE

View File

@ -55,6 +55,7 @@ public:
static bool hasImpl(const std::string& name);
static void setImpl(const std::string& name, const std::string& value);
static std::string osNameImpl();
static std::string osDisplayNameImpl();
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();

View File

@ -109,9 +109,12 @@ std::string Foundation_API format(const std::string& fmt, const Any& value);
/// Precision is a nonnegative decimal integer, preceded by a period (.), which specifies the number of characters
/// to be printed, the number of decimal places, or the number of significant digits.
///
/// Throws a BadCastException if an argument does not correspond to the type of its format specification.
/// Throws an InvalidArgumentException if an argument index is out of range.
///
/// Starting with release 1.4.3, an argument that does not match the format
/// specifier no longer results in a BadCastException. The string [ERRFMT] is
/// written to the result string instead.
///
/// If there are more format specifiers than values, the format specifiers without a corresponding value
/// are copied verbatim to output.
///

View File

@ -399,6 +399,23 @@ public:
/// Fills the given vector with the names
/// of all currently defined loggers.
static int parseLevel(const std::string& level);
/// Parses a symbolic log level from a string and
/// returns the resulting numeric level.
///
/// Valid symbolic levels are:
/// - none (turns off logging)
/// - fatal
/// - critical
/// - error
/// - warning
/// - notice
/// - information
/// - debug
/// - trace
///
/// The level is not case sensitive.
static const std::string ROOT; /// The name of the root logger ("").
protected:

View File

@ -154,6 +154,12 @@ public:
/// Waits for the process specified by handle to terminate
/// and returns the exit code of the process.
static void kill(const ProcessHandle& handle);
/// Kills the process specified by handle.
///
/// This is preferable on Windows where process IDs
/// may be reused.
static void kill(PID pid);
/// Kills the process with the given pid.

View File

@ -75,6 +75,7 @@ public:
static PIDImpl idImpl();
static void timesImpl(long& userTime, long& kernelTime);
static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe);
static void killImpl(const ProcessHandleImpl& handle);
static void killImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
};

View File

@ -77,6 +77,7 @@ public:
static PIDImpl idImpl();
static void timesImpl(long& userTime, long& kernelTime);
static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe);
static void killImpl(const ProcessHandleImpl& handle);
static void killImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
};

View File

@ -59,6 +59,7 @@ public:
~ProcessHandleImpl();
UInt32 id() const;
HANDLE process() const;
int wait() const;
private:
@ -79,6 +80,7 @@ public:
static PIDImpl idImpl();
static void timesImpl(long& userTime, long& kernelTime);
static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe);
static void killImpl(const ProcessHandleImpl& handle);
static void killImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
static std::string terminationEventName(PIDImpl pid);

View File

@ -59,6 +59,7 @@ public:
~ProcessHandleImpl();
UInt32 id() const;
HANDLE process() const;
int wait() const;
private:
@ -79,6 +80,7 @@ public:
static PIDImpl idImpl();
static void timesImpl(long& userTime, long& kernelTime);
static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe);
static void killImpl(const ProcessHandleImpl& handle);
static void killImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
static std::string terminationEventName(PIDImpl pid);

View File

@ -59,6 +59,7 @@ public:
~ProcessHandleImpl();
UInt32 id() const;
HANDLE process() const;
int wait() const;
private:
@ -79,6 +80,7 @@ public:
static PIDImpl idImpl();
static void timesImpl(long& userTime, long& kernelTime);
static ProcessHandleImpl* launchImpl(const std::string& command, const ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe);
static void killImpl(const ProcessHandleImpl& handle);
static void killImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
static std::string terminationEventName(PIDImpl pid);

View File

@ -50,15 +50,22 @@ template <class M>
class ScopedLock
/// A class that simplifies thread synchronization
/// with a mutex.
/// The constructor accepts a Mutex and locks it.
/// The constructor accepts a Mutex (and optionally
/// a timeout value in milliseconds) and locks it.
/// The destructor unlocks the mutex.
{
public:
inline ScopedLock(M& mutex): _mutex(mutex)
explicit ScopedLock(M& mutex): _mutex(mutex)
{
_mutex.lock();
}
inline ~ScopedLock()
ScopedLock(M& mutex, long milliseconds): _mutex(mutex)
{
_mutex.lock(milliseconds);
}
~ScopedLock()
{
_mutex.unlock();
}
@ -76,17 +83,23 @@ template <class M>
class ScopedLockWithUnlock
/// A class that simplifies thread synchronization
/// with a mutex.
/// The constructor accepts a Mutex and locks it.
/// The constructor accepts a Mutex (and optionally
/// a timeout value in milliseconds) and locks it.
/// The destructor unlocks the mutex.
/// The unlock() member function allows for manual
/// unlocking of the mutex.
{
public:
ScopedLockWithUnlock(M& mutex): _pMutex(&mutex)
explicit ScopedLockWithUnlock(M& mutex): _pMutex(&mutex)
{
_pMutex->lock();
}
ScopedLockWithUnlock(M& mutex, long milliseconds): _pMutex(&mutex)
{
_pMutex->lock(milliseconds);
}
~ScopedLockWithUnlock()
{
unlock();

View File

@ -360,9 +360,11 @@ typedef uLong FAR uLongf;
# define Z_HAVE_UNISTD_H
#endif
#ifndef _WIN32_WCE
#ifdef STDC
# include <sys/types.h> /* for off_t */
#endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even

View File

@ -38,7 +38,9 @@
#include "Poco/Exception.h"
#include "Poco/Ascii.h"
#include <sstream>
#if !defined(POCO_NO_LOCALE)
#include <locale>
#endif
#include <cstddef>
@ -167,7 +169,11 @@ namespace
void formatOne(std::string& result, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt, std::vector<Any>::const_iterator& itVal)
{
std::ostringstream str;
#if !defined(POCO_NO_LOCALE)
str.imbue(std::locale::classic());
#endif
try
{
parseFlags(str, itFmt, endFmt);
parseWidth(str, itFmt, endFmt);
parsePrec(str, itFmt, endFmt);
@ -231,6 +237,11 @@ namespace
str << type;
}
}
}
catch (Poco::BadCastException&)
{
str << "[ERRFMT]";
}
result.append(str.str());
}
}

View File

@ -39,6 +39,7 @@
#include "Poco/LoggingRegistry.h"
#include "Poco/Exception.h"
#include "Poco/NumberFormatter.h"
#include "Poco/String.h"
namespace Poco {
@ -83,26 +84,7 @@ void Logger::setLevel(int level)
void Logger::setLevel(const std::string& level)
{
if (level == "none")
setLevel(0);
else if (level == "fatal")
setLevel(Message::PRIO_FATAL);
else if (level == "critical")
setLevel(Message::PRIO_CRITICAL);
else if (level == "error")
setLevel(Message::PRIO_ERROR);
else if (level == "warning")
setLevel(Message::PRIO_WARNING);
else if (level == "notice")
setLevel(Message::PRIO_NOTICE);
else if (level == "information")
setLevel(Message::PRIO_INFORMATION);
else if (level == "debug")
setLevel(Message::PRIO_DEBUG);
else if (level == "trace")
setLevel(Message::PRIO_TRACE);
else
throw InvalidArgumentException("Not a valid log level", level);
setLevel(parseLevel(level));
}
@ -449,6 +431,31 @@ Logger& Logger::parent(const std::string& name)
}
int Logger::parseLevel(const std::string& level)
{
if (icompare(level, "none") == 0)
return 0;
else if (icompare(level, "fatal") == 0)
return Message::PRIO_FATAL;
else if (icompare(level, "critical") == 0)
return Message::PRIO_CRITICAL;
else if (icompare(level, "error") == 0)
return Message::PRIO_ERROR;
else if (icompare(level, "warning") == 0)
return Message::PRIO_WARNING;
else if (icompare(level, "notice") == 0)
return Message::PRIO_NOTICE;
else if (icompare(level, "information") == 0)
return Message::PRIO_INFORMATION;
else if (icompare(level, "debug") == 0)
return Message::PRIO_DEBUG;
else if (icompare(level, "trace") == 0)
return Message::PRIO_TRACE;
else
throw InvalidArgumentException("Not a valid log level", level);
}
class AutoLoggerShutdown
{
public:

View File

@ -37,7 +37,9 @@
#include "Poco/NumberFormatter.h"
#include "Poco/MemoryStream.h"
#include <iomanip>
#if !defined(POCO_NO_LOCALE)
#include <locale>
#endif
#include <cstdio>
#include <cctype>
@ -361,9 +363,11 @@ void NumberFormatter::append(std::string& str, float value)
{
char buffer[64];
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
#if !defined(POCO_NO_LOCALE)
ostr.imbue(std::locale::classic());
#endif
ostr << std::setprecision(8) << value;
str.append(buffer, ostr.charsWritten());
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
}
@ -371,9 +375,11 @@ void NumberFormatter::append(std::string& str, double value)
{
char buffer[64];
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
#if !defined(POCO_NO_LOCALE)
ostr.imbue(std::locale::classic());
#endif
ostr << std::setprecision(16) << value;
str.append(buffer, ostr.charsWritten());
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
}
@ -383,9 +389,11 @@ void NumberFormatter::append(std::string& str, double value, int precision)
char buffer[64];
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
#if !defined(POCO_NO_LOCALE)
ostr.imbue(std::locale::classic());
#endif
ostr << std::fixed << std::showpoint << std::setprecision(precision) << value;
str.append(buffer, ostr.charsWritten());
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
}
@ -395,9 +403,11 @@ void NumberFormatter::append(std::string& str, double value, int width, int prec
char buffer[64];
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
#if !defined(POCO_NO_LOCALE)
ostr.imbue(std::locale::classic());
#endif
ostr << std::fixed << std::showpoint << std::setw(width) << std::setprecision(precision) << value;
str.append(buffer, ostr.charsWritten());
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
}

View File

@ -1,7 +1,7 @@
//
// NumberParser.cpp
//
// $Id: //poco/svn/Foundation/src/NumberParser.cpp#2 $
// $Id: //poco/1.4/Foundation/src/NumberParser.cpp#4 $
//
// Library: Foundation
// Package: Core
@ -38,12 +38,16 @@
#include "Poco/Exception.h"
#include "Poco/MemoryStream.h"
#include "Poco/String.h"
#ifdef POCO_LOCALE
#include <locale>
#endif
#include <cstdio>
#include <cctype>
#if defined(_MSC_VER)
#if defined(POCO_LONG_IS_64_BIT)
#define I64_FMT "l"
#elif defined(_MSC_VER)
#define I64_FMT "I64"
#elif defined(__APPLE__)
#define I64_FMT "q"
@ -176,7 +180,9 @@ double NumberParser::parseFloat(const std::string& s)
bool NumberParser::tryParseFloat(const std::string& s, double& value)
{
Poco::MemoryInputStream istr(s.data(), s.size());
#if !defined(POCO_NO_LOCALE)
istr.imbue(std::locale::classic());
#endif
istr >> value;
return istr.eof() && !istr.fail();
}

View File

@ -127,6 +127,12 @@ int Process::wait(const ProcessHandle& handle)
}
void Process::kill(const ProcessHandle& handle)
{
killImpl(*handle._pImpl);
}
void Process::kill(PID pid)
{
killImpl(pid);

View File

@ -169,6 +169,12 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
}
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
{
killImpl(handle.id());
}
void ProcessImpl::killImpl(PIDImpl pid)
{
if (kill(pid, SIGKILL) != 0)

View File

@ -125,6 +125,12 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
}
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
{
killImpl(handle.id());
}
void ProcessImpl::killImpl(PIDImpl pid)
{
if (kill(pid, SIGKILL) != 0)

View File

@ -89,6 +89,12 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
}
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
{
throw Poco::NotImplementedException("Process::kill()");
}
void ProcessImpl::killImpl(PIDImpl pid)
{
throw Poco::NotImplementedException("Process::kill()");

View File

@ -66,6 +66,12 @@ UInt32 ProcessHandleImpl::id() const
}
HANDLE ProcessHandleImpl::process() const
{
return _hProcess;
}
int ProcessHandleImpl::wait() const
{
DWORD rc = WaitForSingleObject(_hProcess, INFINITE);
@ -176,6 +182,17 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
}
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
{
if (TerminateProcess(handle.process(), 0) == 0)
{
CloseHandle(handle.process());
throw SystemException("cannot kill process");
}
CloseHandle(handle.process());
}
void ProcessImpl::killImpl(PIDImpl pid)
{
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);

View File

@ -67,6 +67,12 @@ UInt32 ProcessHandleImpl::id() const
}
HANDLE ProcessHandleImpl::process() const
{
return _hProcess;
}
int ProcessHandleImpl::wait() const
{
DWORD rc = WaitForSingleObject(_hProcess, INFINITE);
@ -180,6 +186,17 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
}
void ProcessImpl::killImpl(const ProcessHandleImpl& handle)
{
if (TerminateProcess(handle.process(), 0) == 0)
{
CloseHandle(handle.process());
throw SystemException("cannot kill process");
}
CloseHandle(handle.process());
}
void ProcessImpl::killImpl(PIDImpl pid)
{
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);

View File

@ -360,9 +360,11 @@ typedef uLong FAR uLongf;
# define Z_HAVE_UNISTD_H
#endif
#ifndef _WIN32_WCE
#ifdef STDC
# include <sys/types.h> /* for off_t */
#endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even

View File

@ -20,7 +20,8 @@ objects = \
HTTPFixedLengthStream HTTPServerRequest HTTPServerRequestImpl MultipartWriter StreamSocketImpl \
HTTPHeaderStream HTTPServerResponse HTTPServerResponseImpl NameValueCollection TCPServer \
HTTPMessage HTTPServerSession NetException TCPServerConnection HTTPBufferAllocator \
HTTPRequest HTTPSession HTTPSessionInstantiator HTTPSessionFactory NetworkInterface TCPServerConnectionFactory \
HTTPCredentials HTTPDigestCredentials HTTPAuthenticationParams TCPServerConnectionFactory \
HTTPRequest HTTPSession HTTPSessionInstantiator HTTPSessionFactory NetworkInterface \
HTTPRequestHandler HTTPStream HTTPIOStream ServerSocket TCPServerDispatcher \
HTTPRequestHandlerFactory HTTPStreamFactory ServerSocketImpl TCPServerParams \
QuotedPrintableEncoder QuotedPrintableDecoder StringPartSource \
@ -29,7 +30,8 @@ objects = \
MailRecipient MailMessage MailStream SMTPClientSession POP3ClientSession \
RawSocket RawSocketImpl ICMPClient ICMPEventArgs ICMPPacket ICMPPacketImpl \
ICMPSocket ICMPSocketImpl ICMPv4PacketImpl \
RemoteSyslogChannel RemoteSyslogListener SMTPChannel
RemoteSyslogChannel RemoteSyslogListener SMTPChannel \
WebSocket WebSocketImpl
target = PocoNet
target_version = $(LIBVERSION)

View File

@ -272,6 +272,14 @@ protected:
/// Sets the proxy credentials (Proxy-Authorization header), if
/// proxy username and password have been set.
StreamSocket proxyConnect();
/// Sends a CONNECT request to the proxy server and returns
/// a StreamSocket for the resulting connection.
void proxyTunnel();
/// Calls proxyConnect() and attaches the resulting StreamSocket
/// to the HTTPClientSession.
private:
std::string _host;
Poco::UInt16 _port;
@ -289,6 +297,8 @@ private:
HTTPClientSession(const HTTPClientSession&);
HTTPClientSession& operator = (const HTTPClientSession&);
friend class WebSocket;
};

View File

@ -102,6 +102,16 @@ public:
~HTTPCredentials();
/// Destroys the HTTPCredentials.
void fromUserInfo(const std::string& userInfo);
/// Parses username:password string and sets username and password of
/// the credentials object.
/// Throws SyntaxException on invalid user information.
void fromURI(const URI& uri);
/// Extracts username and password from the given URI and sets username
/// and password of the credentials object.
/// Does nothing if URI has no user info part.
void setUsername(const std::string& username);
/// Sets the username.
@ -132,6 +142,12 @@ public:
static bool isDigestCredentials(const std::string& header);
/// Returns true if authentication header is for Digest authentication.
static bool hasBasicCredentials(const HTTPRequest& request);
/// Returns true if Authorization with Basic credentials header is present in the request.
static bool hasDigestCredentials(const HTTPRequest& request);
/// Returns true if Authorization with Digest credentials header is present in the request.
static void extractCredentials(const std::string& userInfo, std::string& username, std::string& password);
/// Extracts username and password from user:password information string.

View File

@ -70,6 +70,7 @@ POCO_DECLARE_EXCEPTION(Net_API, SMTPException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, POP3Exception, NetException)
POCO_DECLARE_EXCEPTION(Net_API, ICMPException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, HTMLFormException, NetException)
POCO_DECLARE_EXCEPTION(Net_API, WebSocketException, NetException)
} } // namespace Poco::Net

View File

@ -415,4 +415,30 @@ void HTTPClientSession::proxyAuthenticateImpl(HTTPRequest& request)
}
StreamSocket HTTPClientSession::proxyConnect()
{
HTTPClientSession proxySession(getProxyHost(), getProxyPort());
proxySession.setTimeout(getTimeout());
SocketAddress targetAddress(getHost(), getPort());
HTTPRequest proxyRequest(HTTPRequest::HTTP_CONNECT, targetAddress.toString(), HTTPMessage::HTTP_1_1);
HTTPResponse proxyResponse;
proxyRequest.set("Proxy-Connection", "keep-alive");
proxyRequest.set("Host", getHost());
proxyAuthenticateImpl(proxyRequest);
proxySession.setKeepAlive(true);
proxySession.sendRequest(proxyRequest);
proxySession.receiveResponse(proxyResponse);
if (proxyResponse.getStatus() != HTTPResponse::HTTP_OK)
throw HTTPException("Cannot establish proxy connection", proxyResponse.getReason());
return proxySession.detachSocket();
}
void HTTPClientSession::proxyTunnel()
{
StreamSocket ss = proxyConnect();
attachSocket(ss);
}
} } // namespace Poco::Net

View File

@ -42,6 +42,7 @@
#include "Poco/Net/HTTPResponse.h"
#include "Poco/Net/NetException.h"
#include "Poco/String.h"
#include "Poco/Ascii.h"
#include "Poco/URI.h"
@ -68,6 +69,30 @@ HTTPCredentials::~HTTPCredentials()
}
void HTTPCredentials::fromUserInfo(const std::string& userInfo)
{
std::string username;
std::string password;
extractCredentials(userInfo, username, password);
setUsername(username);
setPassword(password);
// TODO: Reset digest state?
}
void HTTPCredentials::fromURI(const URI& uri)
{
std::string username;
std::string password;
extractCredentials(uri, username, password);
setUsername(username);
setPassword(password);
// TODO: Reset digest state?
}
void HTTPCredentials::authenticate(HTTPRequest& request, const HTTPResponse& response)
{
for (HTTPResponse::ConstIterator iter = response.find("WWW-Authenticate"); iter != response.end(); ++iter)
@ -88,9 +113,9 @@ void HTTPCredentials::authenticate(HTTPRequest& request, const HTTPResponse& res
void HTTPCredentials::updateAuthInfo(HTTPRequest& request)
{
if (request.has("Authorization"))
if (request.has(HTTPRequest::AUTHORIZATION))
{
const std::string& authorization = request.get("Authorization");
const std::string& authorization = request.get(HTTPRequest::AUTHORIZATION);
if (isBasicCredentials(authorization))
{
@ -106,13 +131,25 @@ void HTTPCredentials::updateAuthInfo(HTTPRequest& request)
bool HTTPCredentials::isBasicCredentials(const std::string& header)
{
return icompare(header, 0, 6, "Basic ") == 0;
return icompare(header, 0, 5, "Basic") == 0 && (header.size() > 5 ? Poco::Ascii::isSpace(header[5]) : true);
}
bool HTTPCredentials::isDigestCredentials(const std::string& header)
{
return icompare(header, 0, 7, "Digest ") == 0;
return icompare(header, 0, 6, "Digest") == 0 && (header.size() > 6 ? Poco::Ascii::isSpace(header[6]) : true);
}
bool HTTPCredentials::hasBasicCredentials(const HTTPRequest& request)
{
return request.has(HTTPRequest::AUTHORIZATION) && isBasicCredentials(request.get(HTTPRequest::AUTHORIZATION));
}
bool HTTPCredentials::hasDigestCredentials(const HTTPRequest& request)
{
return request.has(HTTPRequest::AUTHORIZATION) && isDigestCredentials(request.get(HTTPRequest::AUTHORIZATION));
}

View File

@ -200,12 +200,7 @@ void HTTPDigestCredentials::createAuthParams(const HTTPRequest& request, const H
if (qop.empty())
{
MD5Engine engine;
const std::string ha1 = digest(engine, _username, realm, _password);
const std::string ha2 = digest(engine, request.getMethod(), request.getURI());
_requestAuthParams.set(RESPONSE_PARAM, digest(engine, ha1, nonce, ha2));
updateAuthParams(request);
}
else
{
@ -223,20 +218,29 @@ void HTTPDigestCredentials::createAuthParams(const HTTPRequest& request, const H
}
}
if (!qopSupported)
NotImplementedException("Unsupported QoP requested", qop);
throw NotImplementedException("Unsupported QoP requested", qop);
}
}
void HTTPDigestCredentials::updateAuthParams(const HTTPRequest& request)
{
const std::string& qop = _requestAuthParams.get(QOP_PARAM, DEFAULT_QOP);
if (icompare(qop, AUTH_PARAM) == 0)
{
MD5Engine engine;
const std::string& nonce = _requestAuthParams.get(NONCE_PARAM);
const std::string& qop = _requestAuthParams.get(QOP_PARAM, DEFAULT_QOP);
const std::string& realm = _requestAuthParams.getRealm();
const std::string& nonce = _requestAuthParams.get(NONCE_PARAM);
_requestAuthParams.set(URI_PARAM, request.getURI());
if (qop.empty())
{
const std::string ha1 = digest(engine, _username, realm, _password);
const std::string ha2 = digest(engine, request.getMethod(), request.getURI());
_requestAuthParams.set(RESPONSE_PARAM, digest(engine, ha1, nonce, ha2));
}
else if (icompare(qop, AUTH_PARAM) == 0)
{
const std::string& cnonce = _requestAuthParams.get(CNONCE_PARAM);
const std::string ha1 = digest(engine, _username, realm, _password);

View File

@ -67,6 +67,7 @@ POCO_IMPLEMENT_EXCEPTION(SMTPException, NetException, "SMTP Exception")
POCO_IMPLEMENT_EXCEPTION(POP3Exception, NetException, "POP3 Exception")
POCO_IMPLEMENT_EXCEPTION(ICMPException, NetException, "ICMP Exception")
POCO_IMPLEMENT_EXCEPTION(HTMLFormException, NetException, "HTML Form Exception")
POCO_IMPLEMENT_EXCEPTION(WebSocketException, NetException, "WebSocket Exception")
} } // namespace Poco::Net

View File

@ -299,11 +299,13 @@ void Application::stopOptionsProcessing()
int Application::run()
{
int rc = EXIT_SOFTWARE;
initialize(*this);
int rc = EXIT_CONFIG;
try
{
initialize(*this);
rc = EXIT_SOFTWARE;
rc = main(_args);
uninitialize();
}
catch (Poco::Exception& exc)
{
@ -317,7 +319,6 @@ int Application::run()
{
logger().fatal("system exception");
}
uninitialize();
return rc;
}

View File

@ -499,17 +499,7 @@ int ServerApplication::run(int argc, char** argv)
logger().log(exc);
return EXIT_CONFIG;
}
int rc = run();
try
{
uninitialize();
}
catch (Exception& exc)
{
logger().log(exc);
rc = EXIT_CONFIG;
}
return rc;
return run();
}
@ -524,17 +514,7 @@ int ServerApplication::run(const std::vector<std::string>& args)
logger().log(exc);
return EXIT_CONFIG;
}
int rc = run();
try
{
uninitialize();
}
catch (Exception& exc)
{
logger().log(exc);
rc = EXIT_CONFIG;
}
return rc;
return run();
}
@ -550,17 +530,7 @@ int ServerApplication::run(int argc, wchar_t** argv)
logger().log(exc);
return EXIT_CONFIG;
}
int rc = run();
try
{
uninitialize();
}
catch (Exception& exc)
{
logger().log(exc);
rc = EXIT_CONFIG;
}
return rc;
return run();
}
#endif

View File

@ -53,6 +53,32 @@ namespace Poco {
namespace Util {
namespace
{
class AutoHandle
{
public:
AutoHandle(HMODULE h):
_h(h)
{
}
~AutoHandle()
{
FreeLibrary(_h);
}
HMODULE handle()
{
return _h;
}
private:
HMODULE _h;
};
}
WinRegistryKey::WinRegistryKey(const std::string& key, bool readOnly, REGSAM extraSam):
_hKey(0),
_readOnly(readOnly),
@ -269,12 +295,48 @@ void WinRegistryKey::deleteKey()
WinRegistryKey subRegKey(_hRootKey, subKey);
subRegKey.deleteKey();
}
// NOTE: RegDeleteKeyEx is only available on Windows XP 64-bit SP3, Windows Vista or later.
// We cannot call it directly as this would prevent the code running on Windows XP 32-bit.
// Therefore, if we need to call RegDeleteKeyEx (_extraSam != 0) we need to check for
// its existence in ADVAPI32.DLL and call it indirectly.
#if defined(POCO_WIN32_UTF8)
std::wstring usubKey;
Poco::UnicodeConverter::toUTF16(_subKey, usubKey);
typedef LONG (WINAPI *RegDeleteKeyExWFunc)(HKEY hKey, const wchar_t* lpSubKey, REGSAM samDesired, DWORD Reserved);
if (_extraSam != 0)
{
AutoHandle advAPI32(LoadLibraryW(L"ADVAPI32.DLL"));
if (advAPI32.handle())
{
RegDeleteKeyExWFunc pRegDeleteKeyExW = reinterpret_cast<RegDeleteKeyExWFunc>(GetProcAddress(advAPI32.handle() , "RegDeleteKeyExW"));
if (pRegDeleteKeyExW)
{
if ((*pRegDeleteKeyExW)(_hRootKey, usubKey.c_str(), _extraSam, 0) != ERROR_SUCCESS)
throw NotFoundException(key());
return;
}
}
}
if (RegDeleteKeyW(_hRootKey, usubKey.c_str()) != ERROR_SUCCESS)
throw NotFoundException(key());
#else
typedef LONG (WINAPI *RegDeleteKeyExAFunc)(HKEY hKey, const char* lpSubKey, REGSAM samDesired, DWORD Reserved);
if (_extraSam != 0)
{
AutoHandle advAPI32(LoadLibraryA("ADVAPI32.DLL"));
if (advAPI32.handle())
{
RegDeleteKeyExAFunc pRegDeleteKeyExA = reinterpret_cast<RegDeleteKeyExAFunc>(GetProcAddress(advAPI32.handle() , "RegDeleteKeyExA"));
if (pRegDeleteKeyExA)
{
if ((*pRegDeleteKeyExA)(_hRootKey, _subKey.c_str(), _extraSam, 0) != ERROR_SUCCESS)
throw NotFoundException(key());
return;
}
}
}
if (RegDeleteKey(_hRootKey, _subKey.c_str()) != ERROR_SUCCESS)
throw NotFoundException(key());
#endif