Revision 74a68610 transports/janus_http.c

View differences:

transports/janus_http.c
1108 1108
	if (!strcasecmp(method, "OPTIONS")) {
1109 1109
		response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1110 1110
		MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1111
    MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1111
		MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1112 1112
		if(msg->acrm)
1113 1113
			MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1114 1114
		if(msg->acrh)
......
1130 1130
			JANUS_LOG(LOG_ERR, "Invalid url %s\n", url);
1131 1131
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1132 1132
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1133
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1133
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1134 1134
			if(msg->acrm)
1135 1135
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1136 1136
			if(msg->acrh)
......
1147 1147
			JANUS_LOG(LOG_ERR, "Invalid path %s (%s)\n", basepath[1], path[1]);
1148 1148
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1149 1149
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1150
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1150
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1151 1151
			if(msg->acrm)
1152 1152
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1153 1153
			if(msg->acrh)
......
1183 1183
		JANUS_LOG(LOG_ERR, "Too many components...\n");
1184 1184
		response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1185 1185
		MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1186
    MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1186
		MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1187 1187
		if(msg->acrm)
1188 1188
			MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1189 1189
		if(msg->acrh)
......
1230 1230
		if(strcasecmp(method, "GET")) {
1231 1231
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1232 1232
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1233
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1233
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1234 1234
			if(msg->acrm)
1235 1235
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1236 1236
			if(msg->acrh)
......
1256 1256
			JANUS_LOG(LOG_ERR, "Invalid session %s\n", session_path);
1257 1257
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1258 1258
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1259
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1259
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1260 1260
			if(msg->acrm)
1261 1261
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1262 1262
			if(msg->acrh)
......
1292 1292
			if(!secret_authorized && !token_authorized) {
1293 1293
				response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1294 1294
				MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1295
        MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1295
				MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1296 1296
				if(msg->acrm)
1297 1297
					MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1298 1298
				if(msg->acrh)
......
1322 1322
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1323 1323
			MHD_add_response_header(response, "Location", location);
1324 1324
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1325
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1325
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1326 1326
			if(msg->acrm)
1327 1327
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1328 1328
			if(msg->acrh)
......
1339 1339
			JANUS_LOG(LOG_ERR, "Couldn't find any session %"SCNu64"...\n", session_id);
1340 1340
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1341 1341
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1342
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1342
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1343 1343
			if(msg->acrm)
1344 1344
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1345 1345
			if(msg->acrh)
......
1512 1512
		JANUS_LOG(LOG_ERR, "Unsupported method...\n");
1513 1513
		response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1514 1514
		MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1515
    MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1515
		MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1516 1516
		if(msg->acrm)
1517 1517
			MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1518 1518
		if(msg->acrh)
......
1524 1524
	if (!strcasecmp(method, "OPTIONS")) {
1525 1525
		response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1526 1526
		MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1527
    MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1527
		MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1528 1528
		if(msg->acrm)
1529 1529
			MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1530 1530
		if(msg->acrh)
......
1546 1546
			JANUS_LOG(LOG_ERR, "Invalid url %s\n", url);
1547 1547
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1548 1548
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1549
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1549
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1550 1550
			if(msg->acrm)
1551 1551
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1552 1552
			if(msg->acrh)
......
1563 1563
			JANUS_LOG(LOG_ERR, "Invalid path %s (%s)\n", basepath[1], path[1]);
1564 1564
			response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1565 1565
			MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1566
      MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1566
			MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1567 1567
			if(msg->acrm)
1568 1568
				MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1569 1569
			if(msg->acrh)
......
1599 1599
		JANUS_LOG(LOG_ERR, "Too many components...\n");
1600 1600
		response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1601 1601
		MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1602
    MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1602
		MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1603 1603
		if(msg->acrm)
1604 1604
			MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1605 1605
		if(msg->acrh)
......
1771 1771
		JANUS_LOG(LOG_ERR, "Couldn't find any session %"SCNu64"...\n", session_id);
1772 1772
		response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
1773 1773
		MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1774
    MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1774
		MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1775 1775
		if(msg->acrm)
1776 1776
			MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1777 1777
		if(msg->acrh)
......
1855 1855
		MHD_RESPMEM_MUST_FREE);
1856 1856
	MHD_add_response_header(response, "Content-Type", "application/json");
1857 1857
	MHD_add_response_header(response, "Access-Control-Allow-Origin", "*");
1858
  MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1858
	MHD_add_response_header(response, "Access-Control-Max-Age", "86400");
1859 1859
	if(msg->acrm)
1860 1860
		MHD_add_response_header(response, "Access-Control-Allow-Methods", msg->acrm);
1861 1861
	if(msg->acrh)

Also available in: Unified diff