http-client-request.c revision 069b28a2ef54072a221fe4ac67aaeb4e83fee6c1
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "net.h"
#include "str.h"
#include "hash.h"
#include "array.h"
#include "istream.h"
#include "ostream.h"
#include "http-url.h"
#include "http-response-parser.h"
#include "http-transfer.h"
#include "http-client-private.h"
/*
* Logging
*/
static inline void
static inline void
const char *format, ...)
{
i_debug("http-client: request %s: %s",
}
}
/*
* Request
*/
struct http_client_request *
{
struct http_client_request *req;
return req;
}
{
}
{
return;
/* only decrease pending request counter if this request was submitted */
}
unsigned int port)
{
}
bool ssl)
{
if (ssl) {
} else {
}
}
{
}
{
}
{
int ret;
if (ret < 0) {
i_error("i_stream_get_size(%s) failed: %m",
}
req->payload_size = 0;
}
/* prepare request payload sync using 100 Continue response from server */
}
{
struct http_client_host *host;
}
{
}
static void
{
}
}
static int
{
int ret;
} else {
}
req->payload_size = 0;
/* Wait for payload data to be written */
break;
}
}
ret = 1;
else
/* Return status */
return ret;
}
{
}
{
}
{
int ret = 0;
ret = -1;
if (!req->payload_chunked &&
return -1;
}
if (req->payload_wait) {
} else {
}
} else {
}
return ret;
}
{
int ret = 0;
}
if (req->payload_sync) {
}
if (req->payload_chunked) {
} else if (req->payload_size != 0) {
req->payload_size);
}
ret = -1;
if (!req->payload_sync) {
if (http_client_request_send_more(req) < 0)
ret = -1;
} else {
}
} else {
}
return ret;
}
struct http_response *response)
{
}
static void
{
struct http_response response;
}
}
{
}
{
return;
}
{
return;
}
{
const char *error;
unsigned int newport;
/* parse URL */
return;
}
t_strdup_printf("Redirected more than %d times",
} else {
"Redirect refused");
}
return;
}
/* rewind payload stream */
"Redirect failed: Cannot resend payload; stream is not seekable");
return;
} else {
}
}
/* rewind payload stream */
"Redirect failed: Cannot resend payload; stream is not seekable");
return;
} else {
}
}
// FIXME: handle literal IP specially (avoid duplicate parsing)
Section-7.4.4
-> A 303 `See Other' redirect status response is handled a bit differently.
Basically, the response content is located elsewhere, but the original
(POST) request is handled already.
*/
// FIXME: should we provide the means to skip this step? The original
// request was already handled at this point.
/* drop payload */
req->payload_size = 0;
req->payload_offset = 0;
}
Section-7.4.4
-> A 303 `See Other' redirect status response is handled a bit differently.
Basically, the response content is located elsewhere, but the original
(POST) request is handled already.
*/
// FIXME: should we provide the means to skip this step? The original
// request was already handled at this point.
/* drop payload */
req->payload_size = 0;
req->payload_offset = 0;
}
/* resubmit */
}
{
/* rewind payload stream */
"Resubmission failed: Cannot resend payload; stream is not seekable");
return;
} else {
}
}
/* rewind payload stream */
"Resubmission failed: Cannot resend payload; stream is not seekable");
return;
} else {
}
}
}
{
/* limit the number of attempts for each request */
/* return error */
return;
}
/* resubmit */
}
void (*callback)(void *),
void *context)
{
}