Revision 64144d8f chunk_puller.c

View differences:

chunk_puller.c
1 1
#include <platform.h>
2 2
#include <microhttpd.h>
3 3

  
4
#include <http_default_urls.h>
5 4

  
6
struct connection_info_struct {
5
static struct connection_info_struct {
7 6
  uint8_t *block;
8 7
  int block_size;
9 8
};
9
static int listen_port = 0;
10
static char listen_path[256];
10 11

  
11 12
void request_completed(void *cls, struct MHD_Connection *connection,
12 13
                       void **con_cls, enum MHD_RequestTerminationCode toe) {
......
57 58
  }
58 59

  
59 60
  if(0 == strcmp(method, "POST")) {
60
    if(0 == strcmp(url, UL_DEFAULT_EXTERNALPLAYER_PATH)) {
61
    if(0 == strcmp(url, listen_path)) {
61 62
      con_info = (struct connection_info_struct *)*con_cls;
62 63
      if(*upload_data_size > 0) {
63 64
        block = (uint8_t *)malloc(con_info->block_size+*upload_data_size);
......
87 88
}
88 89

  
89 90

  
90
struct MHD_Daemon *initChunkPuller() {
91
  return MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, UL_DEFAULT_EXTERNALPLAYER_PORT,
91
struct MHD_Daemon *initChunkPuller(const char *path, const int port) {
92
  sprintf(listen_path, "%s", path);
93
  listen_port = port;
94
printf("starting HTTPD on %s port %d\n", listen_path, listen_port);
95
  return MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, listen_port,
92 96
                          NULL, NULL,
93 97
                          &answer_to_connection, NULL, MHD_OPTION_END);
94 98
}

Also available in: Unified diff