/* Copyright (c) 2014-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "istream.h"
#include "module-context.h"
#include "iostream-ssl.h"
#include "http-url.h"
#include "http-client.h"
#include "message-parser.h"
#include "mail-user.h"
#include "fts-parser.h"
struct fts_parser_tika_user {
};
struct tika_fts_parser {
bool failed;
};
static int
{
/* fts_tika disabled */
return -1;
}
}
return -1;
}
if (tika_http_client == NULL) {
}
return 0;
}
static void
struct tika_fts_parser *parser)
{
case 200:
/* read response */
else {
}
break;
case 204: /* empty response */
case 415: /* Unsupported Media Type */
case 422: /* Unprocessable Entity */
i_debug("fts_tika: PUT %s failed: %s",
}
break;
default:
/* Server Error - the problem could be anything (in Tika or
HTTP server or proxy) and might be retriable, but Tika has
trouble processing some documents and throws up this error
every time for those documents. */
i_strdup_printf("fts_tika: PUT %s failed: %s",
} else {
i_error("fts_tika: PUT %s failed: %s",
}
break;
}
}
static struct fts_parser *
{
return NULL;
}
struct message_block *block)
{
const unsigned char *data;
/* first we'll send everything to Tika */
return;
}
/* read the result from Tika */
return;
}
/* continue returning data from Tika. we'll create a new ioloop just
for reading this one payload. */
break;
/* wait for more input from Tika */
} else {
}
}
/* switch back to original ioloop. */
;
else if (size > 0) {
} else {
/* finished */
i_error("read(%s) failed: %s",
}
}
}
{
if (retriable_err_msg_r != NULL)
/* remove io before unrefing payload - otherwise lib-http adds another
timeout to ioloop unnecessarily */
}
return ret;
}
static void fts_parser_tika_unload(void)
{
if (tika_http_client != NULL)
}
};