2
* Version: MPL 1.1 / GPLv2+ / LGPLv2+
4
* The contents of this file are subject to the Mozilla Public License Version
5
* 1.1 (the "License"); you may not use this file except in compliance with
6
* the License or as specified alternatively below. You may obtain a copy of
7
* the License at http://www.mozilla.org/MPL/
9
* Software distributed under the License is distributed on an "AS IS" basis,
10
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
* for the specific language governing rights and limitations under the
14
* Major Contributor(s):
15
* Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
18
* All Rights Reserved.
20
* For minor contributions see the git repository.
22
* Alternatively, the contents of this file may be used under the terms of
23
* either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25
* in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26
* instead of those above.
29
#include <curl/curl.h>
35
/* Mockup behavior configuration functions */
36
void curl_mockup_reset( );
38
/** Add a new HTTP response the server should send.
41
the base URL of the request without parameters
43
a string to find in the parameters part of the URL to match
45
a string corresponding either to the file path of the request
46
body to send or directly the content to send. This value has
47
a different meaning depending on isFilePath parameter.
49
HTTP method to match like PUT, GET, POST or DELETE. An empty
50
string matches any method.
52
the HTTP status to return. 0 means HTTP OK (200).
54
if this value is true the response value is used as a file path,
55
otherwise, the response value is used as the body of the HTTP
58
the HTTP headers block to send with the response. By default
61
void curl_mockup_addResponse( const char* baseUrl, const char* matchParam, const char* method,
62
const char* response, unsigned int status = 0, bool isFilePath = true,
63
const char* headers = 0 );
65
/** Set the HTTP response the server is supposed to send.
66
This will reset all already defined responses.
68
void curl_mockup_setResponse( const char* filepath );
69
void curl_mockup_setCredentials( const char* username, const char* password );
77
const struct HttpRequest* curl_mockup_getRequest( const char* baseUrl, const char* matchParam, const char* method );
78
const char* curl_mockup_getRequestBody( const char* baseUrl, const char* matchParam, const char* method );
80
const char* curl_mockup_getProxy( CURL* handle );
81
const char* curl_mockup_getNoProxy( CURL* handle );
82
const char* curl_mockup_getProxyUser( CURL* handle );
83
const char* curl_mockup_getProxyPass( CURL* handle );
85
/** Set a fake invalid certificate to raise CURLE_SSL_CACERT. Setting it
86
to an empty string will reset to no certificate.
88
void curl_mockup_setSSLBadCertificate( const char* certificate );