154
159
int isMms(char *url)
157
printf("in isMms\n");
161
163
if ((strncasecmp(url, "mms://", 6) == 0)
162
164
|| (strncasecmp(url, "mmst://", 7) == 0)
163
165
|| (strncasecmp(url, "mmsu://", 7) == 0)
164
166
|| (strncasecmp(url, "dvd://", 6) == 0)
167
|| (strncasecmp(url, "smb://", 6) == 0)
165
168
|| (strncasecmp(url, "rtsp://", 7) == 0)) {
170
printf("isMms = true\n");
174
printf("isMms = false\nurl = %s\n", url);
193
200
char *q1; // question mark in tmp
194
201
char *q2; // question mark in tmp2
195
char *hostname1; // hostname1
196
char *hostname2; // hostname2
202
int tmp1hasq = 0; // tmp1 has a ?
203
int tmp2hasq = 0; // tmp2 has a ?
204
char *hostname1 = NULL; // hostname1
205
char *hostname2 = NULL; // hostname2
206
char *protocol1 = NULL;
207
char *protocol2 = NULL;
248
if (strncasecmp(buffer1, "file://", 7) == 0) {
249
if (strcmp(buffer1 + 7, buffer2) == 0) {
256
if (strncasecmp(buffer2, "file://", 7) == 0) {
257
if (strcmp(buffer1, buffer2 + 7) == 0) {
239
265
hostname1 = getURLHostname(buffer1);
242
268
if (hostname1 != NULL && hostname2 != NULL
243
269
&& strstr(hostname2, hostname1) == NULL) {
244
270
// hostname1 is a not substring of hostname2
271
// this is done for the case where the playlist has two urls that basically point to the same site
272
// one of the sites is an internal URL and the other is an external. We want to be able to play either
273
// site. So as long as the hostnames are completly different we should be ok.
275
printf("URLcmp: hostnames do not match\n");
247
278
// url1 is a substring of url2, so continue comparing
280
printf("hostname1 = %s\nhostname2 = %s\n", hostname1,
249
282
// compare the paths, some sites change the hostname mid stream (like cartoonnetwork.com -> www.cartoonnetwork.com);
250
283
tmp1 = strstr(buffer1, "://");
251
284
if (tmp1 != NULL) {
286
(char *) malloc((long) tmp1 - (long) buffer1 + 1);
287
strncpy(protocol1, buffer1,
288
(long) tmp1 - (long) buffer1 + 1);
289
protocol1[(long) tmp1 - (long) buffer1] = '\0';
293
printf("protocol1: %s\n", protocol1);
253
297
while (tmp1[0] != '/') {
254
298
if (tmp1[0] == '\0')
259
303
tmp2 = strstr(buffer2, "://");
260
304
if (tmp2 != NULL) {
306
(char *) malloc((long) tmp2 - (long) buffer2 + 1);
307
strncpy(protocol2, buffer2,
308
(long) tmp2 - (long) buffer2 + 1);
309
protocol2[(long) tmp2 - (long) buffer2] = '\0';
313
printf("protocol2: %s\n", protocol2);
262
317
while (tmp2[0] != '/') {
263
318
if (tmp2[0] == '\0')
268
323
if (tmp1 != NULL && tmp2 != NULL) {
269
324
if (strcmp(tmp1, tmp2) == 0) {
325
// if either protocol is file:// then they are the same at this point usually one will be NULL and the other file://
326
if ((strncmp(protocol1, "file://", 7) == 0)
327
|| (strncmp(protocol2, "file://", 7) == 0)) {
330
// NetFlix puts out the same preview on multiple protocols, we have to add them all to the playlist
331
if (strcmp(protocol1, protocol2) == 0) {
273
339
q1 = strchr(tmp1, '?');
274
340
q2 = strchr(tmp2, '?');
275
341
if (q1 != NULL || q2 != NULL) {
280
350
if (strcmp(tmp1, tmp2) == 0) {
351
if (tmp1hasq != tmp2hasq) {
354
if (strcmp(q1+1,q2+1) == 0) {
346
434
if (command == NULL || instance == NULL || instance->cancelled == 1)
437
if (instance->threadsignaled == 0)
440
if (instance->control == -1)
349
444
if (instance->js_state != JS_STATE_TRANSITIONING) {
351
446
snprintf(buffer, 1023, "%s\n", command);
405
502
if (instance->player == NULL) {
406
503
instance->pid = 0;
409
fclose(instance->player);
506
printf("closing player\n");
507
// fclose(instance->player);
410
508
instance->player = NULL;
511
printf("closing control pipe\n");
412
512
if (instance->control > 0) {
413
513
close(instance->control);
414
514
instance->control = -1;
519
printf("player should be closed\n");
419
521
if (instance->pid != 0) {
478
580
if ((strncasecmp(item, "http", 4) != 0)
479
581
&& (strncasecmp(item, "file", 4) != 0)) {
584
printf("not http and not file\n");
481
586
if (item[0] != '/') {
482
587
strlcpy(tmpdir, item, 1024); // reuse the buffer
483
588
if (instance->baseurl != NULL) {
484
589
strlcpy(localitem, instance->baseurl, 1024);
591
strlcpy(localitem, "", 1024);
486
593
strlcat(localitem, tmpdir, 1024);
488
595
if (instance->hostname != NULL) {
489
snprintf(tmpdir, 1024, "http://%s%s",
490
instance->hostname, item);
491
strlcpy(localitem, tmpdir, 1024);
596
if (fexists(item) == 0) {
597
snprintf(tmpdir, 1024, "http://%s%s",
598
instance->hostname, item);
599
strlcpy(localitem, tmpdir, 1024);
601
// first char == / and hostname is null, sounds like a filename
602
strlcpy(localitem, item, 1024);
605
// first char == / and hostname is null, sounds like a filename
606
strlcpy(localitem, item, 1024);
497
612
// if :80 is in the URL, cut it out
498
613
strlcpy(localitem, item, 1024);
499
614
tmp = strstr(localitem, ":8080");
638
// check and see if the file exists, if it does not then prepend smb:// to the filename
639
if (fexists(localitem) == 0) {
640
strlcpy(tmpdir, "smb://", 1024);
641
strlcat(tmpdir, localitem, 1024);
642
strlcpy(localitem, tmpdir, 1024);
526
651
strlcpy(localitem, item, 1024);
530
656
printf("fqu result: %s\n", localitem);
533
660
int toolkitOk(NPP instance, int *mozilla_toolkit, int *plugin_toolkit)