-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiscover.dart
26 lines (25 loc) · 931 Bytes
/
discover.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// @dart=2.9
import './discover_flutter/lib/client.dart';
import 'dart:io';
void main() {
Client client = new Client();
var query = "urn:schemas-sbtvd-org:service:GingaCCWebServices:1";
var found = false;
client.search(query, (data) async {
if (found) return;
found = true;
print("-- m-search response headers ... " + data);
String locationUrl = new RegExp(r"LOCATION: *(.*)\s", caseSensitive: false)
.firstMatch(data)[1];
HttpClient client = new HttpClient();
client.getUrl(Uri.parse(locationUrl)).then((HttpClientRequest request) {
return request.close();
}).then((HttpClientResponse response) {
print("-- response from " + locationUrl);
print("-- GingaCC-Server-BaseURL = " +
response.headers["GingaCC-Server-BaseURL"][0]);
print("-- GingaCC-Server-SecureBaseURL = " +
response.headers["GingaCC-Server-SecureBaseURL"][0]);
});
});
}