Compare commits
3174 Commits
SSU_PERSON
...
linkclickf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6a9a31b18 | ||
|
|
528acf4c90 | ||
|
|
4dcb15068c | ||
|
|
04353776b2 | ||
|
|
3d8808b91f | ||
|
|
0e08e3e2ee | ||
|
|
953c538a6a | ||
|
|
a837246fb6 | ||
|
|
a207c82fa2 | ||
|
|
a86bd6fe1d | ||
|
|
6206f33439 | ||
|
|
aeb31fc3c7 | ||
|
|
9ccf4f1672 | ||
|
|
03d030fe69 | ||
|
|
e8930953fc | ||
|
|
fc34fc49ba | ||
|
|
b5267e4d45 | ||
|
|
9529ea9d27 | ||
|
|
5d3b43045e | ||
|
|
d2ae30fe63 | ||
|
|
a184d87233 | ||
|
|
19e2f0bcca | ||
|
|
feb6571090 | ||
|
|
8ea5e6aebd | ||
|
|
bb24b2f07b | ||
|
|
238efb4902 | ||
|
|
9d9091443f | ||
|
|
7ed19d2d00 | ||
|
|
d0fdac4dbe | ||
|
|
598802b0b1 | ||
|
|
6d45452ece | ||
|
|
3678a102a6 | ||
|
|
8f1bbc4ff7 | ||
|
|
b7c9edaaf2 | ||
|
|
29dec7c37d | ||
|
|
5c75d29ae2 | ||
|
|
03171d1302 | ||
|
|
f029c602eb | ||
|
|
bcba2e4de9 | ||
|
|
1c8f76fb73 | ||
|
|
0dc5b9ae1a | ||
|
|
2b16c9719e | ||
|
|
978a03597e | ||
|
|
b8d80f0eaa | ||
|
|
0056fc3244 | ||
|
|
1703e1e146 | ||
|
|
f3ef86993e | ||
|
|
15152d130c | ||
|
|
faab154f76 | ||
|
|
e087ec3f85 | ||
|
|
bc2d60ede1 | ||
|
|
489dce75cb | ||
|
|
1167bbd9d1 | ||
|
|
64215a475e | ||
|
|
afc4214e74 | ||
|
|
578e7970d0 | ||
|
|
7da0e52342 | ||
|
|
c8788c23eb | ||
|
|
d8212dd27a | ||
|
|
e431bb0ff8 | ||
|
|
826b63caba | ||
|
|
beb6ce856d | ||
|
|
82df346ee5 | ||
|
|
e4e6791139 | ||
|
|
5b3b220e27 | ||
|
|
e451d3b332 | ||
|
|
1ada668b89 | ||
|
|
750fa76806 | ||
|
|
20170b35d2 | ||
|
|
4875e07b30 | ||
|
|
fb068397fb | ||
|
|
5314d8e5ca | ||
|
|
85c6799dd2 | ||
|
|
3bea4efd2f | ||
|
|
1267e8cd26 | ||
|
|
ccf012c877 | ||
|
|
9ae1a5bad4 | ||
|
|
ce4eff7437 | ||
|
|
e1e3d42b75 | ||
|
|
a4bb7357fa | ||
|
|
fa90ceb20a | ||
|
|
3580a148de | ||
|
|
1231c8bf78 | ||
|
|
fd4153a968 | ||
|
|
9445d5ad26 | ||
|
|
272c27c2de | ||
|
|
2631283d4e | ||
|
|
88ca55b802 | ||
|
|
8116cad07e | ||
|
|
36ea13f657 | ||
|
|
6bd98defd0 | ||
|
|
e095d84ccd | ||
|
|
6a0e14a348 | ||
|
|
a91f66f391 | ||
|
|
c8c4fce31f | ||
|
|
e84810f504 | ||
|
|
e7393a42b0 | ||
|
|
2c58e6354d | ||
|
|
88e2ee342c | ||
|
|
2decd663c1 | ||
|
|
5e575e0c0a | ||
|
|
98eab49b31 | ||
|
|
eea46ae431 | ||
|
|
9429071437 | ||
|
|
7f0295183a | ||
|
|
eb756173af | ||
|
|
54f5fc1db7 | ||
|
|
afc9350a68 | ||
|
|
21216861fd | ||
|
|
67fd8a1eb0 | ||
|
|
200a1a7b52 | ||
|
|
278553d877 | ||
|
|
d9f2be62a7 | ||
|
|
ffb76e8c10 | ||
|
|
caec52d10b | ||
|
|
050469e617 | ||
|
|
03f68d8e4f | ||
|
|
b6f21d1225 | ||
|
|
21998f5309 | ||
|
|
5fd7aa381d | ||
|
|
9cd04ca551 | ||
|
|
7d00ab591b | ||
|
|
d331ebc06f | ||
|
|
d66c07326c | ||
|
|
4928f4719b | ||
|
|
1a66c67fc1 | ||
|
|
f06746377c | ||
|
|
fc45aeab91 | ||
|
|
523f17b1a0 | ||
|
|
6a3609938e | ||
|
|
c8a98cb877 | ||
|
|
a16f278163 | ||
|
|
f12ff894e2 | ||
|
|
c7054a1246 | ||
|
|
ade2ca3d55 | ||
|
|
7b9131801e | ||
|
|
429cdfc0b8 | ||
|
|
d340140454 | ||
|
|
fdfe581345 | ||
|
|
86239b0847 | ||
|
|
bb315bb524 | ||
|
|
a4dda2d74d | ||
|
|
500b1474b9 | ||
|
|
af26bcaece | ||
|
|
037c859fd6 | ||
|
|
553c0e9909 | ||
|
|
c1e328d909 | ||
|
|
774ad7e810 | ||
|
|
f907b78d65 | ||
|
|
812c994be4 | ||
|
|
ebcb097cc9 | ||
|
|
55d8e9517c | ||
|
|
50ed51e1c7 | ||
|
|
5673a2aff0 | ||
|
|
d2e14e9235 | ||
|
|
f21b1a9cba | ||
|
|
4ac27f690c | ||
|
|
5fc312c27f | ||
|
|
3c6f758b9e | ||
|
|
8b18566b07 | ||
|
|
1a496a3697 | ||
|
|
8e89a24793 | ||
|
|
4a69fa07d1 | ||
|
|
6274659d0f | ||
|
|
cb06101661 | ||
|
|
84ef16c22c | ||
|
|
b3f0f45fdd | ||
|
|
29a8c53414 | ||
|
|
73dbfd8a52 | ||
|
|
307ac0c598 | ||
|
|
f33889c73e | ||
|
|
e32a4658b2 | ||
|
|
84f5f16e95 | ||
|
|
d235fa9b63 | ||
|
|
f6760bbcf9 | ||
|
|
ccdae4ba5e | ||
|
|
a95d031087 | ||
|
|
bf58646738 | ||
|
|
30e533ca3d | ||
|
|
ab58114b96 | ||
|
|
4d41059660 | ||
|
|
15a0f37943 | ||
|
|
4953b60f0d | ||
|
|
f9730b371e | ||
|
|
e8210bc32c | ||
|
|
117c426428 | ||
|
|
66bc1e6c09 | ||
|
|
6c70a8133b | ||
|
|
2560194d84 | ||
|
|
db8df75997 | ||
|
|
ac2404dde2 | ||
|
|
8351af30e1 | ||
|
|
d80693b566 | ||
|
|
ed4663df13 | ||
|
|
89d4673f05 | ||
|
|
fabd87a395 | ||
|
|
1bd7f13d64 | ||
|
|
3518b8c6fc | ||
|
|
522ee47bed | ||
|
|
158746e816 | ||
|
|
8b1878c5fc | ||
|
|
0d711a757a | ||
|
|
eed8a0458e | ||
|
|
afbe16c2ba | ||
|
|
83c17cbf3a | ||
|
|
184b213c8c | ||
|
|
d2bb97f65d | ||
|
|
913280223b | ||
|
|
a33e8f2695 | ||
|
|
abf915c0cb | ||
|
|
d7919e0f34 | ||
|
|
d25e292375 | ||
|
|
9fdec9c0df | ||
|
|
4e2f05ea8b | ||
|
|
fbe42ca42b | ||
|
|
663dce1932 | ||
|
|
4c1a0db0ee | ||
|
|
8cc70bd69d | ||
|
|
1dff3fe651 | ||
|
|
6f2d9eb400 | ||
|
|
89c6685952 | ||
|
|
6a80fe3bd4 | ||
|
|
3cba3cfa2d | ||
|
|
522e09c892 | ||
|
|
4db977ec70 | ||
|
|
d491e6a6d5 | ||
|
|
2e95679cb5 | ||
|
|
bee2a40c9b | ||
|
|
5062bb0a09 | ||
|
|
faa007901c | ||
|
|
224046c004 | ||
|
|
27414f118e | ||
|
|
32a96f6bd1 | ||
|
|
6477be8ebe | ||
|
|
da8539b896 | ||
|
|
e18e9cd571 | ||
|
|
889af7104e | ||
|
|
5719b0c3df | ||
|
|
03e27b8f85 | ||
|
|
cd2b4fe61f | ||
|
|
98bf4567d7 | ||
|
|
9ac1d46fcb | ||
|
|
34ad8135d9 | ||
|
|
4658278093 | ||
|
|
f943500526 | ||
|
|
cfc86ffead | ||
|
|
2cd5173be8 | ||
|
|
a6ce7d90d7 | ||
|
|
c60ce6798a | ||
|
|
e23d045a61 | ||
|
|
c1aeb69e54 | ||
|
|
f7c941fd47 | ||
|
|
55539c4619 | ||
|
|
aa72295f89 | ||
|
|
4f7adf4a3d | ||
|
|
0cfd00b308 | ||
|
|
5d580fed94 | ||
|
|
0de468882f | ||
|
|
7d927fbc84 | ||
|
|
6796060512 | ||
|
|
a7304e64e4 | ||
|
|
f23c7f8d6e | ||
|
|
a19e2ce3dd | ||
|
|
fdc3910370 | ||
|
|
68fd4fc759 | ||
|
|
41529793b7 | ||
|
|
bb555d021d | ||
|
|
3d3ffd7622 | ||
|
|
de54b2f02d | ||
|
|
dfc7353975 | ||
|
|
55a1a1be8c | ||
|
|
98255b1ebe | ||
|
|
2ba656b678 | ||
|
|
b941a3c6f1 | ||
|
|
1919711158 | ||
|
|
8715ab7c6f | ||
|
|
06a1e3a6e3 | ||
|
|
d638ab269b | ||
|
|
9ca97fe70e | ||
|
|
4f40fe126c | ||
|
|
a78eabf451 | ||
|
|
a56b1b5779 | ||
|
|
ca7135ef68 | ||
|
|
e703a462af | ||
|
|
3e77714948 | ||
|
|
de46882af1 | ||
|
|
8db40f1037 | ||
|
|
a481d85df4 | ||
|
|
d759391f64 | ||
|
|
e356508379 | ||
|
|
b9c0266bb5 | ||
|
|
c774e17424 | ||
|
|
0adc119fff | ||
|
|
4437d501e0 | ||
|
|
0763d7737e | ||
|
|
258889fb73 | ||
|
|
de16b39a0f | ||
|
|
4818315df0 | ||
|
|
e2a38cc233 | ||
|
|
bc2614bde8 | ||
|
|
f5a05cad34 | ||
|
|
8136f122ee | ||
|
|
e0d5800a14 | ||
|
|
1850303e1b | ||
|
|
b059aabd61 | ||
|
|
96c89d670f | ||
|
|
7712c36001 | ||
|
|
5b2cfbd78e | ||
|
|
3890935752 | ||
|
|
6caf8d768f | ||
|
|
4c50c0a82b | ||
|
|
b859bba9c2 | ||
|
|
43da99c9b2 | ||
|
|
377c5d5d52 | ||
|
|
408d590cf3 | ||
|
|
1e21a8de68 | ||
|
|
025c2b6236 | ||
|
|
94d6ca1131 | ||
|
|
fc66e4de74 | ||
|
|
4fcd1d85c4 | ||
|
|
f30db3b4eb | ||
|
|
0c40b80e36 | ||
|
|
fb0cfba5e8 | ||
|
|
a26020ddae | ||
|
|
c4f7587cf1 | ||
|
|
6a44fa38e4 | ||
|
|
a6d40b28be | ||
|
|
ad9c7a6e01 | ||
|
|
67b057b4e1 | ||
|
|
dc3792fdd2 | ||
|
|
95e7380573 | ||
|
|
951aea37ec | ||
|
|
87ea73de0b | ||
|
|
536db3ad95 | ||
|
|
6dfdca45d6 | ||
|
|
c0f6bab39c | ||
|
|
2bc385ba4e | ||
|
|
213b98cae5 | ||
|
|
6876fef4c3 | ||
|
|
8028f196ca | ||
|
|
1b3d105c13 | ||
|
|
e08c76b042 | ||
|
|
e613dc9d1d | ||
|
|
db97dffa68 | ||
|
|
21bcdf8ac8 | ||
|
|
a690108a71 | ||
|
|
6f46bf8e1a | ||
|
|
5a24e7a200 | ||
|
|
ae475a2a28 | ||
|
|
296a8ac3e3 | ||
|
|
72e181639a | ||
|
|
5bce3dcba4 | ||
|
|
64a5b717fe | ||
|
|
07f6f40c3a | ||
|
|
f5f0e31a9d | ||
|
|
a52ba990bc | ||
|
|
839adebc7e | ||
|
|
ce3113a37e | ||
|
|
bef253ebc2 | ||
|
|
1a2c5b8ac1 | ||
|
|
c8fcbc0b7e | ||
|
|
5584858f8d | ||
|
|
75990a7c57 | ||
|
|
fcbac7f024 | ||
|
|
8a137356a2 | ||
|
|
9f8c87aadd | ||
|
|
3366dbbc52 | ||
|
|
220b26baf6 | ||
|
|
358f9b8d52 | ||
|
|
2f4e0c1c8f | ||
|
|
091b7a6039 | ||
|
|
cd915d2b75 | ||
|
|
7398fb87ea | ||
|
|
bb53bc7267 | ||
|
|
d0f172ee6b | ||
|
|
e1768569e8 | ||
|
|
ce37bc1dab | ||
|
|
a9df2ad157 | ||
|
|
cf88ce0a55 | ||
|
|
e156ccca50 | ||
|
|
8151332593 | ||
|
|
0ca578d920 | ||
|
|
2f121e2497 | ||
|
|
e5a34fbf49 | ||
|
|
284d146f9e | ||
|
|
b271305d73 | ||
|
|
df92b92344 | ||
|
|
464de633a0 | ||
|
|
e0575b1c7f | ||
|
|
07d2b12def | ||
|
|
7ef2e94ed4 | ||
|
|
c0b6375693 | ||
|
|
61cdaa3446 | ||
|
|
6530ef97ba | ||
|
|
eaf1fc2ae8 | ||
|
|
df233a0566 | ||
|
|
3dca74d3bf | ||
|
|
64b45e1ee9 | ||
|
|
03ff60431a | ||
|
|
d278b86f1e | ||
|
|
dab6d5f816 | ||
|
|
8f80b68581 | ||
|
|
9b4d9824e0 | ||
|
|
fbf05404e8 | ||
|
|
f417835bed | ||
|
|
f1bd9321d4 | ||
|
|
2cf9ce8e79 | ||
|
|
e4f1944907 | ||
|
|
8b7546e3a7 | ||
|
|
7eaf45c37f | ||
|
|
e5fda9b634 | ||
|
|
4d745519cb | ||
|
|
5551b8f302 | ||
|
|
fac7613e8d | ||
|
|
ea19a4808b | ||
|
|
47247a6335 | ||
|
|
8acc6a5465 | ||
|
|
e972732aef | ||
|
|
2af6d4953e | ||
|
|
1ac1a8e171 | ||
|
|
16ca66e0ee | ||
|
|
2255fe399e | ||
|
|
e16ab47ebe | ||
|
|
4e8cb518bc | ||
|
|
74386ec8c1 | ||
|
|
50e8e3beb4 | ||
|
|
f28387f980 | ||
|
|
76e6a9d0ca | ||
|
|
dd2b4f8ffb | ||
|
|
4cebb949ef | ||
|
|
26410a530c | ||
|
|
159a29836b | ||
|
|
f47c0aa555 | ||
|
|
d3b2c66d66 | ||
|
|
8f4d549ec6 | ||
|
|
55d7bc92d7 | ||
|
|
fa96e70b28 | ||
|
|
02736edbec | ||
|
|
6160ec1b39 | ||
|
|
2d1d9bda4a | ||
|
|
0bd28fe65f | ||
|
|
4988dd9975 | ||
|
|
0d5b55ad34 | ||
|
|
71b1c7c5f4 | ||
|
|
6c8855272d | ||
|
|
dd7c0d8e23 | ||
|
|
9b475e367f | ||
|
|
bb97d34faa | ||
|
|
5ed2d7d9d7 | ||
|
|
8b434ed5e5 | ||
|
|
8c370b6061 | ||
|
|
4f2640d5bf | ||
|
|
a50ec8fb2b | ||
|
|
e77c9b9105 | ||
|
|
c86063a240 | ||
|
|
7739e3ecd4 | ||
|
|
995d26d6bc | ||
|
|
229721aaa2 | ||
|
|
ef669dfa2e | ||
|
|
9cf3fa4f0b | ||
|
|
03e4b44c53 | ||
|
|
966f22a148 | ||
|
|
09d9d7d68b | ||
|
|
884783a44e | ||
|
|
c36deec18d | ||
|
|
5260b405b4 | ||
|
|
58c33807b9 | ||
|
|
21f50c447c | ||
|
|
f5d8545cf8 | ||
|
|
f6652ff6aa | ||
|
|
e00bc7a42e | ||
|
|
e9d415867c | ||
|
|
13d8169eea | ||
|
|
92fc885fc2 | ||
|
|
11162e5110 | ||
|
|
b2a5114130 | ||
|
|
e4adcad9e5 | ||
|
|
e17906d5a3 | ||
|
|
d93b9c94c3 | ||
|
|
8fa1d50e9b | ||
|
|
41e17e31b3 | ||
|
|
dac2734b78 | ||
|
|
613ccde6ff | ||
|
|
8286ea29d5 | ||
|
|
610ba94983 | ||
|
|
0179e82811 | ||
|
|
ca40ad9efa | ||
|
|
c0090b1668 | ||
|
|
589df0690f | ||
|
|
84fb06e890 | ||
|
|
3aa95dabaa | ||
|
|
9eb6fb68fa | ||
|
|
bbcfe20c54 | ||
|
|
eeb070b4d8 | ||
|
|
74fa582803 | ||
|
|
a97da1f428 | ||
|
|
153011395b | ||
|
|
d2a1e4062f | ||
|
|
cd052753f4 | ||
|
|
7897b53e83 | ||
|
|
362d7c27b1 | ||
|
|
19dd6313e7 | ||
|
|
fbb6da544c | ||
|
|
f41933dc19 | ||
|
|
7ff6a20c43 | ||
|
|
719ab251e6 | ||
|
|
14a994b21d | ||
|
|
4d40b34c52 | ||
|
|
58c288a59c | ||
|
|
c76b431214 | ||
|
|
2861e4764c | ||
|
|
2ee859bf14 | ||
|
|
5dd973b68d | ||
|
|
e2acfbe744 | ||
|
|
3efeaf17d3 | ||
|
|
26c301f9e2 | ||
|
|
c9d08965bc | ||
|
|
d7813a8ad1 | ||
|
|
ea8acd1a55 | ||
|
|
1c1a216430 | ||
|
|
5c300ab8b2 | ||
|
|
140b94ba96 | ||
|
|
f969456203 | ||
|
|
cce0b5ba37 | ||
|
|
3736f9b742 | ||
|
|
6dd035308a | ||
|
|
37e5c4968e | ||
|
|
20a69b837a | ||
|
|
4b879b15dd | ||
|
|
a9a5cd5389 | ||
|
|
2fd774249a | ||
|
|
8c41960215 | ||
|
|
424cc3748a | ||
|
|
b902eb3de4 | ||
|
|
7ca4105aa9 | ||
|
|
5cf59a3a32 | ||
|
|
426a077395 | ||
|
|
3b77e03337 | ||
|
|
a2f83e6dd1 | ||
|
|
b939060eac | ||
|
|
1fc8b4694a | ||
|
|
35108e828a | ||
|
|
c8d8d3f308 | ||
|
|
3223bd517e | ||
|
|
593123a4e8 | ||
|
|
30c94c1d11 | ||
|
|
15e1919c91 | ||
|
|
196674549e | ||
|
|
d44d354050 | ||
|
|
b141a515b9 | ||
|
|
0ef87b8b51 | ||
|
|
d72876c011 | ||
|
|
5923e169e1 | ||
|
|
746e6621ac | ||
|
|
e6181817d5 | ||
|
|
50fc8052cd | ||
|
|
4a4edbf868 | ||
|
|
7f0102c5a9 | ||
|
|
a610c0fc3a | ||
|
|
f511f71c84 | ||
|
|
45556e0036 | ||
|
|
8a643c4e4d | ||
|
|
eda0fd14bb | ||
|
|
76389690c3 | ||
|
|
988996800d | ||
|
|
71299abd03 | ||
|
|
5875ceaabd | ||
|
|
05ab78a3fb | ||
|
|
3bc8d656a4 | ||
|
|
f919f511b1 | ||
|
|
2b2767bff4 | ||
|
|
89a4c78799 | ||
|
|
3fb4d7189f | ||
|
|
887b3f76e7 | ||
|
|
9cd210b4a2 | ||
|
|
bd320b90c2 | ||
|
|
ab79fc174b | ||
|
|
4f597a9d40 | ||
|
|
e282f90023 | ||
|
|
88149a19f2 | ||
|
|
6a7ee95929 | ||
|
|
999c9d9f91 | ||
|
|
c11ace71a6 | ||
|
|
0d509a8d53 | ||
|
|
a0b73298bf | ||
|
|
6b47c4a03b | ||
|
|
93d77680da | ||
|
|
d8d4ecf9d9 | ||
|
|
3d04a873f2 | ||
|
|
ac7a031d96 | ||
|
|
0e827a82cd | ||
|
|
e3c2b7d955 | ||
|
|
a166423ec2 | ||
|
|
0220b2d70f | ||
|
|
ce870d2f2c | ||
|
|
c4871b3968 | ||
|
|
8742a6e010 | ||
|
|
9d3fb8c909 | ||
|
|
be7e789ad4 | ||
|
|
3bcd472ddd | ||
|
|
9b3848e2ca | ||
|
|
2f042e4fc1 | ||
|
|
44278ce90b | ||
|
|
196aa16c44 | ||
|
|
a65a5df19f | ||
|
|
06451fcd76 | ||
|
|
17fb4d2d0b | ||
|
|
0fb3667b56 | ||
|
|
052c4a9c0e | ||
|
|
0c6fc8328e | ||
|
|
485de8da7a | ||
|
|
0df8bbd925 | ||
|
|
30df392de1 | ||
|
|
0467a7e9ad | ||
|
|
8ad0a48fa1 | ||
|
|
a4018be161 | ||
|
|
d458c055bb | ||
|
|
076eb41487 | ||
|
|
67b82b7ffa | ||
|
|
384adca3bb | ||
|
|
5345939064 | ||
|
|
2a9340e90c | ||
|
|
dea3118b7e | ||
|
|
28db414fa4 | ||
|
|
6501ffa8c2 | ||
|
|
880ae9f49a | ||
|
|
cb6bfbdb6e | ||
|
|
5071419800 | ||
|
|
82fa780fcb | ||
|
|
7e4bf4565a | ||
|
|
b35bf77cea | ||
|
|
e85dbd5313 | ||
|
|
9cf49ff354 | ||
|
|
885da3fc9f | ||
|
|
6eda3aac98 | ||
|
|
4bcca5a554 | ||
|
|
1030b5cbc8 | ||
|
|
c056be4201 | ||
|
|
2fc95d08af | ||
|
|
e49cdf0a25 | ||
|
|
1e71ac0f5c | ||
|
|
65d7928e21 | ||
|
|
1de20470ea | ||
|
|
b7957d6bfa | ||
|
|
477c951a51 | ||
|
|
a66b5d430f | ||
|
|
5806b724a1 | ||
|
|
0dd3a03320 | ||
|
|
c3b9bc7f83 | ||
|
|
9ca65bd604 | ||
|
|
5cda370a28 | ||
|
|
04d53528c9 | ||
|
|
32de04bb9c | ||
|
|
1eb03cf851 | ||
|
|
0e647f3880 | ||
|
|
b287229fe6 | ||
|
|
c643070c5c | ||
|
|
412c3ec033 | ||
|
|
b2d3d1c5a8 | ||
|
|
a4d4d45374 | ||
|
|
b493f9d5ae | ||
|
|
6ff00eda55 | ||
|
|
0a1996f68b | ||
|
|
0fd790f48b | ||
|
|
2cb7576d21 | ||
|
|
2810ea3b94 | ||
|
|
3236ee9cba | ||
|
|
1ca70caa1a | ||
|
|
7e525a51a5 | ||
|
|
3f3dd34f18 | ||
|
|
6a7dbb2964 | ||
|
|
a4235fc535 | ||
|
|
d97320a28a | ||
|
|
d04bdb5a8c | ||
|
|
0fff9a26a5 | ||
|
|
db941228eb | ||
|
|
7930279120 | ||
|
|
603824b870 | ||
|
|
a9dc72550c | ||
|
|
b31fe7fd4c | ||
|
|
a6e7d23be9 | ||
|
|
290775402d | ||
|
|
0ed38a8fd3 | ||
|
|
47bd6dc3cc | ||
|
|
50cc6323f5 | ||
|
|
ec1ce7b790 | ||
|
|
2e3ff29319 | ||
|
|
254184e2ba | ||
|
|
afafa97e7c | ||
|
|
dfaa91c993 | ||
|
|
1e8edc9e93 | ||
|
|
ab7b683d3c | ||
|
|
143417f3b2 | ||
|
|
9dfc5f5d08 | ||
|
|
e9424b90e8 | ||
|
|
7f309e7c52 | ||
|
|
51782e1a8e | ||
|
|
ea24edd773 | ||
|
|
c4e05266ea | ||
|
|
5ab6436c9b | ||
|
|
57f52259cf | ||
|
|
84ae03bdfd | ||
|
|
b9e08acc79 | ||
|
|
58e5f669c0 | ||
|
|
08626d4b1c | ||
|
|
3b69969e96 | ||
|
|
164f09fab2 | ||
|
|
8f256d3ee5 | ||
|
|
9ff7db4425 | ||
|
|
a87cea3989 | ||
|
|
6cad81b3f0 | ||
|
|
4965377084 | ||
|
|
593d258bf6 | ||
|
|
380980092a | ||
|
|
b395f97fc0 | ||
|
|
ccb881473c | ||
|
|
c3d3879f93 | ||
|
|
8d84070f07 | ||
|
|
705b5f1fcc | ||
|
|
d216ca01e9 | ||
|
|
02db68a418 | ||
|
|
5dd09e2ded | ||
|
|
4108d844a4 | ||
|
|
d50c11711c | ||
|
|
ceeda72692 | ||
|
|
30a7d8a091 | ||
|
|
868ea2e09e | ||
|
|
36f0033393 | ||
|
|
1879d9f615 | ||
|
|
d068ec5d0f | ||
|
|
e0a2a09284 | ||
|
|
6384655e67 | ||
|
|
195c000691 | ||
|
|
553a03fc5b | ||
|
|
16b7206ca6 | ||
|
|
9e1dd1c416 | ||
|
|
dcce675e30 | ||
|
|
9657bf7bed | ||
|
|
1b21bd2ac6 | ||
|
|
82b44e2844 | ||
|
|
25d2d618a0 | ||
|
|
6eb1699550 | ||
|
|
ff2cf9bcbd | ||
|
|
8a6fd6ef23 | ||
|
|
a33c7d3cde | ||
|
|
5cdf9d85ab | ||
|
|
b3c08e51a2 | ||
|
|
f8ad64e11a | ||
|
|
531ec45b9f | ||
|
|
83781a93c1 | ||
|
|
7fc41c3abd | ||
|
|
1d0728c1b0 | ||
|
|
9a59620ca9 | ||
|
|
caa7e6ebfb | ||
|
|
0025ce45a8 | ||
|
|
46036dc8cc | ||
|
|
178fb0de98 | ||
|
|
3e62fee14f | ||
|
|
f25fdd7b3c | ||
|
|
d91b1e3ac4 | ||
|
|
b35bdc5ae8 | ||
|
|
b091130c64 | ||
|
|
2ddf9ae15f | ||
|
|
9a8f7b8644 | ||
|
|
5fba946e7c | ||
|
|
e6a3bc342c | ||
|
|
a1c33ed26b | ||
|
|
51d374a343 | ||
|
|
2d4b8815ea | ||
|
|
9bb73dba24 | ||
|
|
9665371027 | ||
|
|
97740dbb7d | ||
|
|
356d973a7e | ||
|
|
62963fe29e | ||
|
|
b72b710d09 | ||
|
|
81c26cdf28 | ||
|
|
36cdeebf6b | ||
|
|
32907a7a09 | ||
|
|
27954fa89e | ||
|
|
a2e9a5664d | ||
|
|
71306fc976 | ||
|
|
f4da5629ff | ||
|
|
241fb296d5 | ||
|
|
8f069fdce5 | ||
|
|
77dc750c7e | ||
|
|
15f3f66bf1 | ||
|
|
0a07a49c74 | ||
|
|
0c747623b7 | ||
|
|
2a1fee6505 | ||
|
|
bc428500e6 | ||
|
|
f6bdb3ea4b | ||
|
|
ac6ae048b2 | ||
|
|
38ff25536e | ||
|
|
fe11dafadf | ||
|
|
e23c3f29bf | ||
|
|
edb5dcfa1e | ||
|
|
1ff1b067d3 | ||
|
|
aad71c84f5 | ||
|
|
290093a2de | ||
|
|
9426cce0cc | ||
|
|
b555ccd196 | ||
|
|
2d5bcbdec0 | ||
|
|
d77fde69c8 | ||
|
|
0d36ff250b | ||
|
|
63fedba1ab | ||
|
|
439adf6c1c | ||
|
|
f802a01651 | ||
|
|
d6e3267595 | ||
|
|
ed807e304b | ||
|
|
d806359a89 | ||
|
|
bdfaeac28d | ||
|
|
9121343202 | ||
|
|
4fc472e38d | ||
|
|
2bffc574a8 | ||
|
|
19bfbc11be | ||
|
|
1bcc9f1cad | ||
|
|
83da5706a4 | ||
|
|
03156a9c6b | ||
|
|
71ae99a0fc | ||
|
|
a389dd1b28 | ||
|
|
4bf1724534 | ||
|
|
df5a182ba2 | ||
|
|
a131e83391 | ||
|
|
0bc922f9e2 | ||
|
|
c44be54c7c | ||
|
|
671b9401c8 | ||
|
|
9c86df8e6f | ||
|
|
1235f885db | ||
|
|
a2c2b14947 | ||
|
|
f032a5b556 | ||
|
|
2e98926eda | ||
|
|
e8097c0551 | ||
|
|
2ec5e45cca | ||
|
|
4982edfcd1 | ||
|
|
cde1e44df3 | ||
|
|
9fd2e58c01 | ||
|
|
9987c63820 | ||
|
|
70f349f35e | ||
|
|
8767c1ac68 | ||
|
|
b08c6d0a0b | ||
|
|
c8c3921feb | ||
|
|
8cfadad239 | ||
|
|
e59db2de6f | ||
|
|
c61f63acb7 | ||
|
|
aec4fed2a5 | ||
|
|
e00bf6eecd | ||
|
|
4990287698 | ||
|
|
00c6261b3a | ||
|
|
1512a0e91f | ||
|
|
c4350e7355 | ||
|
|
f9caa1c7a4 | ||
|
|
a39fe52631 | ||
|
|
09a0834c9f | ||
|
|
fc606df338 | ||
|
|
67d914af33 | ||
|
|
da349eb24e | ||
|
|
abaea32d2a | ||
|
|
448dc8d3b8 | ||
|
|
b91c72b179 | ||
|
|
ac1dc924b2 | ||
|
|
fe40326e73 | ||
|
|
e8a3ec30ae | ||
|
|
094bb4201d | ||
|
|
470b35688a | ||
|
|
5826b2db26 | ||
|
|
fcb3f69499 | ||
|
|
1310ecaa40 | ||
|
|
e43fbae023 | ||
|
|
25404ad9b7 | ||
|
|
4e158777c5 | ||
|
|
25274a9302 | ||
|
|
5de11a30e0 | ||
|
|
3c612b4436 | ||
|
|
ba594f9c4e | ||
|
|
b1ccfbf2cb | ||
|
|
cc58507fe6 | ||
|
|
8eb1df7e77 | ||
|
|
6b5a045d56 | ||
|
|
0ffddbc6fc | ||
|
|
ee80602d45 | ||
|
|
251b36cc48 | ||
|
|
d6189207fb | ||
|
|
bb2ee1727c | ||
|
|
a1488fd260 | ||
|
|
26ea6b204e | ||
|
|
6f3d9686ff | ||
|
|
b50522bf09 | ||
|
|
9c91417984 | ||
|
|
bf8e3142a7 | ||
|
|
4f35badc67 | ||
|
|
d89b7859be | ||
|
|
e7da8565d8 | ||
|
|
4c6d515e62 | ||
|
|
0d094d0e94 | ||
|
|
efaad5f6b7 | ||
|
|
44c94e182e | ||
|
|
7b657af921 | ||
|
|
9ffde740e5 | ||
|
|
86c2cbdff0 | ||
|
|
6b7daa5a4d | ||
|
|
dc9b7ae8e6 | ||
|
|
541d556187 | ||
|
|
8618f140da | ||
|
|
27794c5374 | ||
|
|
d217b7e240 | ||
|
|
6657a7972c | ||
|
|
d9eab83605 | ||
|
|
185fec17e1 | ||
|
|
5cbdfaa09f | ||
|
|
05fb7de17c | ||
|
|
88909b3421 | ||
|
|
cc6733685e | ||
|
|
93463865a4 | ||
|
|
e8f2cbe207 | ||
|
|
0d53c393d3 | ||
|
|
ac21ccca71 | ||
|
|
77b9d33c13 | ||
|
|
db6a811671 | ||
|
|
a29f56a5bb | ||
|
|
4b50f30017 | ||
|
|
a707997e34 | ||
|
|
b3a210cd1e | ||
|
|
2332ba7a91 | ||
|
|
deb0520a71 | ||
|
|
9ca0720055 | ||
|
|
695ea2077f | ||
|
|
894ae89aa2 | ||
|
|
725b4a1c83 | ||
|
|
3d6427d106 | ||
|
|
15855ecd78 | ||
|
|
df17efc436 | ||
|
|
a176eb3324 | ||
|
|
8cf4b7ea11 | ||
|
|
7502c4df95 | ||
|
|
51afbba55f | ||
|
|
8bb729bd1c | ||
|
|
3f0cdbdcbb | ||
|
|
b0d0ec7a17 | ||
|
|
27d330959e | ||
|
|
e7dce0c508 | ||
|
|
738d43e66b | ||
|
|
8976584059 | ||
|
|
13ce8fb99d | ||
|
|
b79ac32224 | ||
|
|
1f9c94c11d | ||
|
|
f2724e95d2 | ||
|
|
9b2c2135fe | ||
|
|
31bdbeab96 | ||
|
|
74811a7572 | ||
|
|
97c011ae42 | ||
|
|
973e5a251c | ||
|
|
787897e5b2 | ||
|
|
d3ef2b9960 | ||
|
|
b4a38897e0 | ||
|
|
5577a28b2e | ||
|
|
bcf4a41883 | ||
|
|
291ad0fe8f | ||
|
|
60225e4407 | ||
|
|
5fdaece541 | ||
|
|
18b12cc9a6 | ||
|
|
b2d837f227 | ||
|
|
60d7fc3d9e | ||
|
|
44574040c9 | ||
|
|
b04c14f231 | ||
|
|
2868141ead | ||
|
|
c7a509b4c4 | ||
|
|
6d627b17a9 | ||
|
|
aff3c99799 | ||
|
|
3d6d5f033b | ||
|
|
b23fb9306f | ||
|
|
3c41ffc527 | ||
|
|
890d5950d9 | ||
|
|
9d70b8a44f | ||
|
|
b7bb577606 | ||
|
|
2d05e32546 | ||
|
|
8520b97d7e | ||
|
|
0fd8fbeb74 | ||
|
|
673510a73f | ||
|
|
f88ca076d9 | ||
|
|
264c89e73a | ||
|
|
c79eb9dae7 | ||
|
|
0359cc1b34 | ||
|
|
1626e788a5 | ||
|
|
cb68b6fd52 | ||
|
|
b3395d9245 | ||
|
|
ef3f9e1172 | ||
|
|
8cff64e186 | ||
|
|
bb20bd58fe | ||
|
|
ea4fe0d132 | ||
|
|
ed644eb8a2 | ||
|
|
9fa657f1cd | ||
|
|
2515e56733 | ||
|
|
6c1cd07151 | ||
|
|
84e8f15be8 | ||
|
|
0651d74925 | ||
|
|
de62055466 | ||
|
|
8b4df32034 | ||
|
|
86c4d6b330 | ||
|
|
cba57d37f8 | ||
|
|
dbea44a297 | ||
|
|
b2514605b7 | ||
|
|
42402c151f | ||
|
|
85ad9a0cc3 | ||
|
|
b9c68f8752 | ||
|
|
1a5577bf45 | ||
|
|
a4a77f537b | ||
|
|
a7340e4130 | ||
|
|
f4bb8917e9 | ||
|
|
e55ca3af54 | ||
|
|
d61c9d808b | ||
|
|
602be1d796 | ||
|
|
440fb513a8 | ||
|
|
a2f47085d8 | ||
|
|
18005aa7d3 | ||
|
|
3bfe97f6ae | ||
|
|
9bae32d0af | ||
|
|
d21edf21ce | ||
|
|
a32d0559d9 | ||
|
|
2c1fd05055 | ||
|
|
81bbe05843 | ||
|
|
84a8489317 | ||
|
|
de0f969f17 | ||
|
|
0280522e44 | ||
|
|
e8c541445e | ||
|
|
a25660a875 | ||
|
|
c73945b6db | ||
|
|
78e72763c3 | ||
|
|
068dca75e0 | ||
|
|
aaa4ececa4 | ||
|
|
bdf03fd66e | ||
|
|
d77f1e218b | ||
|
|
66be28aee8 | ||
|
|
09b18f8def | ||
|
|
42abec875e | ||
|
|
afd60f21c4 | ||
|
|
3a62701ffd | ||
|
|
ccdce1534d | ||
|
|
51b42e7d7f | ||
|
|
24aab1927c | ||
|
|
f3be45d7c8 | ||
|
|
761d3a57a7 | ||
|
|
7caf9f55c0 | ||
|
|
6ad0f36df3 | ||
|
|
eb5fcb11da | ||
|
|
59cdd44e91 | ||
|
|
d38f04a0de | ||
|
|
26fe6d94ef | ||
|
|
4734820f5e | ||
|
|
d990870f92 | ||
|
|
035dbecc72 | ||
|
|
07466e427f | ||
|
|
676b495b3b | ||
|
|
876070e49a | ||
|
|
7cd1814ce1 | ||
|
|
2ff21cbb92 | ||
|
|
cc0fbd5701 | ||
|
|
7856afc5f5 | ||
|
|
871d6e1256 | ||
|
|
0bb09d180a | ||
|
|
be298cb559 | ||
|
|
a78233e404 | ||
|
|
48114694b9 | ||
|
|
f07797ff89 | ||
|
|
9a12fbc335 | ||
|
|
d7c1521b25 | ||
|
|
33ba51e66e | ||
|
|
597564d30d | ||
|
|
d2bed3f2e6 | ||
|
|
97a92e9654 | ||
|
|
8bfb1b0ea5 | ||
|
|
8fec628485 | ||
|
|
1b6165e728 | ||
|
|
cd1b5f482d | ||
|
|
c62cab3c1c | ||
|
|
046d1b3137 | ||
|
|
1e4b7780ae | ||
|
|
8c7386c26d | ||
|
|
b44345d776 | ||
|
|
cfb7aadd23 | ||
|
|
f75212ebd7 | ||
|
|
c723f12fae | ||
|
|
7970da0074 | ||
|
|
b12270f7a4 | ||
|
|
8ecb08198f | ||
|
|
1ee6b0f859 | ||
|
|
dbdf46bac0 | ||
|
|
03e0833c46 | ||
|
|
808cd0c5e8 | ||
|
|
2a99fa3eec | ||
|
|
6b7b9e9d5f | ||
|
|
fb183a84d6 | ||
|
|
cd029f1060 | ||
|
|
aa852d9d5f | ||
|
|
acc0a4c42f | ||
|
|
d869a608e3 | ||
|
|
b6263abcb2 | ||
|
|
715a290cf3 | ||
|
|
333578da67 | ||
|
|
d5311703a3 | ||
|
|
511fc11d18 | ||
|
|
0dfbf00520 | ||
|
|
e245c83e46 | ||
|
|
241ac44a44 | ||
|
|
528c81f34d | ||
|
|
31ff53e050 | ||
|
|
1a4bf1168e | ||
|
|
f414ec2caa | ||
|
|
25d93ece07 | ||
|
|
f099924118 | ||
|
|
97ad980ef8 | ||
|
|
b20ae88f6e | ||
|
|
de356b636c | ||
|
|
49e10d72c2 | ||
|
|
904f0a8db8 | ||
|
|
173658e319 | ||
|
|
e2a6213ae5 | ||
|
|
cfd3e66915 | ||
|
|
59ed3f2c44 | ||
|
|
1b0240050c | ||
|
|
5b54e5e88e | ||
|
|
eac4ea696c | ||
|
|
cdc534310e | ||
|
|
8f52b49032 | ||
|
|
4a23ffb7c0 | ||
|
|
43b5d4b7db | ||
|
|
b3153b26eb | ||
|
|
c64e11a0a9 | ||
|
|
808504b58c | ||
|
|
cf3dc1bb47 | ||
|
|
d65a4b7c2e | ||
|
|
b99e4be772 | ||
|
|
f6fec96c61 | ||
|
|
b992d245b2 | ||
|
|
00b4ace39f | ||
|
|
7d7ff306c9 | ||
|
|
8db2d22f8c | ||
|
|
7d4548b287 | ||
|
|
d4fe2c881e | ||
|
|
6ead812d57 | ||
|
|
6d1c6d1bbb | ||
|
|
ffcbfd29ed | ||
|
|
529f1a6e89 | ||
|
|
776778a4e9 | ||
|
|
3bf2906008 | ||
|
|
1d7b7cc35f | ||
|
|
dfec82a91e | ||
|
|
f185064ad5 | ||
|
|
f016ee02dd | ||
|
|
496a86a52e | ||
|
|
45b13b6cd8 | ||
|
|
3dd4db16f3 | ||
|
|
5ec0842b15 | ||
|
|
0d31dfb055 | ||
|
|
20928e2f2f | ||
|
|
d1b0fc8671 | ||
|
|
31ac27e4b3 | ||
|
|
6d64e80bcf | ||
|
|
a540f3abb5 | ||
|
|
6e76a83ac1 | ||
|
|
f1373f1125 | ||
|
|
6b0fd5931e | ||
|
|
3b02feee33 | ||
|
|
88e6415d9d | ||
|
|
2b4c6ba14b | ||
|
|
418dacce26 | ||
|
|
5a1992b769 | ||
|
|
7b539e04c1 | ||
|
|
825b7a047e | ||
|
|
5bb50d6aef | ||
|
|
f0adddf504 | ||
|
|
af7648689a | ||
|
|
7ddcbc84f8 | ||
|
|
0b93ab7cbc | ||
|
|
f61263f8d5 | ||
|
|
6e6e6ca4b3 | ||
|
|
b780374eb1 | ||
|
|
4b1e140f04 | ||
|
|
1a03b8495a | ||
|
|
c80ddcea50 | ||
|
|
df81ce875a | ||
|
|
4ca8ffb4a0 | ||
|
|
70eb75cdf7 | ||
|
|
03382a69d3 | ||
|
|
c8c8c84081 | ||
|
|
4e6ca763db | ||
|
|
50e2ee0edc | ||
|
|
3a2272eeab | ||
|
|
25cb4be46b | ||
|
|
d014dde2e9 | ||
|
|
e5bece7999 | ||
|
|
8b87450c15 | ||
|
|
8f13530af7 | ||
|
|
2415a388e9 | ||
|
|
f7d8867614 | ||
|
|
18c527db8b | ||
|
|
a8ccfeed71 | ||
|
|
1bdb9de7c9 | ||
|
|
920378fb5c | ||
|
|
d8e6e4adad | ||
|
|
30a4816649 | ||
|
|
ae53f26d09 | ||
|
|
e1b7ac4778 | ||
|
|
9137d08f83 | ||
|
|
e942080024 | ||
|
|
42dd74faac | ||
|
|
7e7ce110f6 | ||
|
|
b6347939dc | ||
|
|
3d40328ce3 | ||
|
|
8f477e107c | ||
|
|
dd95483fa9 | ||
|
|
67117f4462 | ||
|
|
6091757cc9 | ||
|
|
158ecd8ad0 | ||
|
|
15c00476d8 | ||
|
|
9122a0e601 | ||
|
|
e4043dfa1f | ||
|
|
470f565fca | ||
|
|
faab68f22f | ||
|
|
e3e35db9fb | ||
|
|
3e33e68483 | ||
|
|
a294cc1e69 | ||
|
|
d3c89cc900 | ||
|
|
5890e4382e | ||
|
|
0ce9282c91 | ||
|
|
1af8daed16 | ||
|
|
94326902b5 | ||
|
|
8c5a276242 | ||
|
|
8126a709e4 | ||
|
|
ca7d9cc33f | ||
|
|
d31a9791a1 | ||
|
|
15866b1a89 | ||
|
|
7d4a259df8 | ||
|
|
21b898d10b | ||
|
|
51e47874c2 | ||
|
|
4d5993fe17 | ||
|
|
7840169464 | ||
|
|
98844f1be8 | ||
|
|
ca29e7ca98 | ||
|
|
5ac964af00 | ||
|
|
2b02b39ceb | ||
|
|
ba50b1c89a | ||
|
|
786e4dd0b1 | ||
|
|
cb05e352b7 | ||
|
|
cfa7687b61 | ||
|
|
b7349481be | ||
|
|
31fc60ce77 | ||
|
|
9a1bc91b7b | ||
|
|
5ed31407d0 | ||
|
|
aaad72e62b | ||
|
|
3f1ae69363 | ||
|
|
6a8510cacd | ||
|
|
e9805c93b9 | ||
|
|
8d5b613eae | ||
|
|
3274ebedee | ||
|
|
d76066a87d | ||
|
|
cc097bbbeb | ||
|
|
5e3dd51c10 | ||
|
|
c49195ca12 | ||
|
|
60839ca9f0 | ||
|
|
99d2180703 | ||
|
|
96ed7ccb65 | ||
|
|
6acfd0d21a | ||
|
|
53a0d10ada | ||
|
|
de4749ed2d | ||
|
|
b49d4807c2 | ||
|
|
c342abbc24 | ||
|
|
d88198c611 | ||
|
|
f9eaf3c60a | ||
|
|
5b5a7fceed | ||
|
|
bf59314603 | ||
|
|
3556911209 | ||
|
|
ab12b7120b | ||
|
|
880554ca4a | ||
|
|
61439bc35d | ||
|
|
9f7baabe03 | ||
|
|
89936f90c1 | ||
|
|
70d7d30f1f | ||
|
|
3f67e90cfa | ||
|
|
8927ab3543 | ||
|
|
1d49a46490 | ||
|
|
bc0bb540b2 | ||
|
|
96ebf59e98 | ||
|
|
8b8a3d10d9 | ||
|
|
45f0d7e16b | ||
|
|
13685c4207 | ||
|
|
df2ab252df | ||
|
|
9263333b38 | ||
|
|
4539b31777 | ||
|
|
5bda0c3c44 | ||
|
|
f4565bc7e0 | ||
|
|
4b378b8424 | ||
|
|
c69f7c3a79 | ||
|
|
d636483ce1 | ||
|
|
4d1a22a0cd | ||
|
|
0a8fabd24d | ||
|
|
7bb1f6a366 | ||
|
|
ad5a4b8c26 | ||
|
|
d88c9cb7b5 | ||
|
|
6787f30517 | ||
|
|
fa79d48cb8 | ||
|
|
dce3701681 | ||
|
|
e9729d5fa7 | ||
|
|
caa82bfddf | ||
|
|
277d41c869 | ||
|
|
9e996f56c1 | ||
|
|
7c205e89a6 | ||
|
|
c789b01482 | ||
|
|
bbde074e9c | ||
|
|
28fb4a4098 | ||
|
|
9e41c72286 | ||
|
|
140c7e5320 | ||
|
|
a96aa7635a | ||
|
|
a1699313df | ||
|
|
b9d64fd014 | ||
|
|
d0279f6448 | ||
|
|
94d9ca04a4 | ||
|
|
1074533a29 | ||
|
|
1b65483f3d | ||
|
|
8e9a8c614c | ||
|
|
49ce8b7af6 | ||
|
|
33517602f4 | ||
|
|
88a1bebc2d | ||
|
|
50b474b6ca | ||
|
|
fc42d987f5 | ||
|
|
4aea0e4591 | ||
|
|
b107f3ff5f | ||
|
|
fe8ca33e54 | ||
|
|
ff337e0bcf | ||
|
|
13032feb73 | ||
|
|
44e2c52b71 | ||
|
|
272c49ce25 | ||
|
|
d5e9d118e8 | ||
|
|
bea8b36d30 | ||
|
|
e31cdb658c | ||
|
|
232833d976 | ||
|
|
f61b9e4e2c | ||
|
|
eeee4b8742 | ||
|
|
f3ae59e0dc | ||
|
|
bc3540ff1f | ||
|
|
39ea807596 | ||
|
|
550e39bc3f | ||
|
|
700229a0c8 | ||
|
|
172d3dff29 | ||
|
|
b24e7a54c2 | ||
|
|
9ccbf5cd10 | ||
|
|
63a7148402 | ||
|
|
e60a5e69a0 | ||
|
|
fd0967d82d | ||
|
|
9d6ed1acd1 | ||
|
|
4a3535ba8c | ||
|
|
683aa00a09 | ||
|
|
6887e9c19b | ||
|
|
6965052726 | ||
|
|
6bdf651869 | ||
|
|
69716a5420 | ||
|
|
903194d323 | ||
|
|
0f19fc9969 | ||
|
|
c968553b7b | ||
|
|
3cb33c262c | ||
|
|
87dc1cc6ee | ||
|
|
2cf3ef8364 | ||
|
|
3bea8a58da | ||
|
|
51e8cd340a | ||
|
|
035844cfd4 | ||
|
|
953def32a1 | ||
|
|
4e7663b8a1 | ||
|
|
8df3e4e189 | ||
|
|
568ec15d4b | ||
|
|
e85b8bf567 | ||
|
|
7fcc669c9f | ||
|
|
1aabf0d874 | ||
|
|
f5640e99cc | ||
|
|
ff81518a01 | ||
|
|
1428a5f294 | ||
|
|
ab80253df8 | ||
|
|
26dca291ba | ||
|
|
21ab7d7658 | ||
|
|
e0e4b3441d | ||
|
|
00a3bf5489 | ||
|
|
9367200d77 | ||
|
|
af0519c458 | ||
|
|
2bd7ccb0bc | ||
|
|
450a22a4e5 | ||
|
|
a9a6cc18f2 | ||
|
|
b33c5867ca | ||
|
|
26caf1493e | ||
|
|
e409a39d42 | ||
|
|
e8fa0f763a | ||
|
|
12db48d604 | ||
|
|
c586bf3853 | ||
|
|
a8f3a40dd5 | ||
|
|
b2cc1c94a9 | ||
|
|
a2cd208220 | ||
|
|
1d6893c5d6 | ||
|
|
729a65b427 | ||
|
|
06273f3e18 | ||
|
|
d37bad750e | ||
|
|
ca1fe19bc5 | ||
|
|
826823aac4 | ||
|
|
81875197e5 | ||
|
|
9a06ab2845 | ||
|
|
cf5fed74bf | ||
|
|
1db35b5b8b | ||
|
|
be1ad1ef21 | ||
|
|
7572092c58 | ||
|
|
900923f1d5 | ||
|
|
44eb385e39 | ||
|
|
d186ab03c3 | ||
|
|
b9a8678ef3 | ||
|
|
9237895767 | ||
|
|
c531723e6b | ||
|
|
db6c4b47ae | ||
|
|
0a2f8614d5 | ||
|
|
fd24b907ee | ||
|
|
c9804c58b2 | ||
|
|
3c48368900 | ||
|
|
61451beb94 | ||
|
|
39a364f3bd | ||
|
|
f39e05af9c | ||
|
|
1e8145add6 | ||
|
|
d4c70acfcd | ||
|
|
78e7ccf835 | ||
|
|
05c1c8cf2b | ||
|
|
b5d64a3bd7 | ||
|
|
045efe9859 | ||
|
|
b503688549 | ||
|
|
41acdb82ce | ||
|
|
8f2f7cd80e | ||
|
|
cb9de0c698 | ||
|
|
adcf7dec28 | ||
|
|
38316cfc04 | ||
|
|
bb5fc949ce | ||
|
|
9b0caa0935 | ||
|
|
4b87878cfc | ||
|
|
96865287f8 | ||
|
|
22ffe2834a | ||
|
|
2307fb399c | ||
|
|
a16ac54d91 | ||
|
|
542db19a81 | ||
|
|
f3eb497401 | ||
|
|
102bb841c5 | ||
|
|
83c4a6d031 | ||
|
|
5a89992443 | ||
|
|
d31f977574 | ||
|
|
1399c5a761 | ||
|
|
109ad2d952 | ||
|
|
d5064110de | ||
|
|
812fff3d93 | ||
|
|
f3e8fde0bc | ||
|
|
6eac26b10a | ||
|
|
e0700bf12e | ||
|
|
d4cec0c5b6 | ||
|
|
2697828429 | ||
|
|
e2ebe1083a | ||
|
|
494a5a9c7f | ||
|
|
681b9a073d | ||
|
|
e5e47baab4 | ||
|
|
627c0648c5 | ||
|
|
d7aa412329 | ||
|
|
9e7dcf7456 | ||
|
|
d2e517703b | ||
|
|
4d154c3191 | ||
|
|
8198941775 | ||
|
|
d642a1682f | ||
|
|
fe17c38722 | ||
|
|
f6c820a726 | ||
|
|
49236da5af | ||
|
|
cfcc495edd | ||
|
|
f40e891d2e | ||
|
|
230de8a1d0 | ||
|
|
c16ef3cc46 | ||
|
|
945689663d | ||
|
|
4c1e30e7e9 | ||
|
|
34ab24aee7 | ||
|
|
11424c77ce | ||
|
|
8d5d98c14c | ||
|
|
9e069eda42 | ||
|
|
386e43e682 | ||
|
|
6a0120def8 | ||
|
|
0130b3e5e7 | ||
|
|
e754398f43 | ||
|
|
f451cd56d0 | ||
|
|
13c14e71dc | ||
|
|
7286e61a81 | ||
|
|
16c48f9997 | ||
|
|
d9586d10bf | ||
|
|
179e6091df | ||
|
|
982d8bc3ce | ||
|
|
ee2a33c3e7 | ||
|
|
af484cf8c1 | ||
|
|
4fc04efa20 | ||
|
|
66a0ddd60e | ||
|
|
527a6dc707 | ||
|
|
3209d57c40 | ||
|
|
87379c9ed6 | ||
|
|
c62cc9846a | ||
|
|
ffd6d2464c | ||
|
|
a563d78680 | ||
|
|
920aad1008 | ||
|
|
ebc52d7f5d | ||
|
|
cdc2f70ba3 | ||
|
|
dccc8fd327 | ||
|
|
f5982912e8 | ||
|
|
ac8f7c0dbe | ||
|
|
4fd5aa4c9b | ||
|
|
e1b6f54c84 | ||
|
|
45983322a0 | ||
|
|
d1e473899c | ||
|
|
82d33c367c | ||
|
|
ce51b4a0c0 | ||
|
|
625390fee2 | ||
|
|
bd3b2362de | ||
|
|
d1dc80e886 | ||
|
|
c2482c13ca | ||
|
|
df55a6d2bc | ||
|
|
e36d2726ae | ||
|
|
4287100562 | ||
|
|
6e995249d3 | ||
|
|
7c3fe87ade | ||
|
|
ba936cd8da | ||
|
|
ba42190e0e | ||
|
|
1f6f5fe04c | ||
|
|
e694a6731e | ||
|
|
b849f414a1 | ||
|
|
e473fcc042 | ||
|
|
946ef71be0 | ||
|
|
53a335fdad | ||
|
|
33689dfd59 | ||
|
|
6548900594 | ||
|
|
3424c89ae7 | ||
|
|
8080f7ed08 | ||
|
|
d413f7ff84 | ||
|
|
4cff45ba81 | ||
|
|
3cf293a461 | ||
|
|
2262937e5a | ||
|
|
875d82eb8b | ||
|
|
549b132ccf | ||
|
|
d64b75d92f | ||
|
|
adb8235004 | ||
|
|
261b203e93 | ||
|
|
bd3e898b0f | ||
|
|
3a5dc6638b | ||
|
|
b44272a4b6 | ||
|
|
22a3ac7b5d | ||
|
|
ba282cee02 | ||
|
|
b15c2f3a6a | ||
|
|
a3e274d547 | ||
|
|
cfed15f5a1 | ||
|
|
1ef0f2b114 | ||
|
|
64c527337e | ||
|
|
806664bf2f | ||
|
|
6543af6118 | ||
|
|
8ab2d40e28 | ||
|
|
935c352464 | ||
|
|
2032d7ea0e | ||
|
|
e684d2c9fb | ||
|
|
0b585584c0 | ||
|
|
9f6d3ccbcd | ||
|
|
e6eaf8d034 | ||
|
|
8fc4db8e02 | ||
|
|
36b3abd0b7 | ||
|
|
97f14393e2 | ||
|
|
954581891c | ||
|
|
03cfc7b0c1 | ||
|
|
4a8f7cbfff | ||
|
|
bf4e5f0701 | ||
|
|
000d6c680a | ||
|
|
4d9f5aa998 | ||
|
|
43ff612126 | ||
|
|
35632b4854 | ||
|
|
82ec728b2e | ||
|
|
29184b7168 | ||
|
|
6d4b4d4811 | ||
|
|
c8a09afc79 | ||
|
|
21f799f4aa | ||
|
|
50bd55ad31 | ||
|
|
6b4f2b4556 | ||
|
|
4ad12e2b43 | ||
|
|
d67fde2f7b | ||
|
|
622ecf848f | ||
|
|
b817a0c350 | ||
|
|
3a587b0994 | ||
|
|
c5f299bb17 | ||
|
|
4dc31dd004 | ||
|
|
5aabd75eb9 | ||
|
|
f587699256 | ||
|
|
63966e72a1 | ||
|
|
8a36bac6ec | ||
|
|
72a7a10695 | ||
|
|
22c9da9e08 | ||
|
|
ad8d545a12 | ||
|
|
efe58c7e15 | ||
|
|
6bc9c31751 | ||
|
|
72e0246d22 | ||
|
|
49b85bad39 | ||
|
|
e15bf8d5b3 | ||
|
|
bf74c53128 | ||
|
|
4d6baf3127 | ||
|
|
c3dba05587 | ||
|
|
59e0fc311d | ||
|
|
f7e967bab3 | ||
|
|
ebd96f120a | ||
|
|
bcba23cde6 | ||
|
|
0f6e9610d9 | ||
|
|
1dc85d9aae | ||
|
|
ccf7a6958c | ||
|
|
f6b7b3c133 | ||
|
|
5fcf54179f | ||
|
|
1d49253539 | ||
|
|
bf01395d38 | ||
|
|
4476482cdf | ||
|
|
782c003d39 | ||
|
|
682a6abf95 | ||
|
|
f5d497db18 | ||
|
|
7b03cb6e0a | ||
|
|
e8fd8a0243 | ||
|
|
987c64e883 | ||
|
|
185d258505 | ||
|
|
77f1389dad | ||
|
|
6455b748ce | ||
|
|
18b8424048 | ||
|
|
550819608b | ||
|
|
e185151db4 | ||
|
|
ee1160133e | ||
|
|
7a0c84b0d7 | ||
|
|
75d3e8bd33 | ||
|
|
aed511448c | ||
|
|
d167e9cdcc | ||
|
|
f57e02d7a3 | ||
|
|
e6a2e1cf5a | ||
|
|
f00f50ca57 | ||
|
|
3d129fc62e | ||
|
|
42a4f6989e | ||
|
|
90bd3f735d | ||
|
|
d2826aadde | ||
|
|
37f920f2f4 | ||
|
|
bf63049426 | ||
|
|
c285c2a054 | ||
|
|
d05dc6672e | ||
|
|
852772fd1e | ||
|
|
f045e89f17 | ||
|
|
d4c745fe80 | ||
|
|
92d963eb95 | ||
|
|
c272597c8d | ||
|
|
6811fc7dd2 | ||
|
|
9cbf791d1b | ||
|
|
9fdc80108a | ||
|
|
0436606d70 | ||
|
|
bd44d38f50 | ||
|
|
d73857d012 | ||
|
|
e3a8dd5b19 | ||
|
|
3f44cd882f | ||
|
|
6daa7ee45b | ||
|
|
c5821080ae | ||
|
|
648549395e | ||
|
|
83078e0ec9 | ||
|
|
03c607e36e | ||
|
|
924b9331b8 | ||
|
|
2ffd301c8f | ||
|
|
54ed2ee67b | ||
|
|
e7ea77be43 | ||
|
|
fa2a350c00 | ||
|
|
d89cdb82df | ||
|
|
b9c0a0d62e | ||
|
|
ca5cb29a3a | ||
|
|
3c3bd603ac | ||
|
|
0696776d48 | ||
|
|
04138ad36b | ||
|
|
9d75231c68 | ||
|
|
3e5a68ce2e | ||
|
|
91de97c45a | ||
|
|
8c63097a16 | ||
|
|
2013f75d00 | ||
|
|
7e3e89d823 | ||
|
|
54660f782b | ||
|
|
ef085d6975 | ||
|
|
59cb70fb38 | ||
|
|
3021373294 | ||
|
|
500f552216 | ||
|
|
981c4fe060 | ||
|
|
ceb16bb530 | ||
|
|
c12314a1d9 | ||
|
|
347f4d138c | ||
|
|
6033bb3d25 | ||
|
|
517bb6bb0f | ||
|
|
b149c17fca | ||
|
|
0bbeb690f4 | ||
|
|
d12ab11774 | ||
|
|
c91e7ceb95 | ||
|
|
ae6cee7e1d | ||
|
|
cdb32d5be1 | ||
|
|
d2322fe3e0 | ||
|
|
29e40832a1 | ||
|
|
8269026170 | ||
|
|
88785583e9 | ||
|
|
a86f7d12bd | ||
|
|
77676ae8e3 | ||
|
|
037cd41e70 | ||
|
|
b55fb0c9b8 | ||
|
|
7fa28e784c | ||
|
|
9aadcd7d36 | ||
|
|
67386102eb | ||
|
|
4c7a5176ae | ||
|
|
92e296c7a3 | ||
|
|
d15b0ee243 | ||
|
|
35a70b209f | ||
|
|
0b7c44cf64 | ||
|
|
631f5753e7 | ||
|
|
b2652e371a | ||
|
|
4c5875b260 | ||
|
|
bb7af52dc5 | ||
|
|
3c2fe97915 | ||
|
|
5ab4beb396 | ||
|
|
dffd5c30a4 | ||
|
|
541d289dca | ||
|
|
694146845a | ||
|
|
5cf1971359 | ||
|
|
921b8f7203 | ||
|
|
05cf7e0f08 | ||
|
|
e07a5aac0d | ||
|
|
9e5f16a423 | ||
|
|
028c2f6349 | ||
|
|
08b3c35f73 | ||
|
|
8102c58fcf | ||
|
|
ee1ce1b913 | ||
|
|
84da80ad5b | ||
|
|
be66fa8586 | ||
|
|
6f132223fd | ||
|
|
0936aaafab | ||
|
|
b9a5d1bd70 | ||
|
|
824f0726f6 | ||
|
|
d6149be79b | ||
|
|
eed58ed70c | ||
|
|
1f90046a7a | ||
|
|
d070060a8b | ||
|
|
183fd36b13 | ||
|
|
95b91a41b3 | ||
|
|
b895beb345 | ||
|
|
27ce86ed83 | ||
|
|
f74b43d420 | ||
|
|
fca9f5829c | ||
|
|
c7f7d6d46f | ||
|
|
6cd0e93bd6 | ||
|
|
4196cd6f6a | ||
|
|
ab0c37f2d5 | ||
|
|
90ebc6a542 | ||
|
|
1371ded278 | ||
|
|
fcb56ad562 | ||
|
|
39e009be59 | ||
|
|
10c21f251a | ||
|
|
f72a4759a1 | ||
|
|
39e40a3b97 | ||
|
|
80b0a1b7b6 | ||
|
|
75167692eb | ||
|
|
7b6dce0667 | ||
|
|
4c4c8e8cf0 | ||
|
|
47b788417e | ||
|
|
0c4e433840 | ||
|
|
cacadcb27e | ||
|
|
9304b71258 | ||
|
|
fa53d002d0 | ||
|
|
bbb58ca1fa | ||
|
|
567de02380 | ||
|
|
715fb9dff4 | ||
|
|
2018e8127d | ||
|
|
be61bd35ae | ||
|
|
938b04adf8 | ||
|
|
a012aa82bb | ||
|
|
10e234ecff | ||
|
|
56beb52d71 | ||
|
|
cfe8d25785 | ||
|
|
7e1914e5a3 | ||
|
|
d3a20c6971 | ||
|
|
5eeb03c1b1 | ||
|
|
295477a2b1 | ||
|
|
a3e5db59a5 | ||
|
|
0a6258d937 | ||
|
|
a61b13d03d | ||
|
|
d6f5fd7585 | ||
|
|
c9e02358c5 | ||
|
|
cbc1e28355 | ||
|
|
36b71dc717 | ||
|
|
3a3f0910f6 | ||
|
|
1a03c21ebc | ||
|
|
779bc50404 | ||
|
|
2fe2d65f55 | ||
|
|
b8e31941f7 | ||
|
|
18c580bc5b | ||
|
|
7feb262936 | ||
|
|
3d09c3f0f1 | ||
|
|
35b619dcfb | ||
|
|
62fd4f3cd1 | ||
|
|
e92c7a3168 | ||
|
|
2816ad1409 | ||
|
|
f572ed437c | ||
|
|
f756f64f68 | ||
|
|
0dc31886a5 | ||
|
|
59a43ebc4a | ||
|
|
03e38ac256 | ||
|
|
e2a8691944 | ||
|
|
8fb171e224 | ||
|
|
1bd20db9ee | ||
|
|
1c26f895cf | ||
|
|
73eca453b3 | ||
|
|
9a44e087b9 | ||
|
|
4295a1be94 | ||
|
|
79b2fc754f | ||
|
|
a170448c56 | ||
|
|
cbeb518f09 | ||
|
|
2fcbb3d484 | ||
|
|
09020054b2 | ||
|
|
52833bcc28 | ||
|
|
b878e40ce3 | ||
|
|
8643eb4ce2 | ||
|
|
3c786fb189 | ||
|
|
210bd09a52 | ||
|
|
0c7a6dba2f | ||
|
|
46590e39b1 | ||
|
|
191038a9c7 | ||
|
|
c17820c113 | ||
|
|
5799eb1281 | ||
|
|
5348db8337 | ||
|
|
30fec46b94 | ||
|
|
5ef540aa99 | ||
|
|
8abff6d9ea | ||
|
|
35092829c6 | ||
|
|
f1649d72c8 | ||
|
|
77b2c9fc99 | ||
|
|
bc1e33c0b7 | ||
|
|
4f3cf73728 | ||
|
|
31502c57bf | ||
|
|
8f973778e6 | ||
|
|
f74659b698 | ||
|
|
2eea7163c1 | ||
|
|
2aa21dfc54 | ||
|
|
be938b9f54 | ||
|
|
0a8183cbbc | ||
|
|
edda96567b | ||
|
|
2d39335447 | ||
|
|
fb9a6ccac8 | ||
|
|
7e519d5539 | ||
|
|
fdecaeb193 | ||
|
|
d8ac2ec504 | ||
|
|
daf83bdd00 | ||
|
|
fdca415176 | ||
|
|
f91eecfc31 | ||
|
|
a7e76cba1e | ||
|
|
1c55624db7 | ||
|
|
31b2daed5b | ||
|
|
bbea40757c | ||
|
|
456b4926a3 | ||
|
|
ee9743eaa0 | ||
|
|
9dce5cdd41 | ||
|
|
663b81fdc9 | ||
|
|
ca5f471f8c | ||
|
|
5e84210ede | ||
|
|
6db4c21183 | ||
|
|
b4054fc6e1 | ||
|
|
94ceaa6e02 | ||
|
|
e4611a109d | ||
|
|
f86529f366 | ||
|
|
9c9491d705 | ||
|
|
c6ffe5be9e | ||
|
|
4936231e96 | ||
|
|
32e24c9a6b | ||
|
|
871500c5fb | ||
|
|
a00bfe3af3 | ||
|
|
8247c131cf | ||
|
|
d39122eaa9 | ||
|
|
93ee43a3b2 | ||
|
|
dfa2be9fb0 | ||
|
|
2d16b139c1 | ||
|
|
17c637de9c | ||
|
|
304b246cd7 | ||
|
|
a19b3f04d7 | ||
|
|
0949b8480e | ||
|
|
fd6ba38987 | ||
|
|
a7a75e6247 | ||
|
|
fe4224121c | ||
|
|
d16423e5ac | ||
|
|
265a8fe58e | ||
|
|
9317eafd78 | ||
|
|
fffdd002e3 | ||
|
|
1e93fc82f0 | ||
|
|
7db04928fa | ||
|
|
c4d125ce10 | ||
|
|
1295355d58 | ||
|
|
e9ad5c6159 | ||
|
|
fc694d48d6 | ||
|
|
6f2ba32ac7 | ||
|
|
fc583448ec | ||
|
|
beb37045dd | ||
|
|
6a30ab69bc | ||
|
|
8522336ba5 | ||
|
|
f0dfec4018 | ||
|
|
f5243ef44d | ||
|
|
636acbf636 | ||
|
|
bb418e190d | ||
|
|
d639a6b9e5 | ||
|
|
c907c41044 | ||
|
|
7e97a9a53e | ||
|
|
27c3a53d86 | ||
|
|
d23d22e2b2 | ||
|
|
ec7629c39d | ||
|
|
c93415dafe | ||
|
|
748326eaa9 | ||
|
|
ccc6160631 | ||
|
|
857dbbc5aa | ||
|
|
ae0c89be06 | ||
|
|
1a04fad712 | ||
|
|
6b05b3cdda | ||
|
|
4b5799a85f | ||
|
|
f729b6d30d | ||
|
|
d5fd8b4694 | ||
|
|
ef33586f26 | ||
|
|
f3f1b0967d | ||
|
|
fcaa168617 | ||
|
|
b77a0092b0 | ||
|
|
c7db5c436c | ||
|
|
08e2ef909b | ||
|
|
261a55a1c8 | ||
|
|
5642501713 | ||
|
|
ebe5e797da | ||
|
|
583933ee4a | ||
|
|
aced343c0e | ||
|
|
42f3cc729e | ||
|
|
a115330a77 | ||
|
|
54b30300fd | ||
|
|
a7068c6c76 | ||
|
|
bf9cba45c8 | ||
|
|
96e608f403 | ||
|
|
ade61276ef | ||
|
|
27150a7d9b | ||
|
|
7f75428039 | ||
|
|
6e2657c80d | ||
|
|
06d629161c | ||
|
|
f33d9bcf53 | ||
|
|
908a9f11cd | ||
|
|
2b86a5133b | ||
|
|
18a9dd200b | ||
|
|
39798b7242 | ||
|
|
a5847decdf | ||
|
|
001d319b8f | ||
|
|
c62bb3e4a4 | ||
|
|
ce8becf019 | ||
|
|
f1fa39e7cf | ||
|
|
ca46902629 | ||
|
|
33e1ca7b34 | ||
|
|
ff5fe9c747 | ||
|
|
c4fbb3db2d | ||
|
|
372b885e48 | ||
|
|
794459d7ab | ||
|
|
119f0123c6 | ||
|
|
71879c4632 | ||
|
|
c87dc992a2 | ||
|
|
1ad1dd7eb8 | ||
|
|
c2b7625d96 | ||
|
|
8f90cce6cf | ||
|
|
b316d44505 | ||
|
|
dfdfbff135 | ||
|
|
99b86269f5 | ||
|
|
95fe621a31 | ||
|
|
ff939ae778 | ||
|
|
6639b8e53d | ||
|
|
508f310979 | ||
|
|
f92de3604f | ||
|
|
ca45affe0e | ||
|
|
b3ec199cf9 | ||
|
|
343aaed877 | ||
|
|
c7d80ca433 | ||
|
|
19e9099419 | ||
|
|
0c43179e88 | ||
|
|
3ca6e4b226 | ||
|
|
cb624658c8 | ||
|
|
6974ebcd01 | ||
|
|
b44d0250e0 | ||
|
|
c7db105d38 | ||
|
|
3c12484182 | ||
|
|
8fb58dd36a | ||
|
|
5fecfa369a | ||
|
|
a1a9778a54 | ||
|
|
1848238279 | ||
|
|
bd8e3fb30a | ||
|
|
2398d7fa35 | ||
|
|
dc51414c3b | ||
|
|
94cd8c723d | ||
|
|
faf956415b | ||
|
|
a6db24f0bb | ||
|
|
f75329eb51 | ||
|
|
51985fa46e | ||
|
|
10ef096dc9 | ||
|
|
000e97ba98 | ||
|
|
dd3116b06a | ||
|
|
d11f4e1a66 | ||
|
|
55ae4a6a68 | ||
|
|
dbdf54d6c8 | ||
|
|
6524533d08 | ||
|
|
23be909bad | ||
|
|
504a7f4b03 | ||
|
|
2821d0ffd0 | ||
|
|
59ba8a2b21 | ||
|
|
09ff59d528 | ||
|
|
0326272d76 | ||
|
|
818b6dc505 | ||
|
|
6d8f25188b | ||
|
|
d9ce7addbc | ||
|
|
ddbfa3ac95 | ||
|
|
6d46d88a6d | ||
|
|
e9d2e2d814 | ||
|
|
82ece3a6a1 | ||
|
|
1310a72d4b | ||
|
|
425572a3d4 | ||
|
|
038a069997 | ||
|
|
76578e3157 | ||
|
|
7dc235b13a | ||
|
|
db654a3217 | ||
|
|
76def6cbf1 | ||
|
|
f3ff251808 | ||
|
|
f0af3bbb2f | ||
|
|
a902201936 | ||
|
|
d1a74f2540 | ||
|
|
163180b9f8 | ||
|
|
ebca89a38b | ||
|
|
16a73d5175 | ||
|
|
f4b93b8d86 | ||
|
|
c9940e6ffc | ||
|
|
5a7efee8ce | ||
|
|
76723bad63 | ||
|
|
bc9b1d0a0b | ||
|
|
ad08827f71 | ||
|
|
b8319b56e2 | ||
|
|
fd4ef985aa | ||
|
|
bbcd57a6e5 | ||
|
|
690b4a1e3d | ||
|
|
718405f625 | ||
|
|
b31452915c | ||
|
|
fbaca24345 | ||
|
|
857da77e99 | ||
|
|
8a0ea8c8e5 | ||
|
|
e55dfb384a | ||
|
|
ec89277669 | ||
|
|
1045f00b64 | ||
|
|
88d070913b | ||
|
|
a1fefe68af | ||
|
|
f68730e139 | ||
|
|
554699a6de | ||
|
|
e3170de294 | ||
|
|
92fe339798 | ||
|
|
9a331a35e3 | ||
|
|
fb2ed38d7d | ||
|
|
0a54064701 | ||
|
|
20a3f30741 | ||
|
|
366e7767bd | ||
|
|
388e7fbe08 | ||
|
|
2e4a599787 | ||
|
|
e04582ee1c | ||
|
|
06ac68160f | ||
|
|
056416500b | ||
|
|
3f41a4b14f | ||
|
|
498b94f15b | ||
|
|
0e8f8e697a | ||
|
|
ace8035d8e | ||
|
|
a0667ae8a0 | ||
|
|
1d1743caf8 | ||
|
|
770d7cb462 | ||
|
|
1e86862662 | ||
|
|
b19fe053b7 | ||
|
|
2b15cf20b5 | ||
|
|
54e8f7f0dc | ||
|
|
cbe950af61 | ||
|
|
876fb99ca4 | ||
|
|
fabcfafca1 | ||
|
|
45bf4315ea | ||
|
|
ba34f37296 | ||
|
|
b1afc461a2 | ||
|
|
3432fb100d | ||
|
|
6f9fac33b3 | ||
|
|
9c2acfa2d6 | ||
|
|
264b160f08 | ||
|
|
3717f373dc | ||
|
|
30747ccccd | ||
|
|
0f6cad9a9c | ||
|
|
f42995b78a | ||
|
|
a8a7776b6a | ||
|
|
debf6e4d7b | ||
|
|
c48b7658a3 | ||
|
|
7e38f58799 | ||
|
|
ee56dc5d07 | ||
|
|
b5d7f8dc4e | ||
|
|
ec49a9e479 | ||
|
|
5c4d445f05 | ||
|
|
159bbd8096 | ||
|
|
61d85a255f | ||
|
|
07b6c7f458 | ||
|
|
bad8a3ee96 | ||
|
|
6cd3806291 | ||
|
|
b8c963f20e | ||
|
|
872c6ac1cd | ||
|
|
f97132fe14 | ||
|
|
65f636e582 | ||
|
|
7c926df10a | ||
|
|
1cc1835956 | ||
|
|
cdccba167a | ||
|
|
8dde155838 | ||
|
|
54703a9d8f | ||
|
|
96aefc9b5d | ||
|
|
66123cf87d | ||
|
|
782cf9f297 | ||
|
|
21ecbe4d4b | ||
|
|
300112e8c1 | ||
|
|
0c5fed0a58 | ||
|
|
c84deb6d8c | ||
|
|
dbb0adad10 | ||
|
|
a1cb1babe8 | ||
|
|
84d51fbf1b | ||
|
|
ef9c59f0c5 | ||
|
|
af6855d38f | ||
|
|
589c3c0241 | ||
|
|
3c20aaf65c | ||
|
|
4603f3e977 | ||
|
|
40ca843786 | ||
|
|
d4b89b06bb | ||
|
|
1b11daf458 | ||
|
|
800f6c4e96 | ||
|
|
192623a5f8 | ||
|
|
7056db91f9 | ||
|
|
7f2ea3b6f2 | ||
|
|
641da6530b | ||
|
|
94ae2dc8af | ||
|
|
7bd0e8d855 | ||
|
|
7c0405157a | ||
|
|
2b2d0f6473 | ||
|
|
99218e2520 | ||
|
|
ef98fb157d | ||
|
|
f3192ade07 | ||
|
|
b71d6e40c0 | ||
|
|
ed809203c4 | ||
|
|
9c8851e260 | ||
|
|
8f85648290 | ||
|
|
f08461d55b | ||
|
|
c35e4c1e39 | ||
|
|
c874c0f6b9 | ||
|
|
0ea3419b62 | ||
|
|
d7ba52b397 | ||
|
|
0182e7fbc7 | ||
|
|
63190af20b | ||
|
|
eed4db9e31 | ||
|
|
4e4b7a02ed | ||
|
|
6a8191442f | ||
|
|
f3753359d0 | ||
|
|
20488b5161 | ||
|
|
2f82ac7172 | ||
|
|
bccce00a7b | ||
|
|
4d7ec29f7f | ||
|
|
af8ddcf74b | ||
|
|
03a096bec2 | ||
|
|
709b819374 | ||
|
|
33940b077b | ||
|
|
dd707e4a85 | ||
|
|
bd79e065d4 | ||
|
|
effb31bd8b | ||
|
|
7f51373b3d | ||
|
|
d1ae6d9283 | ||
|
|
3163a44acc | ||
|
|
272b6554a1 | ||
|
|
aaaad11285 | ||
|
|
6e9164b138 | ||
|
|
3556f7a9d1 | ||
|
|
eed43f5587 | ||
|
|
8ac6132ffb | ||
|
|
518c061c04 | ||
|
|
34a3b78d0e | ||
|
|
ae701a927c | ||
|
|
412f7829fb | ||
|
|
7936867986 | ||
|
|
af83d0627e | ||
|
|
5552ecf613 | ||
|
|
05cfe5ff5d | ||
|
|
3f3d5d8553 | ||
|
|
0228e1a08c | ||
|
|
e099f10719 | ||
|
|
f0625c4110 | ||
|
|
910ccafcb4 | ||
|
|
eb9de80d22 | ||
|
|
dec7a82372 | ||
|
|
5083da9d50 | ||
|
|
45de05a1fb | ||
|
|
0f7fbb851d | ||
|
|
a8fcf6d5b7 | ||
|
|
5ab9b7f9df | ||
|
|
46e0d0143a | ||
|
|
e4d67c49d7 | ||
|
|
d039db6c10 | ||
|
|
2dfafe2765 | ||
|
|
1fa2f2a246 | ||
|
|
f7894da752 | ||
|
|
ba29ee370f | ||
|
|
e439e2ff1a | ||
|
|
ece8e3f27a | ||
|
|
719f467a5f | ||
|
|
b233b02f87 | ||
|
|
53322f1498 | ||
|
|
5ab4c72d27 | ||
|
|
39a3c92b6b | ||
|
|
0a2d8b73d0 | ||
|
|
36aee55b67 | ||
|
|
e86f8eabbd | ||
|
|
f8aaf41008 | ||
|
|
ab3c5931ea | ||
|
|
0716795a94 | ||
|
|
7816e0550c | ||
|
|
5a83b0ef42 | ||
|
|
4c51b7d5db | ||
|
|
71ee99d1fa | ||
|
|
f4df672a66 | ||
|
|
3c3ee96c40 | ||
|
|
846e3dedc9 | ||
|
|
28de304f50 | ||
|
|
9519b13665 | ||
|
|
d29cbfd262 | ||
|
|
40adccb1d6 | ||
|
|
c89206de41 | ||
|
|
f12f3c9bfb | ||
|
|
4f89d84e2f | ||
|
|
e51cf31f1a | ||
|
|
8154588296 | ||
|
|
182fd9d0ee | ||
|
|
c33fe5ffd7 | ||
|
|
637c2bb6ce | ||
|
|
60fb3a6608 | ||
|
|
89deee98e7 | ||
|
|
a1979439b4 | ||
|
|
738e96e9dc | ||
|
|
177f042c36 | ||
|
|
cfc46042f9 | ||
|
|
1e21eabd97 | ||
|
|
edece999f6 | ||
|
|
02e4dd69b0 | ||
|
|
8e78b23d2b | ||
|
|
1b5bc508ec | ||
|
|
1f6c49b6f5 | ||
|
|
ca4e63bb2b | ||
|
|
a0350dbcae | ||
|
|
edd049b761 | ||
|
|
a4785a4da5 | ||
|
|
537fb7039a | ||
|
|
f1c59bb7d6 | ||
|
|
bb30d7f409 | ||
|
|
1f3d9b7fe3 | ||
|
|
987a665e03 | ||
|
|
f39b32d4ab | ||
|
|
ba606f7ad1 | ||
|
|
815c3e54ea | ||
|
|
9c7026d039 | ||
|
|
e26f45ec3b | ||
|
|
8d20a46437 | ||
|
|
af91bead6c | ||
|
|
0b998bfacc | ||
|
|
abac9d0957 | ||
|
|
6366ad21b3 | ||
|
|
129367a996 | ||
|
|
8a6c11aa51 | ||
|
|
d419808175 | ||
|
|
1a218211d5 | ||
|
|
b4e649d32b | ||
|
|
b8a509fdc6 | ||
|
|
95f20a3e61 | ||
|
|
cf5fcc4348 | ||
|
|
854e3803a9 | ||
|
|
5ad7fd8354 | ||
|
|
c087f2baf7 | ||
|
|
ea1f78a20c | ||
|
|
fdcbe6e613 | ||
|
|
34ae2a0e8c | ||
|
|
a915f864a2 | ||
|
|
264ee07331 | ||
|
|
b782d8b316 | ||
|
|
5cf9fad580 | ||
|
|
ceb51c6540 | ||
|
|
d017095281 | ||
|
|
1d9e0d7ce7 | ||
|
|
e96bd9a82b | ||
|
|
7829c39839 | ||
|
|
73803928e9 | ||
|
|
2a1ac4d9c8 | ||
|
|
17adc15160 | ||
|
|
3d4f6cf62f | ||
|
|
4061130fcb | ||
|
|
c49a6d368d | ||
|
|
f87a1e9e73 | ||
|
|
a8e353fa5f | ||
|
|
e2d267c7f9 | ||
|
|
395682391a | ||
|
|
a4309e5756 | ||
|
|
e8fb300544 | ||
|
|
af3c8c0562 | ||
|
|
dcc2829acf | ||
|
|
7a5e6e003a | ||
|
|
85dacb5545 | ||
|
|
df3d8f7f28 | ||
|
|
fa8e95a9ef | ||
|
|
0949927c3f | ||
|
|
ca3b1add47 | ||
|
|
f6df9528ce | ||
|
|
a9e48f3923 | ||
|
|
71f3aadf3b | ||
|
|
fec59bd368 | ||
|
|
e49d0dc46e | ||
|
|
90b2011677 | ||
|
|
9486ee9c50 | ||
|
|
9697f05efa | ||
|
|
75912fbce6 | ||
|
|
f781c7abca | ||
|
|
f67a6d67ac | ||
|
|
5d0bf8cfad | ||
|
|
93b525c36d | ||
|
|
299fa0a167 | ||
|
|
e907c19e9b | ||
|
|
3fc793a715 | ||
|
|
a862a67020 | ||
|
|
ad08db0710 | ||
|
|
f7bcd4601a | ||
|
|
65ce3a5b21 | ||
|
|
b47bf11900 | ||
|
|
1b47027ebe | ||
|
|
3747feefc2 | ||
|
|
30ed3f06f4 | ||
|
|
dabff2813a | ||
|
|
4dd269b52b | ||
|
|
00091b65e3 | ||
|
|
6152869f27 | ||
|
|
fd197d925c | ||
|
|
777c1be6e2 | ||
|
|
011e8b3e98 | ||
|
|
81df165cd8 | ||
|
|
eaa6b0fa3e | ||
|
|
32ae393e09 | ||
|
|
a96f333ef7 | ||
|
|
a49068c9d1 | ||
|
|
a529f3c5da | ||
|
|
02f35cde11 | ||
|
|
15f854ebaf | ||
|
|
d3d2dbaf9f | ||
|
|
4b0f44205c | ||
|
|
f2644a0ee8 | ||
|
|
2e9e82ac0a | ||
|
|
40c76640f9 | ||
|
|
32e54dbcba | ||
|
|
dacafde150 | ||
|
|
e2e1c7e3da | ||
|
|
82c6a72701 | ||
|
|
c78d33363f | ||
|
|
6da87faa08 | ||
|
|
03b92d3655 | ||
|
|
8138810ade | ||
|
|
0082696cc1 | ||
|
|
12c6e49a8d | ||
|
|
b349f0c221 | ||
|
|
a785d3ab39 | ||
|
|
51ca5d7259 | ||
|
|
d1a45626c8 | ||
|
|
6039850a16 | ||
|
|
6498793f31 | ||
|
|
79bf29b3af | ||
|
|
cca19fdb3e | ||
|
|
7707e0dc6d | ||
|
|
9af05e94f2 | ||
|
|
52aae81167 | ||
|
|
f325f1e22d | ||
|
|
a0f2ac4e06 | ||
|
|
835feeed94 | ||
|
|
107f7f1369 | ||
|
|
933c26105e | ||
|
|
8c80411e00 | ||
|
|
bc91a76ba9 | ||
|
|
516bef93d5 | ||
|
|
22babbf88a | ||
|
|
5b2c694b16 | ||
|
|
ae53638050 | ||
|
|
a19b6cd72b | ||
|
|
38572a5d11 | ||
|
|
9d32e223ab | ||
|
|
d42356110b | ||
|
|
26515dd429 | ||
|
|
fd73d4e7bc | ||
|
|
72242b0aaf | ||
|
|
ac79368e3f | ||
|
|
22196fea71 | ||
|
|
97f3ebd297 | ||
|
|
8b1782c955 | ||
|
|
eea2503b2c | ||
|
|
83924b66b1 | ||
|
|
d2efe295fb | ||
|
|
943b5016b1 | ||
|
|
a3e8338350 | ||
|
|
98f47ab8df | ||
|
|
04a4344c2d | ||
|
|
1969e29b70 | ||
|
|
bb8cdfecb1 | ||
|
|
47eb591527 | ||
|
|
92b30b65a1 | ||
|
|
1d88b6ecd1 | ||
|
|
f85013994d | ||
|
|
a0461c8114 | ||
|
|
f040516cda | ||
|
|
42c5261f8c | ||
|
|
a8d39e0f11 | ||
|
|
d5e3159aa3 | ||
|
|
286f60a13a | ||
|
|
d825a4fb54 | ||
|
|
40568ea061 | ||
|
|
4d0d56ea8d | ||
|
|
34206a5cea | ||
|
|
b5d2a5dc46 | ||
|
|
de70bd6961 | ||
|
|
0702710b84 | ||
|
|
456d7d6b7a | ||
|
|
6bbad5d3b9 | ||
|
|
63aa603b95 | ||
|
|
e3d4bda386 | ||
|
|
493dde3181 | ||
|
|
55258087a2 | ||
|
|
e080803e50 | ||
|
|
16821f8726 | ||
|
|
df6286e8e0 | ||
|
|
a569842634 | ||
|
|
51948b288b | ||
|
|
5c2a1378f5 | ||
|
|
684522700a | ||
|
|
f463e58338 | ||
|
|
effb882b96 | ||
|
|
3c4ce75563 | ||
|
|
205fc102cc | ||
|
|
7c081c6699 | ||
|
|
718a90de2d | ||
|
|
aa3a7715e9 | ||
|
|
dcaa76aa21 | ||
|
|
89761089a8 | ||
|
|
62abc16df7 | ||
|
|
8eca658a1f | ||
|
|
40e68f2cc3 | ||
|
|
fc62f35d29 | ||
|
|
0cce9f32e6 | ||
|
|
92fdb09921 | ||
|
|
88955b2f28 | ||
|
|
e17d9adbfc | ||
|
|
b703de8869 | ||
|
|
1bb86b8bfc | ||
|
|
a73a45cc60 | ||
|
|
1ba0f99246 | ||
|
|
b5f669c6b3 | ||
|
|
ce6fc842a9 | ||
|
|
f5ec95adc2 | ||
|
|
dc99b75e70 | ||
|
|
e8a57cf95e | ||
|
|
81abf845d6 | ||
|
|
3c5a343df2 | ||
|
|
ebdba6dd7b | ||
|
|
400ee4af22 | ||
|
|
e3901dac35 | ||
|
|
4c7207106a | ||
|
|
ed6f7b2bac | ||
|
|
298feb2cbb | ||
|
|
508b009b9f | ||
|
|
a6616be366 | ||
|
|
391789552a | ||
|
|
c0147da47d | ||
|
|
3412dcc6dc | ||
|
|
4c378f85f4 | ||
|
|
4379c5200f | ||
|
|
227f0e9366 | ||
|
|
6d43f646d6 | ||
|
|
936a018533 | ||
|
|
9ad93b4246 | ||
|
|
7c2a58d613 | ||
|
|
d2d7902a25 | ||
|
|
eef9071628 | ||
|
|
0871b07f14 | ||
|
|
a1c73d9b9b | ||
|
|
b4b2a4be1d | ||
|
|
0b8fca4bb5 | ||
|
|
8dcbafa83f | ||
|
|
1e84df08e2 | ||
|
|
44019ceca9 | ||
|
|
9210b4a8e0 | ||
|
|
a0983494c8 | ||
|
|
1b7e1446cf | ||
|
|
d7b97b6876 | ||
|
|
30bd86806f | ||
|
|
de28d668d9 | ||
|
|
5721f55fcf | ||
|
|
996670b32e | ||
|
|
2251803dea | ||
|
|
126edd9ec8 | ||
|
|
e54242317f | ||
|
|
2ff2e14e90 | ||
|
|
c4d6f7fecc | ||
|
|
62d0edd5f9 | ||
|
|
c6ffeccaa7 | ||
|
|
a13f450f99 | ||
|
|
c6677cbff9 | ||
|
|
d57f5defe3 | ||
|
|
02515f2679 | ||
|
|
72b227c687 | ||
|
|
ee1682ada9 | ||
|
|
3317264e51 | ||
|
|
62b6dfc2e3 | ||
|
|
606cb975b6 | ||
|
|
9613b99768 | ||
|
|
ae2697ef17 | ||
|
|
4650052cfd | ||
|
|
51ab71bc51 | ||
|
|
7fb3096fa7 | ||
|
|
440b755625 | ||
|
|
7454a237ab | ||
|
|
06c0e138b6 | ||
|
|
8f7ef0638a | ||
|
|
d04edcaa2e | ||
|
|
9464ca8f0a | ||
|
|
3b12831da9 | ||
|
|
52486596fd | ||
|
|
34f9eda15b | ||
|
|
609b6973af | ||
|
|
061692f286 | ||
|
|
d9a211282a | ||
|
|
587b2c1443 | ||
|
|
23345ea44b | ||
|
|
6ae581b515 | ||
|
|
2243abab30 | ||
|
|
dc13b280c3 | ||
|
|
bf96f8a3b4 | ||
|
|
e1436cb627 | ||
|
|
b93aaf97ce | ||
|
|
1848b393cd | ||
|
|
84f486da45 | ||
|
|
04b8c32143 | ||
|
|
6688eb3fca | ||
|
|
60cfde10e2 | ||
|
|
7fa53db652 | ||
|
|
13ea8d58c4 | ||
|
|
2eebdf435f | ||
|
|
5ee7082349 | ||
|
|
402752ab10 | ||
|
|
f14c7dc57f | ||
|
|
717cfd54d5 | ||
|
|
02681b01bd | ||
|
|
890297e8f8 | ||
|
|
92b8d84b08 | ||
|
|
fb34c8be1f | ||
|
|
f69a5e97fd | ||
|
|
05b8800343 | ||
|
|
1f1736f1c4 | ||
|
|
d3312c05de | ||
|
|
33bc9e5561 | ||
|
|
c539812e4b | ||
|
|
7d46d6d01e | ||
|
|
8ff540f0a5 | ||
|
|
ed1487128d | ||
|
|
7eb76da572 | ||
|
|
880d91f35d | ||
|
|
6aaf665efd | ||
|
|
b0be8963eb | ||
|
|
447f2fcc72 | ||
|
|
d7c0afdfa2 | ||
|
|
b0a2c67325 | ||
|
|
d589b4b0f9 | ||
|
|
1453b7d179 | ||
|
|
6603defa8e | ||
|
|
be942e2e76 | ||
|
|
b8e0b23038 | ||
|
|
3381a0c4c8 | ||
|
|
f062645ceb | ||
|
|
601dbc9ba9 | ||
|
|
dfbf272ffe | ||
|
|
f4d7081311 | ||
|
|
ef145f4dba | ||
|
|
3e9e5352a0 | ||
|
|
f03e7a8d34 | ||
|
|
70cb85c13a | ||
|
|
66db090248 | ||
|
|
27c9d24c9e | ||
|
|
c605556b32 | ||
|
|
3031fc5564 | ||
|
|
506dd5cf36 | ||
|
|
cf8e00290e | ||
|
|
f4bb1b633f | ||
|
|
cd65b260c6 | ||
|
|
7dfa954cc6 | ||
|
|
42b0adbf42 | ||
|
|
c38f183f8d | ||
|
|
c683196c5a | ||
|
|
881ea59787 | ||
|
|
8b339b4ead | ||
|
|
e5a9c3ab53 | ||
|
|
9452ba5c60 | ||
|
|
a51aa7c23f | ||
|
|
4a85e44369 | ||
|
|
d46ffe2699 | ||
|
|
a59ef142a5 | ||
|
|
2a4770c0b1 | ||
|
|
84fcaf6322 | ||
|
|
6a25821693 | ||
|
|
2e49000673 | ||
|
|
940f6ef41b | ||
|
|
0a34749a51 | ||
|
|
c82b77fb9c | ||
|
|
b0ba15c22d | ||
|
|
d9085e3e51 | ||
|
|
f4f820f431 | ||
|
|
afa41e3a50 | ||
|
|
807867b2a8 | ||
|
|
e0d6147e77 | ||
|
|
39ad60cabe | ||
|
|
ad319b8593 | ||
|
|
85abae0dd2 | ||
|
|
e41775b216 | ||
|
|
4d874c7968 | ||
|
|
704f26f305 | ||
|
|
682ee0d43a | ||
|
|
4114f9fc66 | ||
|
|
f6963679fd | ||
|
|
a3a92dd61e | ||
|
|
65135726ce | ||
|
|
4fdc8bcb58 | ||
|
|
603b43a1ea | ||
|
|
270842b1b0 | ||
|
|
7d356f3af9 | ||
|
|
55980945a5 | ||
|
|
9ababa1a41 | ||
|
|
8a2887eab8 | ||
|
|
86e1f012cc | ||
|
|
11fb3b709c | ||
|
|
a4f1ca5b25 | ||
|
|
1bd57cb94b | ||
|
|
cca1bf41ed | ||
|
|
265865e75c | ||
|
|
652ee9d2f4 | ||
|
|
9deb99a330 | ||
|
|
77caf817b9 | ||
|
|
51a37b2b80 | ||
|
|
affdbcf82a | ||
|
|
26195f2db1 | ||
|
|
ec5fdb0ca0 | ||
|
|
c45bc1f8f1 | ||
|
|
c1e13e0401 | ||
|
|
1a22a24373 | ||
|
|
944bb44cfc | ||
|
|
f310a2c535 | ||
|
|
349ffba06c | ||
|
|
f10f396e23 | ||
|
|
4ce8b7d4f8 | ||
|
|
3e7aa8fe06 | ||
|
|
3779514c53 | ||
|
|
987d65963e | ||
|
|
4a0b5beb0b | ||
|
|
8b051df564 | ||
|
|
ec58a955b0 | ||
|
|
53dff23713 | ||
|
|
493ae62594 | ||
|
|
9f0b9e88b8 | ||
|
|
d4f29d1b5f | ||
|
|
fd1aa79cdf | ||
|
|
f5aeebd2db | ||
|
|
1e41c7d831 | ||
|
|
79e912a95c | ||
|
|
802411e84d | ||
|
|
e4103fb8ed | ||
|
|
b8079e8c4b | ||
|
|
0d641b77be | ||
|
|
cc10796681 | ||
|
|
59bafd4cd7 | ||
|
|
f5f86b51ae | ||
|
|
909c309764 | ||
|
|
d747ee4ab3 | ||
|
|
46a6c9d26c | ||
|
|
4424e16f21 | ||
|
|
619169e8e3 | ||
|
|
e0187a3b2a | ||
|
|
8065b8d57d | ||
|
|
d8bf5e8bd6 | ||
|
|
d73c81d7f6 | ||
|
|
ddd70d0c43 | ||
|
|
b4ebd5b5b3 | ||
|
|
820330faa6 | ||
|
|
e36f8a9042 | ||
|
|
dff2ddcd9b | ||
|
|
0d4c0d0f32 | ||
|
|
08c48cc383 | ||
|
|
0c4814af0b | ||
|
|
0c25de61c2 | ||
|
|
2e16f29bea | ||
|
|
c0c05d0e56 | ||
|
|
3118212673 | ||
|
|
acc38cf035 | ||
|
|
9e33dd6afd | ||
|
|
7fb031f825 | ||
|
|
76b9649ff5 | ||
|
|
66a75b2282 | ||
|
|
eb3f6d329f | ||
|
|
e4dec37a70 | ||
|
|
3c38ca0e4e | ||
|
|
ca6130d6cc | ||
|
|
00b5eac0c2 | ||
|
|
6dc1e0ac3d | ||
|
|
6fca8208a2 | ||
|
|
daf9df44ac | ||
|
|
fab29b0e70 | ||
|
|
6decc339f2 | ||
|
|
af6ac9c3a2 | ||
|
|
bb8d130877 | ||
|
|
fc622b914d | ||
|
|
eb506db426 | ||
|
|
1784ede83c | ||
|
|
5ac2ee114d | ||
|
|
3e8f34b9a8 | ||
|
|
0d96dabf39 | ||
|
|
ab50b9fb9e | ||
|
|
a6df9af80c | ||
|
|
f8b667cb08 | ||
|
|
1fdd348954 | ||
|
|
732190b52e | ||
|
|
a5a7429329 | ||
|
|
71f59dc9ad | ||
|
|
32331723af | ||
|
|
a083e8e26b | ||
|
|
08269a5843 | ||
|
|
5190132c24 | ||
|
|
2a69888732 | ||
|
|
08a88d4afc | ||
|
|
dab65a7998 | ||
|
|
7b6dc3a877 | ||
|
|
e3f824bae5 | ||
|
|
2e756bbf37 | ||
|
|
34e1095aaf | ||
|
|
23a61b3621 | ||
|
|
d70cb1282d | ||
|
|
bc3d57f677 | ||
|
|
1ffdbff108 | ||
|
|
4a9e253808 | ||
|
|
c2a00e2a9b | ||
|
|
894923e06e | ||
|
|
09cb7ccc4a | ||
|
|
a359e20d8e | ||
|
|
316fef5094 | ||
|
|
06deacac5c | ||
|
|
cd42459d5d | ||
|
|
a49bd0c4e5 | ||
|
|
6a27b4658e | ||
|
|
5d5d8acd13 | ||
|
|
67c18c7e39 | ||
|
|
90acde0da4 | ||
|
|
b182b69877 | ||
|
|
bc326dd50f | ||
|
|
9958464107 | ||
|
|
b09f250b0f | ||
|
|
58b8ec5773 | ||
|
|
3dd2de0292 | ||
|
|
f2e6238146 | ||
|
|
89827f2372 | ||
|
|
4bbd22ff42 | ||
|
|
d51e7486d4 | ||
|
|
c39b673630 | ||
|
|
20aaf3fcb2 | ||
|
|
d534c955e4 | ||
|
|
a47b6e3213 | ||
|
|
b2544e273f | ||
|
|
e9dade26fc | ||
|
|
2011f00f70 | ||
|
|
e0ccbcff63 | ||
|
|
cd4d5288b0 | ||
|
|
729158bad0 | ||
|
|
0d8115be70 | ||
|
|
891750e638 | ||
|
|
54a675dd69 | ||
|
|
849c4bbde2 | ||
|
|
630e944e1d | ||
|
|
1cdb885390 | ||
|
|
2acf8d3834 | ||
|
|
db656acb74 | ||
|
|
4b4acb4d28 | ||
|
|
e3d6685aec | ||
|
|
3c0b0cd800 | ||
|
|
9b5d05c385 | ||
|
|
14382f15b5 | ||
|
|
99181b2034 | ||
|
|
b68419de41 | ||
|
|
c8755be2ea | ||
|
|
3838c17206 | ||
|
|
c4a9653f89 | ||
|
|
968df3fc9a | ||
|
|
6c80b0434b | ||
|
|
e28c618bf5 | ||
|
|
2461391278 | ||
|
|
01301d8c72 | ||
|
|
0c4a2b957c | ||
|
|
5cf1353831 | ||
|
|
b4b30d4b5e | ||
|
|
054e6d795c | ||
|
|
166b0bfa67 | ||
|
|
268db3a06e | ||
|
|
173473e579 | ||
|
|
7b7ed34811 | ||
|
|
cd5d127320 | ||
|
|
7a12dbb0f0 | ||
|
|
54f1e9551e | ||
|
|
52f41c0725 | ||
|
|
94360aadc4 | ||
|
|
55fddff551 | ||
|
|
309fbcbc50 | ||
|
|
8b1c3b85c4 | ||
|
|
b096b5b0e7 | ||
|
|
cf5f414571 | ||
|
|
b99d0bbf4d | ||
|
|
815fb6ff7e | ||
|
|
e4062631d4 | ||
|
|
fb23fc7b0e | ||
|
|
3022974dcd | ||
|
|
ff2ceb8c96 | ||
|
|
4a234ab586 | ||
|
|
3f94a6a861 | ||
|
|
509514abf2 | ||
|
|
73e75d6154 | ||
|
|
1b6119319c | ||
|
|
93126f0886 | ||
|
|
0dbe13cbf0 | ||
|
|
0e462eeaeb | ||
|
|
b0f605156b | ||
|
|
a779ac80f4 | ||
|
|
4bd64eafb8 | ||
|
|
64ff69af49 | ||
|
|
75c20132b3 | ||
|
|
c4a928699e | ||
|
|
e926d2847d | ||
|
|
f9e0c13dc8 | ||
|
|
a9e7186046 | ||
|
|
c2ad167e4d | ||
|
|
f021256d53 | ||
|
|
662dcce3f2 | ||
|
|
a08d1ac58c | ||
|
|
da47198641 | ||
|
|
821e6214da | ||
|
|
92ddffb6e9 | ||
|
|
20bedc9a03 | ||
|
|
d4515655d4 | ||
|
|
10390e8915 | ||
|
|
007c8afa42 | ||
|
|
a154809875 | ||
|
|
2008824932 | ||
|
|
2e1f1f5438 | ||
|
|
329083330a | ||
|
|
c271a4061f | ||
|
|
3fb867170e | ||
|
|
d58d23067a | ||
|
|
4d736c70fd | ||
|
|
0766443b3b | ||
|
|
da82ef54de | ||
|
|
78b69b0a88 | ||
|
|
ba0df37d8b | ||
|
|
7e4d5fb87f | ||
|
|
9488ca8926 | ||
|
|
630e352c30 | ||
|
|
aa485dd753 | ||
|
|
283d1b57b0 | ||
|
|
a0cf2941c4 | ||
|
|
b539c7afc3 | ||
|
|
f57345a2c0 | ||
|
|
f60b48fdbc | ||
|
|
4230c172e4 | ||
|
|
ed33d6dad3 | ||
|
|
508cc90c1c | ||
|
|
d74ca3ff36 | ||
|
|
f81d2a1a1e | ||
|
|
9c87adb384 | ||
|
|
f3317f63ad | ||
|
|
89692aa2cc | ||
|
|
c632c31ad1 | ||
|
|
ac0e3e053e | ||
|
|
83f540d4e6 | ||
|
|
9690a51ce6 | ||
|
|
0286571f17 | ||
|
|
44339eaa9f | ||
|
|
2ee4fc6917 | ||
|
|
bb67902b9b | ||
|
|
73b2f1d9c2 | ||
|
|
f32676300d | ||
|
|
8246288005 | ||
|
|
8f35de83a1 | ||
|
|
2fed3ce184 | ||
|
|
00e7f0e656 | ||
|
|
3513417ecb | ||
|
|
5e3562a0db | ||
|
|
431157a2aa | ||
|
|
f488a47225 | ||
|
|
ad1fef58f1 | ||
|
|
e80da5b242 | ||
|
|
038c1e1796 | ||
|
|
8003f30c36 | ||
|
|
2a91516889 | ||
|
|
14f698b816 | ||
|
|
b14df5fa61 | ||
|
|
8ac31ae99d | ||
|
|
67713bb424 | ||
|
|
4cd2dd6425 | ||
|
|
ddd8bad307 | ||
|
|
fd625c0792 | ||
|
|
aaf78d2e1a | ||
|
|
44d056d6a3 | ||
|
|
424505cc31 | ||
|
|
1d5c814149 | ||
|
|
aca6b0bba2 | ||
|
|
01dc009d70 | ||
|
|
f00e6e5904 | ||
|
|
1b6c4f2635 | ||
|
|
6a44b96db0 | ||
|
|
6ecdc03907 | ||
|
|
dd9530723b | ||
|
|
ee00f75644 | ||
|
|
1a8bbc0d63 | ||
|
|
5393e638a0 | ||
|
|
ef2a5ade00 | ||
|
|
57a27f1d50 | ||
|
|
9daf7a540c | ||
|
|
6c6385f95e | ||
|
|
456cf72ccb | ||
|
|
4147974f59 | ||
|
|
07ebf6331b | ||
|
|
659dc3219b | ||
|
|
61bd096c8a | ||
|
|
84f531a52e | ||
|
|
55b0054293 | ||
|
|
fba3da6995 | ||
|
|
582e770b5c | ||
|
|
704dbf758b | ||
|
|
78927bf2a0 | ||
|
|
e44a40eb6a | ||
|
|
64008c213e | ||
|
|
6a4c353cd6 | ||
|
|
caf359bdc1 | ||
|
|
3b1cb7d04f | ||
|
|
d6681f6c63 | ||
|
|
6d4edde1eb | ||
|
|
2524430720 | ||
|
|
e0910070d2 | ||
|
|
a9fd3ae77d | ||
|
|
7e7dbb7a9a | ||
|
|
e211a20b92 | ||
|
|
48f5d54fae | ||
|
|
9e627c30c9 | ||
|
|
d3f9e9a69d | ||
|
|
adb1452d9d | ||
|
|
9ef9e2efe3 | ||
|
|
60598d0cc0 | ||
|
|
2b680ec5fc | ||
|
|
f3cc21d8cd | ||
|
|
a628098cfa | ||
|
|
45bcc78e16 | ||
|
|
a495a548fb | ||
|
|
1342af872f | ||
|
|
1ac8d11436 | ||
|
|
1e412e8490 | ||
|
|
c5d983fef4 | ||
|
|
0ac4c6a082 | ||
|
|
6ce7c3242c | ||
|
|
e837e48894 | ||
|
|
cb68a54e3d | ||
|
|
f30b6019c3 | ||
|
|
dce634d7d6 | ||
|
|
f84132e692 | ||
|
|
c3d7d1ae7b | ||
|
|
88ebeb04ce | ||
|
|
785e17dbbf | ||
|
|
b7f668f7e8 | ||
|
|
4ad2fcb8e0 | ||
|
|
06ad7dc35e | ||
|
|
1931ae5c88 | ||
|
|
dbbd9a87d7 | ||
|
|
57c1e905c2 | ||
|
|
241fddf501 | ||
|
|
d60410b769 | ||
|
|
0e1f237edc | ||
|
|
f746427b55 | ||
|
|
7c6e50cbd3 | ||
|
|
26928458bb | ||
|
|
ccd51ccc8c | ||
|
|
d5d0a00a48 | ||
|
|
8e2882588e | ||
|
|
6f796d74d1 | ||
|
|
979520e152 | ||
|
|
1d18fb84ee | ||
|
|
e7aa83e603 | ||
|
|
bc6c244897 | ||
|
|
e53fba47d7 | ||
|
|
16a8aca062 | ||
|
|
ebdfcca282 | ||
|
|
5b9e429b70 | ||
|
|
ae20f7f341 | ||
|
|
53d961e6fa | ||
|
|
47894eddbe | ||
|
|
bf338a530b | ||
|
|
10f624236e | ||
|
|
f5170e2804 | ||
|
|
bbf32962d6 | ||
|
|
2d92d1fc65 | ||
|
|
6af1f6f35a | ||
|
|
675ff68238 | ||
|
|
eba0607a76 | ||
|
|
58c914a7f7 | ||
|
|
15fb0b28c6 | ||
|
|
f2051a9c75 | ||
|
|
ce957b6b38 | ||
|
|
e642f17ed2 | ||
|
|
7e5fa53319 | ||
|
|
877783f732 | ||
|
|
ce1ebc2c26 | ||
|
|
2270c52c91 | ||
|
|
a653c8dbfd | ||
|
|
9b065377e2 | ||
|
|
cfb35bc8bd | ||
|
|
4aff5309fc | ||
|
|
3c6e59ee8e | ||
|
|
0721dd26df | ||
|
|
c57151540e | ||
|
|
6fd2ac0301 | ||
|
|
7592ea7119 | ||
|
|
0ac044791a | ||
|
|
d691be43db | ||
|
|
59c2cc11b5 | ||
|
|
80cb160eb5 | ||
|
|
2784e8857c | ||
|
|
5f75079f1d | ||
|
|
a2a6bc329f | ||
|
|
9d5206017d | ||
|
|
160a979d59 | ||
|
|
4dda83c0ea | ||
|
|
64462c33d5 | ||
|
|
5762e1da78 | ||
|
|
d0b7573933 | ||
|
|
4201c2b7c2 | ||
|
|
fcc2b23ccc | ||
|
|
631d7fa4b6 | ||
|
|
232a5dbda7 | ||
|
|
74b8d45126 | ||
|
|
ac71729bbe | ||
|
|
94207e76db | ||
|
|
aa62d24269 | ||
|
|
23ee920bbd | ||
|
|
afa05856d4 | ||
|
|
8673d7457d | ||
|
|
363e539c3d | ||
|
|
1c169d74f4 | ||
|
|
f8cbfe6e57 | ||
|
|
56006af2b7 | ||
|
|
e52ddaaf98 | ||
|
|
4ee00cb7e0 | ||
|
|
ae3358cdc4 | ||
|
|
34138387e3 | ||
|
|
c50284c06b | ||
|
|
d9b37b0e5f | ||
|
|
10b1160d42 | ||
|
|
05524980cf | ||
|
|
56e48e0982 | ||
|
|
d7818444f9 | ||
|
|
b83fc07cc6 | ||
|
|
f208a25dc3 | ||
|
|
f8d3a7a35f | ||
|
|
c9ab6c3d01 | ||
|
|
e8d9cee82c | ||
|
|
f652d56904 | ||
|
|
447b42f657 | ||
|
|
f6195ac6b6 | ||
|
|
0a139be8a2 | ||
|
|
d100457780 | ||
|
|
a412e6abd7 | ||
|
|
20d9d73374 | ||
|
|
8abdfda22f | ||
|
|
79b01441ae | ||
|
|
913736c8b3 | ||
|
|
024e451ac6 | ||
|
|
eb9fe3caa8 | ||
|
|
326a2bb610 | ||
|
|
6b2a8fdb04 | ||
|
|
4b15d376f5 | ||
|
|
e9d5fa0426 | ||
|
|
4ad49845d0 | ||
|
|
0f97991e17 | ||
|
|
5946e33dd2 | ||
|
|
6ce24638c4 | ||
|
|
465f802418 | ||
|
|
ef9f77d53d | ||
|
|
0fb06b5648 | ||
|
|
a76e04ed88 | ||
|
|
1d5e18767f | ||
|
|
ea43b4d8b1 | ||
|
|
aae419b1ec | ||
|
|
f7d7323ecc | ||
|
|
3d18c43a45 | ||
|
|
6e8ada062c | ||
|
|
eb5f934213 | ||
|
|
c547437206 | ||
|
|
2054f42e88 | ||
|
|
e48813a72d | ||
|
|
fc4de9ee6c | ||
|
|
d290a44564 | ||
|
|
476a5d5646 | ||
|
|
b349f577a9 | ||
|
|
c1a0477e8f | ||
|
|
ea02e0e7da | ||
|
|
b048c0396e | ||
|
|
da55b3e869 | ||
|
|
9c115702ea | ||
|
|
79899c0637 | ||
|
|
941920bef2 | ||
|
|
ffc2df4d9d | ||
|
|
3102b90f85 | ||
|
|
4e382a64c7 | ||
|
|
f182e420a7 | ||
|
|
30893ac71f | ||
|
|
2471024921 | ||
|
|
75cf4b8c7f | ||
|
|
d5c127fa1a | ||
|
|
530e00a191 | ||
|
|
576537d306 | ||
|
|
5c53f6c186 | ||
|
|
103854f36b | ||
|
|
8bed9e2e2a | ||
|
|
e4b6701994 | ||
|
|
3d66be1497 | ||
|
|
7ed19bbb16 | ||
|
|
904ddf11fa | ||
|
|
80e8c2996f | ||
|
|
09ded896f1 | ||
|
|
3bdfcf487a | ||
|
|
7cdb83d9a5 | ||
|
|
3b44e4eeef | ||
|
|
58ea22f3b2 | ||
|
|
b717c806eb | ||
|
|
ee99ed2252 | ||
|
|
a2f0ca7406 | ||
|
|
e919848f87 | ||
|
|
9757b92b11 | ||
|
|
3216ed82d2 | ||
|
|
24b2c8d931 | ||
|
|
2e936b1a00 | ||
|
|
fa156ab99b | ||
|
|
4d0463bed4 | ||
|
|
2902db6f2c | ||
|
|
d9654e0eb0 | ||
|
|
c02c79555f | ||
|
|
7cd407e0c5 | ||
|
|
18ee04093c | ||
|
|
4d00672442 | ||
|
|
196bd55078 | ||
|
|
eb1ec4fb4f | ||
|
|
6b665a9245 | ||
|
|
4854486786 | ||
|
|
e763676206 | ||
|
|
f56d12b6d0 | ||
|
|
5edcdd9d7c | ||
|
|
610c7ae2f3 | ||
|
|
c06b5e21b0 | ||
|
|
70894c6c52 | ||
|
|
2c1c458572 | ||
|
|
dd71b4c8ac | ||
|
|
04e62a29b4 | ||
|
|
d91696ad43 | ||
|
|
23767315ed | ||
|
|
ddc3a1c302 | ||
|
|
f7133c0895 | ||
|
|
d27c9e56d8 | ||
|
|
068824cfbb | ||
|
|
bf6459002c | ||
|
|
4370f86d63 | ||
|
|
68a6cd106e | ||
|
|
6f0548e2b9 |
42
mozilla/extensions/datetime/Makefile.in
Normal file
42
mozilla/extensions/datetime/Makefile.in
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
LIBRARY_NAME = necko_datetime
|
||||
SHORT_LIBNAME = neckodtm
|
||||
IS_COMPONENT = 1
|
||||
|
||||
CPPSRCS = \
|
||||
nsDateTimeHandler.cpp \
|
||||
nsDateTimeChannel.cpp \
|
||||
nsDateTimeModule.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
431
mozilla/extensions/datetime/nsDateTimeChannel.cpp
Normal file
431
mozilla/extensions/datetime/nsDateTimeChannel.cpp
Normal file
@@ -0,0 +1,431 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// datetime implementation
|
||||
|
||||
#include "nsDateTimeChannel.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
|
||||
// nsDateTimeChannel methods
|
||||
nsDateTimeChannel::nsDateTimeChannel() {
|
||||
NS_INIT_REFCNT();
|
||||
mContentLength = -1;
|
||||
mPort = -1;
|
||||
}
|
||||
|
||||
nsDateTimeChannel::~nsDateTimeChannel() {
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS4(nsDateTimeChannel, nsIChannel, nsIRequest, nsIStreamListener, nsIStreamObserver)
|
||||
|
||||
nsresult
|
||||
nsDateTimeChannel::Init(nsIURI* uri)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(uri, "no uri");
|
||||
|
||||
mUrl = uri;
|
||||
|
||||
rv = mUrl->GetPort(&mPort);
|
||||
if (NS_FAILED(rv) || mPort < 1)
|
||||
mPort = DATETIME_PORT;
|
||||
|
||||
rv = mUrl->GetPath(getter_Copies(mHost));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!*(const char *)mHost) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsDateTimeChannel::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
|
||||
{
|
||||
nsDateTimeChannel* dc = new nsDateTimeChannel();
|
||||
if (dc == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(dc);
|
||||
nsresult rv = dc->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(dc);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::IsPending(PRBool *result)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::IsPending");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetStatus(nsresult *status)
|
||||
{
|
||||
*status = NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::Cancel(nsresult status)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::Cancel");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::Suspend(void)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::Suspend");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::Resume(void)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::Resume");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetOriginalURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mOriginalURI ? mOriginalURI : mUrl;
|
||||
NS_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetOriginalURI(nsIURI* aURI)
|
||||
{
|
||||
mOriginalURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mUrl;
|
||||
NS_IF_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetURI(nsIURI* aURI)
|
||||
{
|
||||
mUrl = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, mHost, 32, 32, getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return channel->OpenInputStream(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::AsyncOpen(nsIStreamObserver *observer, nsISupports* ctxt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, mHost, 32, 32, getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return channel->AsyncOpen(observer, ctxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::AsyncRead(nsIStreamListener *aListener,
|
||||
nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, mHost, 32, 32, getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mListener = aListener;
|
||||
|
||||
return channel->AsyncRead(this, ctxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::AsyncWrite(nsIInputStream *fromStream,
|
||||
nsIStreamObserver *observer,
|
||||
nsISupports *ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetLoadAttributes(PRUint32 *aLoadAttributes)
|
||||
{
|
||||
*aLoadAttributes = mLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
|
||||
{
|
||||
mLoadAttributes = aLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define DATETIME_TYPE "text/plain"
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetContentType(char* *aContentType) {
|
||||
if (!aContentType) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aContentType = nsCRT::strdup(DATETIME_TYPE);
|
||||
if (!*aContentType) return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetContentType(const char *aContentType)
|
||||
{
|
||||
//It doesn't make sense to set the content-type on this type
|
||||
// of channel...
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsDateTimeChannel::SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetShouldCache(PRBool *aShouldCache)
|
||||
{
|
||||
*aShouldCache = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
*aLoadGroup = mLoadGroup;
|
||||
NS_IF_ADDREF(*aLoadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
if (mLoadGroup) // if we already had a load group remove ourselves...
|
||||
(void)mLoadGroup->RemoveChannel(this, nsnull, nsnull, nsnull);
|
||||
|
||||
mLoadGroup = aLoadGroup;
|
||||
if (mLoadGroup) {
|
||||
return mLoadGroup->AddChannel(this, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetOwner(nsISupports* *aOwner)
|
||||
{
|
||||
*aOwner = mOwner.get();
|
||||
NS_IF_ADDREF(*aOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetOwner(nsISupports* aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
||||
{
|
||||
*aNotificationCallbacks = mCallbacks.get();
|
||||
NS_IF_ADDREF(*aNotificationCallbacks);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
|
||||
{
|
||||
mCallbacks = aNotificationCallbacks;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
||||
return mListener->OnStartRequest(this, aContext);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
if (mLoadGroup) {
|
||||
nsresult rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aMsg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mListener->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
}
|
||||
|
||||
|
||||
// nsIStreamListener method
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::OnDataAvailable(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsIInputStream *aInputStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
mContentLength = aLength;
|
||||
return mListener->OnDataAvailable(this, aContext, aInputStream, aSourceOffset, aLength);
|
||||
}
|
||||
|
||||
77
mozilla/extensions/datetime/nsDateTimeChannel.h
Normal file
77
mozilla/extensions/datetime/nsDateTimeChannel.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// A datetime channel retrieves date time information from
|
||||
// RFC 867 compliant datetime servers. The date/time returned
|
||||
// to the caller is of MIME type "text/plain".
|
||||
|
||||
#ifndef nsDateTimeChannel_h___
|
||||
#define nsDateTimeChannel_h___
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsDateTimeHandler.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
|
||||
class nsDateTimeChannel : public nsIChannel, public nsIStreamListener {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
|
||||
// nsDateTimeChannel methods:
|
||||
nsDateTimeChannel();
|
||||
virtual ~nsDateTimeChannel();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
|
||||
nsresult Init(nsIURI* uri);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
PRUint32 mLoadAttributes;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCString mContentType;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
|
||||
PRInt32 mPort;
|
||||
nsXPIDLCString mHost;
|
||||
};
|
||||
|
||||
#endif /* nsDateTimeChannel_h___ */
|
||||
116
mozilla/extensions/datetime/nsDateTimeHandler.cpp
Normal file
116
mozilla/extensions/datetime/nsDateTimeHandler.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsDateTimeChannel.h"
|
||||
#include "nsDateTimeHandler.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsDateTimeHandler::nsDateTimeHandler() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsDateTimeHandler::~nsDateTimeHandler() {
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsDateTimeHandler, NS_GET_IID(nsIProtocolHandler));
|
||||
|
||||
NS_METHOD
|
||||
nsDateTimeHandler::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult) {
|
||||
|
||||
nsDateTimeHandler* ph = new nsDateTimeHandler();
|
||||
if (ph == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(ph);
|
||||
nsresult rv = ph->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(ph);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIProtocolHandler methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeHandler::GetScheme(char* *result) {
|
||||
*result = nsCRT::strdup("datetime");
|
||||
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeHandler::GetDefaultPort(PRInt32 *result) {
|
||||
*result = DATETIME_PORT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **result) {
|
||||
nsresult rv;
|
||||
|
||||
// no concept of a relative datetime url
|
||||
NS_ASSERTION(!aBaseURI, "base url passed into datetime protocol handler");
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = url->SetSpec((char*)aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeHandler::NewChannel(nsIURI* url, nsIChannel* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsDateTimeChannel* channel;
|
||||
rv = nsDateTimeChannel::Create(nsnull, NS_GET_IID(nsIChannel), (void**)&channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->Init(url);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(channel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = channel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
51
mozilla/extensions/datetime/nsDateTimeHandler.h
Normal file
51
mozilla/extensions/datetime/nsDateTimeHandler.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// The datetime protocol handler creates "datetime" URIs of the form
|
||||
// "datetime:RFC867Server".
|
||||
|
||||
#ifndef nsDateTimeHandler_h___
|
||||
#define nsDateTimeHandler_h___
|
||||
|
||||
#include "nsIProtocolHandler.h"
|
||||
|
||||
#define DATETIME_PORT 13
|
||||
|
||||
// {AA27D2A0-B71B-11d3-A1A0-0050041CAF44}
|
||||
#define NS_DATETIMEHANDLER_CID \
|
||||
{ 0xaa27d2a0, 0xb71b, 0x11d3, { 0xa1, 0xa0, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44 } }
|
||||
|
||||
class nsDateTimeHandler : public nsIProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
|
||||
// nsDateTimeHandler methods:
|
||||
nsDateTimeHandler();
|
||||
virtual ~nsDateTimeHandler();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
};
|
||||
|
||||
#endif /* nsDateTimeHandler_h___ */
|
||||
34
mozilla/extensions/datetime/nsDateTimeModule.cpp
Normal file
34
mozilla/extensions/datetime/nsDateTimeModule.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsDateTimeHandler.h"
|
||||
|
||||
static nsModuleComponentInfo gResComponents[] = {
|
||||
{ "The DateTime Protocol Handler",
|
||||
NS_DATETIMEHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_PROGID_PREFIX "datetime",
|
||||
nsDateTimeHandler::Create
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("datetime", gResComponents)
|
||||
41
mozilla/extensions/finger/Makefile.in
Normal file
41
mozilla/extensions/finger/Makefile.in
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
LIBRARY_NAME = necko_finger
|
||||
IS_COMPONENT = 1
|
||||
|
||||
CPPSRCS = \
|
||||
nsFingerHandler.cpp \
|
||||
nsFingerChannel.cpp \
|
||||
nsFingerModule.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
517
mozilla/extensions/finger/nsFingerChannel.cpp
Normal file
517
mozilla/extensions/finger/nsFingerChannel.cpp
Normal file
@@ -0,0 +1,517 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// finger implementation
|
||||
|
||||
#include "nsFingerChannel.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsIStringStream.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
|
||||
#define BUFFER_SEG_SIZE (4*1024)
|
||||
#define BUFFER_MAX_SIZE (64*1024)
|
||||
|
||||
// nsFingerChannel methods
|
||||
nsFingerChannel::nsFingerChannel()
|
||||
: mContentLength(-1),
|
||||
mActAsObserver(PR_TRUE),
|
||||
mPort(-1),
|
||||
mStatus(NS_OK)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsFingerChannel::~nsFingerChannel() {
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS4(nsFingerChannel, nsIChannel, nsIRequest,
|
||||
nsIStreamListener, nsIStreamObserver)
|
||||
|
||||
nsresult
|
||||
nsFingerChannel::Init(nsIURI* uri)
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString autoBuffer;
|
||||
|
||||
NS_ASSERTION(uri, "no uri");
|
||||
|
||||
mUrl = uri;
|
||||
|
||||
// For security reasons, we do not allow the user to specify a
|
||||
// non-default port for finger: URL's.
|
||||
|
||||
mPort = FINGER_PORT;
|
||||
|
||||
rv = mUrl->GetPath(getter_Copies(autoBuffer)); // autoBuffer = user@host
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCString cString(autoBuffer);
|
||||
nsCString tempBuf;
|
||||
|
||||
PRUint32 i;
|
||||
|
||||
// Now parse out the user and host
|
||||
for (i=0; cString[i] != '\0'; i++) {
|
||||
if (cString[i] == '@') {
|
||||
cString.Left(tempBuf, i);
|
||||
mUser = tempBuf;
|
||||
cString.Right(tempBuf, cString.Length() - i - 1);
|
||||
mHost = tempBuf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Catch the case of just the host being given
|
||||
|
||||
if (cString[i] == '\0') {
|
||||
mHost = cString;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_bryner
|
||||
printf("Status:mUser = %s, mHost = %s\n", (const char*)mUser,
|
||||
(const char*)mHost);
|
||||
#endif
|
||||
if (!*(const char *)mHost) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsFingerChannel::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
|
||||
{
|
||||
nsFingerChannel* fc = new nsFingerChannel();
|
||||
if (fc == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(fc);
|
||||
nsresult rv = fc->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(fc);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::IsPending(PRBool *result)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::IsPending");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetStatus(nsresult *status)
|
||||
{
|
||||
*status = mStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::Cancel(nsresult status)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
mStatus = status;
|
||||
if (mTransport) {
|
||||
rv = mTransport->Cancel(status);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::Suspend(void)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::Suspend");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::Resume(void)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::Resume");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetOriginalURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mOriginalURI ? mOriginalURI : mUrl;
|
||||
NS_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetOriginalURI(nsIURI* aURI)
|
||||
{
|
||||
mOriginalURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mUrl;
|
||||
NS_IF_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetURI(nsIURI* aURI)
|
||||
{
|
||||
mUrl = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OpenInputStream(nsIInputStream **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, mHost, BUFFER_SEG_SIZE,
|
||||
BUFFER_MAX_SIZE, getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return channel->OpenInputStream(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::AsyncOpen(nsIStreamObserver *observer, nsISupports* ctxt)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::AsyncRead(nsIStreamListener *aListener, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsISocketTransportService, socketService, kSocketTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = socketService->CreateTransport(mHost, mPort, mHost, BUFFER_SEG_SIZE,
|
||||
BUFFER_MAX_SIZE, getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mListener = aListener;
|
||||
mResponseContext = ctxt;
|
||||
mTransport = channel;
|
||||
|
||||
return SendRequest(channel);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::AsyncWrite(nsIInputStream *fromStream,
|
||||
nsIStreamObserver *observer,
|
||||
nsISupports *ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetLoadAttributes(PRUint32 *aLoadAttributes)
|
||||
{
|
||||
*aLoadAttributes = mLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
|
||||
{
|
||||
mLoadAttributes = aLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define FINGER_TYPE TEXT_PLAIN
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetContentType(char* *aContentType) {
|
||||
if (!aContentType) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aContentType = nsCRT::strdup(FINGER_TYPE);
|
||||
if (!*aContentType) return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetContentType(const char *aContentType)
|
||||
{
|
||||
//It doesn't make sense to set the content-type on this type
|
||||
// of channel...
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetBufferSegmentSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::GetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
NS_NOTREACHED("nsFingerChannel::SetBufferMaxSize");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetShouldCache(PRBool *aShouldCache)
|
||||
{
|
||||
*aShouldCache = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
*aLoadGroup = mLoadGroup;
|
||||
NS_IF_ADDREF(*aLoadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
mLoadGroup = aLoadGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetOwner(nsISupports* *aOwner)
|
||||
{
|
||||
*aOwner = mOwner.get();
|
||||
NS_IF_ADDREF(*aOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetOwner(nsISupports* aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
||||
{
|
||||
*aNotificationCallbacks = mCallbacks.get();
|
||||
NS_IF_ADDREF(*aNotificationCallbacks);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
|
||||
{
|
||||
mCallbacks = aNotificationCallbacks;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) {
|
||||
if (!mActAsObserver) {
|
||||
// acting as a listener
|
||||
return mListener->OnStartRequest(this, aContext);
|
||||
} else {
|
||||
// we don't want to pass our AsyncWrite's OnStart through
|
||||
// we just ignore this
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsresult aStatus, const PRUnichar* aMsg) {
|
||||
#ifdef DEBUG_bryner
|
||||
printf("nsFingerChannel::OnStopRequest, mActAsObserver=%d\n",
|
||||
mActAsObserver);
|
||||
printf(" aChannel = %p\n", aChannel);
|
||||
#endif
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (NS_FAILED(aStatus) || !mActAsObserver) {
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->RemoveChannel(this, nsnull, aStatus, aMsg);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
rv = mListener->OnStopRequest(this, aContext, aStatus, aMsg);
|
||||
mTransport = 0;
|
||||
return rv;
|
||||
} else {
|
||||
// at this point we know the request has been sent.
|
||||
// we're no longer acting as an observer.
|
||||
|
||||
mActAsObserver = PR_FALSE;
|
||||
return aChannel->AsyncRead(this, mResponseContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// nsIStreamListener method
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::OnDataAvailable(nsIChannel* aChannel, nsISupports* aContext,
|
||||
nsIInputStream *aInputStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
mContentLength = aLength;
|
||||
return mListener->OnDataAvailable(this, aContext, aInputStream, aSourceOffset, aLength);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFingerChannel::SendRequest(nsIChannel* aChannel) {
|
||||
// The text to send should already be in mUser
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsISupports> result;
|
||||
nsCOMPtr<nsIInputStream> charstream;
|
||||
nsCString requestBuffer(mUser);
|
||||
|
||||
if (mLoadGroup) {
|
||||
mLoadGroup->AddChannel(this, nsnull);
|
||||
}
|
||||
|
||||
requestBuffer.Append(CRLF);
|
||||
|
||||
mRequest = requestBuffer.ToNewCString();
|
||||
|
||||
rv = NS_NewCharInputStream(getter_AddRefs(result), mRequest);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
charstream = do_QueryInterface(result, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef DEBUG_bryner
|
||||
printf("Sending: %s\n", requestBuffer.GetBuffer());
|
||||
#endif
|
||||
|
||||
rv = aChannel->SetTransferCount(requestBuffer.Length());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = aChannel->AsyncWrite(charstream, this, 0);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
84
mozilla/extensions/finger/nsFingerChannel.h
Normal file
84
mozilla/extensions/finger/nsFingerChannel.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsFingerChannel_h___
|
||||
#define nsFingerChannel_h___
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsFingerHandler.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
|
||||
class nsFingerChannel : public nsIChannel, public nsIStreamListener {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
|
||||
// nsFingerChannel methods:
|
||||
nsFingerChannel();
|
||||
virtual ~nsFingerChannel();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
|
||||
nsresult Init(nsIURI* uri);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
PRUint32 mLoadAttributes;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCString mContentType;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
PRBool mActAsObserver;
|
||||
|
||||
PRInt32 mPort;
|
||||
nsXPIDLCString mHost;
|
||||
nsXPIDLCString mUser;
|
||||
|
||||
nsXPIDLCString mRequest;
|
||||
|
||||
nsCOMPtr<nsISupports> mResponseContext;
|
||||
nsCOMPtr<nsIChannel> mTransport;
|
||||
nsresult mStatus;
|
||||
|
||||
protected:
|
||||
nsresult SendRequest(nsIChannel* aChannel);
|
||||
};
|
||||
|
||||
#endif /* nsFingerChannel_h___ */
|
||||
116
mozilla/extensions/finger/nsFingerHandler.cpp
Normal file
116
mozilla/extensions/finger/nsFingerHandler.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsFingerChannel.h"
|
||||
#include "nsFingerHandler.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFingerHandler::nsFingerHandler() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsFingerHandler::~nsFingerHandler() {
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsFingerHandler, NS_GET_IID(nsIProtocolHandler));
|
||||
|
||||
NS_METHOD
|
||||
nsFingerHandler::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult) {
|
||||
|
||||
nsFingerHandler* ph = new nsFingerHandler();
|
||||
if (ph == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(ph);
|
||||
nsresult rv = ph->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(ph);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIProtocolHandler methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerHandler::GetScheme(char* *result) {
|
||||
*result = nsCRT::strdup("finger");
|
||||
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerHandler::GetDefaultPort(PRInt32 *result) {
|
||||
*result = FINGER_PORT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **result) {
|
||||
nsresult rv;
|
||||
|
||||
// no concept of a relative finger url
|
||||
NS_ASSERTION(!aBaseURI, "base url passed into finger protocol handler");
|
||||
|
||||
nsIURI* url;
|
||||
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
|
||||
NS_GET_IID(nsIURI),
|
||||
(void**)&url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = url->SetSpec((char*)aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerHandler::NewChannel(nsIURI* url, nsIChannel* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsFingerChannel* channel;
|
||||
rv = nsFingerChannel::Create(nsnull, NS_GET_IID(nsIChannel), (void**)&channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->Init(url);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(channel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = channel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
52
mozilla/extensions/finger/nsFingerHandler.h
Normal file
52
mozilla/extensions/finger/nsFingerHandler.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// The finger protocol handler creates "finger" URIs of the form
|
||||
// "finger:user@host" or "finger:host".
|
||||
|
||||
#ifndef nsFingerHandler_h___
|
||||
#define nsFingerHandler_h___
|
||||
|
||||
#include "nsIProtocolHandler.h"
|
||||
|
||||
#define FINGER_PORT 79
|
||||
|
||||
// {0x76d6d5d8-1dd2-11b2-b361-850ddf15ef07}
|
||||
#define NS_FINGERHANDLER_CID \
|
||||
{ 0x76d6d5d8, 0x1dd2, 0x11b2, \
|
||||
{0xb3, 0x61, 0x85, 0x0d, 0xdf, 0x15, 0xef, 0x07} }
|
||||
|
||||
class nsFingerHandler : public nsIProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
|
||||
// nsFingerHandler methods:
|
||||
nsFingerHandler();
|
||||
virtual ~nsFingerHandler();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
};
|
||||
|
||||
#endif /* nsFingerHandler_h___ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
@@ -10,22 +10,25 @@
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Troy Chevalier <troy@netscape.com>
|
||||
* Sean Su <ssu@netscape.com>
|
||||
*/
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// nszip.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsFingerHandler.h"
|
||||
|
||||
#include "stdafx.h"
|
||||
static nsModuleComponentInfo gResComponents[] = {
|
||||
{ "The Finger Protocol Handler",
|
||||
NS_FINGERHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_PROGID_PREFIX "finger",
|
||||
nsFingerHandler::Create
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("finger", gResComponents)
|
||||
39
mozilla/modules/libjar/nsIJARChannel.idl
Normal file
39
mozilla/modules/libjar/nsIJARChannel.idl
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIChannel.idl"
|
||||
|
||||
interface nsISimpleEnumerator;
|
||||
|
||||
[scriptable, uuid(c7e410d1-85f2-11d3-9f63-006008a6efe9)]
|
||||
interface nsIJARChannel : nsIChannel
|
||||
{
|
||||
|
||||
/**
|
||||
* Enumerates all the entries in the JAR (the root URI).
|
||||
* ARGUMENTS:
|
||||
* aRoot - a string representing the root dir to enumerate from
|
||||
* or null to enumerate the whole thing.
|
||||
*/
|
||||
nsISimpleEnumerator EnumerateEntries(in string aRoot);
|
||||
|
||||
};
|
||||
32
mozilla/modules/libjar/nsIJARProtocolHandler.idl
Normal file
32
mozilla/modules/libjar/nsIJARProtocolHandler.idl
Normal file
@@ -0,0 +1,32 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIProtocolHandler.idl"
|
||||
|
||||
[scriptable, uuid(92c3b42c-98c4-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsIJARProtocolHandler : nsIProtocolHandler {
|
||||
|
||||
/**
|
||||
* Add any jar-specific methods here later.
|
||||
*/
|
||||
|
||||
};
|
||||
42
mozilla/modules/libjar/nsIJARURI.idl
Normal file
42
mozilla/modules/libjar/nsIJARURI.idl
Normal file
@@ -0,0 +1,42 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsIURI.idl"
|
||||
|
||||
/**
|
||||
* JAR URLs have the following syntax
|
||||
*
|
||||
* jar:<jar-file-uri>!/<jar-entry>
|
||||
*
|
||||
* EXAMPLE: jar:http://www.big.com/blue.jar!/ocean.html
|
||||
*/
|
||||
[scriptable, uuid(c7e410d3-85f2-11d3-9f63-006008a6efe9)]
|
||||
interface nsIJARURI : nsIURI {
|
||||
|
||||
/**
|
||||
* Returns the root URI (the one for the actual JAR file) for this JAR.
|
||||
* eg http://www.big.com/blue.jar
|
||||
*/
|
||||
attribute nsIURI JARFile;
|
||||
|
||||
/**
|
||||
* Returns the entry specified for this JAR URI.
|
||||
* eg ocean.html
|
||||
*/
|
||||
attribute string JAREntry;
|
||||
};
|
||||
978
mozilla/modules/libjar/nsJARChannel.cpp
Normal file
978
mozilla/modules/libjar/nsJARChannel.cpp
Normal file
@@ -0,0 +1,978 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nsJARChannel.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsIAggregatePrincipal.h"
|
||||
|
||||
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
|
||||
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
|
||||
static NS_DEFINE_CID(kScriptSecurityManagerCID, NS_SCRIPTSECURITYMANAGER_CID);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
#include "nsXPIDLString.h"
|
||||
//
|
||||
// Log module for SocketTransport logging...
|
||||
//
|
||||
// To enable logging (see prlog.h for full details):
|
||||
//
|
||||
// set NSPR_LOG_MODULES=nsJarProtocol:5
|
||||
// set NSPR_LOG_FILE=nspr.log
|
||||
//
|
||||
// this enables PR_LOG_DEBUG level information and places all output in
|
||||
// the file nspr.log
|
||||
//
|
||||
PRLogModuleInfo* gJarProtocolLog = nsnull;
|
||||
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsJARDownloadObserver : public nsIStreamObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD OnStartRequest(nsIChannel* jarCacheTransport,
|
||||
nsISupports* context) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* jarCacheTransport,
|
||||
nsISupports* context,
|
||||
nsresult status,
|
||||
const PRUnichar* aMsg) {
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoMonitor monitor(mJARChannel->mMonitor);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
nsCOMPtr<nsIURI> jarURI;
|
||||
rv = jarCacheTransport->GetURI(getter_AddRefs(jarURI));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsXPIDLCString jarURLStr;
|
||||
rv = jarURI->GetSpec(getter_Copies(jarURLStr));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: jar download complete %s status=%x",
|
||||
(const char*)jarURLStr, status));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (NS_SUCCEEDED(status) && mJARChannel->mJarCacheTransport) {
|
||||
NS_ASSERTION(jarCacheTransport == (mJARChannel->mJarCacheTransport).get(),
|
||||
"wrong transport");
|
||||
// after successfully downloading the jar file to the cache,
|
||||
// start the extraction process:
|
||||
nsCOMPtr<nsIFileChannel> jarCacheFile;
|
||||
rv = NS_NewLocalFileChannel(getter_AddRefs(jarCacheFile),
|
||||
mJarCacheFile,
|
||||
PR_RDONLY,
|
||||
0);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarCacheFile->SetLoadGroup(mJARChannel->mLoadGroup);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarCacheFile->SetBufferSegmentSize(mJARChannel->mBufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarCacheFile->SetBufferMaxSize(mJARChannel->mBufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarCacheFile->SetLoadAttributes(mJARChannel->mLoadAttributes);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarCacheFile->SetNotificationCallbacks(mJARChannel->mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mJARChannel->SetJARBaseFile(jarCacheFile);
|
||||
rv = mOnJARFileAvailable(mJARChannel, mClosure);
|
||||
}
|
||||
mJARChannel->mJarCacheTransport = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsJARDownloadObserver(nsIFile* jarCacheFile, nsJARChannel* jarChannel,
|
||||
OnJARFileAvailableFun onJARFileAvailable,
|
||||
void* closure)
|
||||
: mJarCacheFile(jarCacheFile),
|
||||
mJARChannel(jarChannel),
|
||||
mOnJARFileAvailable(onJARFileAvailable),
|
||||
mClosure(closure)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_ADDREF(mJARChannel);
|
||||
}
|
||||
|
||||
virtual ~nsJARDownloadObserver() {
|
||||
NS_RELEASE(mJARChannel);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIFile> mJarCacheFile;
|
||||
nsJARChannel* mJARChannel;
|
||||
OnJARFileAvailableFun mOnJARFileAvailable;
|
||||
void* mClosure;
|
||||
};
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARDownloadObserver, nsIStreamObserver)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsJARChannel::nsJARChannel()
|
||||
: mContentType(nsnull),
|
||||
mContentLength(-1),
|
||||
mLoadAttributes(LOAD_NORMAL),
|
||||
mStartPosition(0),
|
||||
mReadCount(-1),
|
||||
mJAREntry(nsnull),
|
||||
mMonitor(nsnull),
|
||||
mStatus(NS_OK)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
// Initialize the global PRLogModule for socket transport logging
|
||||
// if necessary...
|
||||
//
|
||||
if (nsnull == gJarProtocolLog) {
|
||||
gJarProtocolLog = PR_NewLogModule("nsJarProtocol");
|
||||
}
|
||||
#endif /* PR_LOGGING */
|
||||
}
|
||||
|
||||
nsJARChannel::~nsJARChannel()
|
||||
{
|
||||
if (mContentType)
|
||||
nsCRT::free(mContentType);
|
||||
if (mJAREntry)
|
||||
nsCRT::free(mJAREntry);
|
||||
if (mMonitor)
|
||||
PR_DestroyMonitor(mMonitor);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS6(nsJARChannel,
|
||||
nsIJARChannel,
|
||||
nsIChannel,
|
||||
nsIRequest,
|
||||
nsIStreamObserver,
|
||||
nsIStreamListener,
|
||||
nsIFileSystem)
|
||||
|
||||
NS_METHOD
|
||||
nsJARChannel::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsJARChannel* jarChannel = new nsJARChannel();
|
||||
if (jarChannel == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(jarChannel);
|
||||
rv = jarChannel->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(jarChannel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARChannel::Init(nsIJARProtocolHandler* aHandler, nsIURI* uri)
|
||||
{
|
||||
nsresult rv;
|
||||
mURI = do_QueryInterface(uri, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mMonitor = PR_NewMonitor();
|
||||
if (mMonitor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::IsPending(PRBool* result)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::IsPending");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetStatus(nsresult *status)
|
||||
{
|
||||
*status = mStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Cancel(nsresult status)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
|
||||
if (mJarCacheTransport) {
|
||||
rv = mJarCacheTransport->Cancel(status);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mJarCacheTransport = nsnull;
|
||||
}
|
||||
if (mJarExtractionTransport) {
|
||||
rv = mJarExtractionTransport->Cancel(status);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mJarExtractionTransport = nsnull;
|
||||
}
|
||||
mStatus = status;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Suspend()
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
|
||||
if (mJarCacheTransport) {
|
||||
rv = mJarCacheTransport->Suspend();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (mJarExtractionTransport) {
|
||||
rv = mJarExtractionTransport->Suspend();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Resume()
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
|
||||
if (mJarCacheTransport) {
|
||||
rv = mJarCacheTransport->Resume();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (mJarExtractionTransport) {
|
||||
rv = mJarExtractionTransport->Resume();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetOriginalURI(nsIURI* *aOriginalURI)
|
||||
{
|
||||
*aOriginalURI = mOriginalURI ? mOriginalURI : nsCOMPtr<nsIURI>(mURI);
|
||||
NS_ADDREF(*aOriginalURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetOriginalURI(nsIURI* aOriginalURI)
|
||||
{
|
||||
mOriginalURI = aOriginalURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mURI;
|
||||
NS_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetURI(nsIURI* aURI)
|
||||
{
|
||||
nsresult rv;
|
||||
mURI = do_QueryInterface(aURI, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
OpenJARElement(nsJARChannel* channel, void* closure)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIInputStream* *result = (nsIInputStream**)closure;
|
||||
nsAutoCMonitor mon(channel);
|
||||
rv = channel->Open(nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = channel->GetInputStream(result);
|
||||
mon.Notify(); // wake up OpenInputStream
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OpenInputStream(nsIInputStream* *result)
|
||||
{
|
||||
nsAutoCMonitor mon(this);
|
||||
nsresult rv;
|
||||
*result = nsnull;
|
||||
rv = EnsureJARFileAvailable(OpenJARElement, result);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (*result == nsnull)
|
||||
mon.Wait();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OpenOutputStream(nsIOutputStream* *result)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::OpenOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::AsyncOpen(nsIStreamObserver* observer, nsISupports* ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::AsyncOpen");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
ReadJARElement(nsJARChannel* channel, void* closure)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = channel->AsyncReadJARElement();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::AsyncRead(nsIStreamListener* listener, nsISupports* ctxt)
|
||||
{
|
||||
mUserContext = ctxt;
|
||||
mUserListener = listener;
|
||||
return EnsureJARFileAvailable(ReadJARElement, nsnull);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARChannel::EnsureJARFileAvailable(OnJARFileAvailableFun onJARFileAvailable,
|
||||
void* closure)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
nsXPIDLCString jarURLStr;
|
||||
mURI->GetSpec(getter_Copies(jarURLStr));
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: EnsureJARFileAvailable %s", (const char*)jarURLStr));
|
||||
#endif
|
||||
|
||||
rv = mURI->GetJARFile(getter_AddRefs(mJARBaseURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mURI->GetJAREntry(&mJAREntry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> jarBaseChannel;
|
||||
rv = NS_OpenURI(getter_AddRefs(jarBaseChannel), mJARBaseURI, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarBaseChannel->SetLoadGroup(mLoadGroup);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarBaseChannel->SetLoadAttributes(mLoadAttributes);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarBaseChannel->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mLoadGroup)
|
||||
(void)mLoadGroup->AddChannel(this, nsnull);
|
||||
|
||||
// mJARBaseFile = do_QueryInterface(jarBaseChannel, &rv);
|
||||
|
||||
PRBool shouldCache;
|
||||
rv = jarBaseChannel->GetShouldCache(&shouldCache);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !shouldCache) {
|
||||
// then we've already got a local jar file -- no need to download it
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: extracting local jar file %s", (const char*)jarURLStr));
|
||||
rv = onJARFileAvailable(this, closure);
|
||||
}
|
||||
else {
|
||||
// otherwise, we need to download the jar file
|
||||
|
||||
nsCOMPtr<nsIFile> jarCacheFile;
|
||||
rv = GetCacheFile(getter_AddRefs(jarCacheFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool filePresent;
|
||||
|
||||
rv = jarCacheFile->IsFile(&filePresent);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && filePresent)
|
||||
{
|
||||
// then we've already got the file in the local cache -- no need to download it
|
||||
rv = NS_NewLocalFileChannel(getter_AddRefs(mJARBaseFile),
|
||||
jarCacheFile,
|
||||
PR_RDONLY,
|
||||
0);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJARBaseFile->SetBufferSegmentSize(mBufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJARBaseFile->SetBufferMaxSize(mBufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: jar file already in cache %s", (const char*)jarURLStr));
|
||||
rv = onJARFileAvailable(this, closure);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
|
||||
// use a file transport to serve as a data pump for the download (done
|
||||
// on some other thread)
|
||||
nsCOMPtr<nsIChannel> jarCacheTransport;
|
||||
rv = fts->CreateTransport(jarCacheFile, PR_RDONLY, 0,
|
||||
getter_AddRefs(mJarCacheTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarCacheTransport->SetBufferSegmentSize(mBufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarCacheTransport->SetBufferMaxSize(mBufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJarCacheTransport->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIStreamObserver> downloadObserver =
|
||||
new nsJARDownloadObserver(jarCacheFile, this, onJARFileAvailable, closure);
|
||||
if (downloadObserver == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: downloading jar file %s", (const char*)jarURLStr));
|
||||
nsCOMPtr<nsIInputStream> jarBaseIn;
|
||||
rv = jarBaseChannel->OpenInputStream(getter_AddRefs(jarBaseIn));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJarCacheTransport->AsyncWrite(jarBaseIn, nsnull, downloadObserver);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARChannel::GetCacheFile(nsIFile* *cacheFile)
|
||||
{
|
||||
// XXX change later to use the real network cache
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFile> jarCacheFile;
|
||||
rv = NS_GetSpecialDirectory("xpcom.currentProcess.componentDirectory",
|
||||
getter_AddRefs(jarCacheFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
jarCacheFile->Append("jarCache");
|
||||
|
||||
PRBool exists;
|
||||
rv = jarCacheFile->Exists(&exists);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!exists) {
|
||||
rv = jarCacheFile->Create(nsIFile::DIRECTORY_TYPE, 0664);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURL> jarBaseURL = do_QueryInterface(mJARBaseURI, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char* jarFileName;
|
||||
rv = jarBaseURL->GetFileName(&jarFileName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = jarCacheFile->Append(jarFileName);
|
||||
nsCRT::free(jarFileName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*cacheFile = jarCacheFile;
|
||||
NS_ADDREF(*cacheFile);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARChannel::AsyncReadJARElement()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
|
||||
NS_ASSERTION(mJARBaseFile, "mJARBaseFile is null");
|
||||
|
||||
if (mLoadGroup) {
|
||||
nsCOMPtr<nsILoadGroupListenerFactory> factory;
|
||||
//
|
||||
// Create a load group "proxy" listener...
|
||||
//
|
||||
rv = mLoadGroup->GetGroupListenerFactory(getter_AddRefs(factory));
|
||||
if (factory) {
|
||||
nsIStreamListener *newListener;
|
||||
rv = factory->CreateLoadGroupListener(mUserListener, &newListener);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mUserListener = newListener;
|
||||
NS_RELEASE(newListener);
|
||||
}
|
||||
}
|
||||
|
||||
rv = mLoadGroup->AddChannel(this, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = fts->CreateTransportFromFileSystem(this,
|
||||
getter_AddRefs(mJarExtractionTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetBufferSegmentSize(mBufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetBufferMaxSize(mBufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJarExtractionTransport->SetNotificationCallbacks(mCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
nsXPIDLCString jarURLStr;
|
||||
mURI->GetSpec(getter_Copies(jarURLStr));
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: AsyncRead jar entry %s", (const char*)jarURLStr));
|
||||
#endif
|
||||
rv = mJarExtractionTransport->SetTransferOffset(mStartPosition);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->SetTransferCount(mReadCount);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mJarExtractionTransport->AsyncRead(this, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::AsyncWrite(nsIInputStream* fromStream,
|
||||
nsIStreamObserver* observer,
|
||||
nsISupports* ctxt)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::AsyncWrite");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetLoadAttributes(PRUint32* aLoadFlags)
|
||||
{
|
||||
*aLoadFlags = mLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetLoadAttributes(PRUint32 aLoadFlags)
|
||||
{
|
||||
mLoadAttributes = aLoadFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentType(char* *aContentType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mContentType == nsnull) {
|
||||
char* fileName = new char[PL_strlen(mJAREntry)+1];
|
||||
PL_strcpy(fileName, mJAREntry);
|
||||
|
||||
if (fileName != nsnull) {
|
||||
PRInt32 len = nsCRT::strlen(fileName);
|
||||
const char* ext = nsnull;
|
||||
for (PRInt32 i = len; i >= 0; i--) {
|
||||
if (fileName[i] == '.') {
|
||||
ext = &fileName[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ext) {
|
||||
NS_WITH_SERVICE(nsIMIMEService, mimeServ, kMIMEServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = mimeServ->GetTypeFromExtension(ext, &mContentType);
|
||||
}
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCRT::free(fileName);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
mContentType = nsCRT::strdup(UNKNOWN_CONTENT_TYPE);
|
||||
if (mContentType == nsnull)
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aContentType = nsCRT::strdup(mContentType);
|
||||
if (*aContentType == nsnull)
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentType(const char *aContentType)
|
||||
{
|
||||
if (mContentType) {
|
||||
nsCRT::free(mContentType);
|
||||
}
|
||||
|
||||
mContentType = nsCRT::strdup(aContentType);
|
||||
if (!mContentType) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentLength(PRInt32* aContentLength)
|
||||
{
|
||||
if (mContentLength == -1)
|
||||
return NS_ERROR_FAILURE;
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
*aTransferOffset = mStartPosition;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
mStartPosition = aTransferOffset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
*aTransferCount = mReadCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
mReadCount = aTransferCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
*aBufferSegmentSize = mBufferSegmentSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
mBufferSegmentSize = aBufferSegmentSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
*aBufferMaxSize = mBufferMaxSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
mBufferMaxSize = aBufferMaxSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetShouldCache(PRBool *aShouldCache)
|
||||
{
|
||||
// Jar files report that you shouldn't cache them because this is really
|
||||
// a question about the jar entry, and the jar entry is always in a jar
|
||||
// file on disk.
|
||||
*aShouldCache = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
*aLoadGroup = mLoadGroup;
|
||||
NS_IF_ADDREF(*aLoadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
mLoadGroup = aLoadGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetOwner(nsISupports* *aOwner)
|
||||
{
|
||||
if (!mOwner)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> certificate;
|
||||
PRInt16 result;
|
||||
nsresult rv = mJAR->GetCertificatePrincipal(mJAREntry,
|
||||
getter_AddRefs(certificate),
|
||||
&result);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
if (certificate)
|
||||
{ // Get the codebase principal
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
kScriptSecurityManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIPrincipal> codebase;
|
||||
rv = secMan->GetCodebasePrincipal(mJARBaseURI,
|
||||
getter_AddRefs(codebase));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Join the certificate and the codebase
|
||||
nsCOMPtr<nsIAggregatePrincipal> agg;
|
||||
agg = do_QueryInterface(certificate, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),
|
||||
"Certificate principal is not an aggregate");
|
||||
rv = agg->SetCodebase(codebase);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mOwner = do_QueryInterface(agg, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
*aOwner = mOwner;
|
||||
NS_IF_ADDREF(*aOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetOwner(nsISupports* aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
||||
{
|
||||
*aNotificationCallbacks = mCallbacks.get();
|
||||
NS_IF_ADDREF(*aNotificationCallbacks);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
|
||||
{
|
||||
mCallbacks = aNotificationCallbacks;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamObserver methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStartRequest(nsIChannel* jarExtractionTransport,
|
||||
nsISupports* context)
|
||||
{
|
||||
return mUserListener->OnStartRequest(this, mUserContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport,
|
||||
nsISupports* context,
|
||||
nsresult status,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv;
|
||||
#ifdef PR_LOGGING
|
||||
nsCOMPtr<nsIURI> jarURI;
|
||||
nsXPIDLCString jarURLStr;
|
||||
rv = mURI->GetSpec(getter_Copies(jarURLStr));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: jar extraction complete %s status=%x",
|
||||
(const char*)jarURLStr, status));
|
||||
}
|
||||
#endif
|
||||
rv = mUserListener->OnStopRequest(this, mUserContext, status, aMsg);
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, status, aMsg);
|
||||
}
|
||||
}
|
||||
|
||||
mUserListener = nsnull;
|
||||
mUserContext = nsnull;
|
||||
mJarExtractionTransport = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamListener methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnDataAvailable(nsIChannel* jarCacheTransport,
|
||||
nsISupports* context,
|
||||
nsIInputStream *inStr,
|
||||
PRUint32 sourceOffset,
|
||||
PRUint32 count)
|
||||
{
|
||||
return mUserListener->OnDataAvailable(this, mUserContext,
|
||||
inStr, sourceOffset, count);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIFileSystem methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Open(char* *contentType, PRInt32 *contentLength)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ASSERTION(mJARBaseFile, "mJARBaseFile is null");
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kZipReaderCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIZipReader),
|
||||
getter_AddRefs(mJAR));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIFile> fs;
|
||||
rv = mJARBaseFile->GetFile(getter_AddRefs(fs));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJAR->Init(fs);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJAR->Open();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// If this fails, GetOwner will fail, but otherwise we can continue.
|
||||
mJAR->ParseManifest();
|
||||
|
||||
nsCOMPtr<nsIZipEntry> entry;
|
||||
rv = mJAR->GetEntry(mJAREntry, getter_AddRefs(entry));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (contentLength) {
|
||||
rv = entry->GetRealSize((PRUint32*)contentLength);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
if (contentType) {
|
||||
rv = GetContentType(contentType);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Close(nsresult status)
|
||||
{
|
||||
mJAR = null_nsCOMPtr();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetInputStream(nsIInputStream* *aInputStream)
|
||||
{
|
||||
#ifdef PR_LOGGING
|
||||
nsXPIDLCString jarURLStr;
|
||||
mURI->GetSpec(getter_Copies(jarURLStr));
|
||||
PR_LOG(gJarProtocolLog, PR_LOG_DEBUG,
|
||||
("nsJarProtocol: GetInputStream jar entry %s", (const char*)jarURLStr));
|
||||
#endif
|
||||
return mJAR->GetInputStream(mJAREntry, aInputStream);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetOutputStream(nsIOutputStream* *aOutputStream)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::GetOutputStream");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIJARChannel methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::EnumerateEntries(const char *aRoot, nsISimpleEnumerator **_retval)
|
||||
{
|
||||
NS_NOTREACHED("nsJARChannel::EnumerateEntries");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
115
mozilla/modules/libjar/nsJARChannel.h
Normal file
115
mozilla/modules/libjar/nsJARChannel.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsJARChannel_h__
|
||||
#define nsJARChannel_h__
|
||||
|
||||
#include "nsIJARChannel.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIJARProtocolHandler.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIFileSystem.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIZipReader.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFile.h"
|
||||
#include "prmon.h"
|
||||
|
||||
class nsIFileChannel;
|
||||
class nsJARChannel;
|
||||
|
||||
#define NS_JARCHANNEL_CID \
|
||||
{ /* 0xc7e410d5-0x85f2-11d3-9f63-006008a6efe9 */ \
|
||||
0xc7e410d5, \
|
||||
0x85f2, \
|
||||
0x11d3, \
|
||||
{0x9f, 0x63, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9} \
|
||||
}
|
||||
|
||||
#define JAR_DIRECTORY "jarCache"
|
||||
|
||||
typedef nsresult
|
||||
(*OnJARFileAvailableFun)(nsJARChannel* channel, void* closure);
|
||||
|
||||
class nsJARChannel : public nsIJARChannel,
|
||||
public nsIStreamListener,
|
||||
public nsIFileSystem
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIJARCHANNEL
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSIFILESYSTEM
|
||||
|
||||
nsJARChannel();
|
||||
virtual ~nsJARChannel();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init(nsIJARProtocolHandler* aHandler, nsIURI* uri);
|
||||
nsresult EnsureJARFileAvailable(OnJARFileAvailableFun fun,
|
||||
void* closure);
|
||||
nsresult AsyncReadJARElement();
|
||||
nsresult GetCacheFile(nsIFile* *cacheFile);
|
||||
|
||||
void SetJARBaseFile(nsIFileChannel* channel) { mJARBaseFile = channel; }
|
||||
|
||||
friend class nsJARDownloadObserver;
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIJARURI> mURI;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsLoadFlags mLoadAttributes;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
||||
PRUint32 mStartPosition;
|
||||
PRInt32 mReadCount;
|
||||
nsCOMPtr<nsISupports> mUserContext;
|
||||
nsCOMPtr<nsIStreamListener> mUserListener;
|
||||
|
||||
char* mContentType;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsIURI> mJARBaseURI;
|
||||
nsCOMPtr<nsIFileChannel> mJARBaseFile;
|
||||
char* mJAREntry;
|
||||
nsCOMPtr<nsIZipReader> mJAR;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
nsresult mStatus;
|
||||
|
||||
PRMonitor* mMonitor;
|
||||
nsCOMPtr<nsIChannel> mJarCacheTransport;
|
||||
nsCOMPtr<nsIChannel> mJarExtractionTransport;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsJARChannel_h__
|
||||
138
mozilla/modules/libjar/nsJARProtocolHandler.cpp
Normal file
138
mozilla/modules/libjar/nsJARProtocolHandler.cpp
Normal file
@@ -0,0 +1,138 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsJARProtocolHandler.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsJARURI.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsJARChannel.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
static NS_DEFINE_CID(kJARUriCID, NS_JARURI_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsJARProtocolHandler::nsJARProtocolHandler()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARProtocolHandler::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsJARProtocolHandler::~nsJARProtocolHandler()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsJARProtocolHandler,
|
||||
nsIJARProtocolHandler,
|
||||
nsIProtocolHandler)
|
||||
|
||||
NS_METHOD
|
||||
nsJARProtocolHandler::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsJARProtocolHandler* ph = new nsJARProtocolHandler();
|
||||
if (ph == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(ph);
|
||||
nsresult rv = ph->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = ph->QueryInterface(aIID, aResult);
|
||||
}
|
||||
NS_RELEASE(ph);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIProtocolHandler methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::GetScheme(char* *result)
|
||||
{
|
||||
*result = nsCRT::strdup("jar");
|
||||
if (*result == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::GetDefaultPort(PRInt32 *result)
|
||||
{
|
||||
*result = -1; // no port for JAR: URLs
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIURI* url;
|
||||
if (aBaseURI) {
|
||||
rv = aBaseURI->Clone(&url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = url->SetRelativePath(aSpec);
|
||||
}
|
||||
else {
|
||||
rv = nsJARURI::Create(nsnull, NS_GET_IID(nsIJARURI), (void**)&url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = url->SetSpec((char*)aSpec);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsJARChannel* channel;
|
||||
rv = nsJARChannel::Create(nsnull, NS_GET_IID(nsIJARChannel), (void**)&channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->Init(this, uri);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(channel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = channel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
57
mozilla/modules/libjar/nsJARProtocolHandler.h
Normal file
57
mozilla/modules/libjar/nsJARProtocolHandler.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsJARProtocolHandler_h___
|
||||
#define nsJARProtocolHandler_h___
|
||||
|
||||
#include "nsIJARProtocolHandler.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIJARURI.h"
|
||||
|
||||
#define NS_JARPROTOCOLHANDLER_CID \
|
||||
{ /* 0xc7e410d4-0x85f2-11d3-9f63-006008a6efe9 */ \
|
||||
0xc7e410d4, \
|
||||
0x85f2, \
|
||||
0x11d3, \
|
||||
{0x9f, 0x63, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9} \
|
||||
}
|
||||
|
||||
|
||||
class nsJARProtocolHandler : public nsIJARProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
|
||||
// nsJARProtocolHandler methods:
|
||||
nsJARProtocolHandler();
|
||||
virtual ~nsJARProtocolHandler();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif /* nsJARProtocolHandler_h___ */
|
||||
38
mozilla/modules/libjar/nsJARProtocolModule.cpp
Normal file
38
mozilla/modules/libjar/nsJARProtocolModule.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsJARProtocolHandler.h"
|
||||
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "JAR Protocol Handler",
|
||||
NS_JARPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_PROGID_PREFIX "jar",
|
||||
nsJARProtocolHandler::Create
|
||||
},
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsJarProtocolModule", components);
|
||||
|
||||
|
||||
384
mozilla/modules/libjar/nsJARURI.cpp
Normal file
384
mozilla/modules/libjar/nsJARURI.cpp
Normal file
@@ -0,0 +1,384 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsJARURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIZipReader.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsJARURI::nsJARURI()
|
||||
: mJAREntry(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsJARURI::~nsJARURI()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsJARURI, nsIJARURI, nsIURI)
|
||||
|
||||
NS_METHOD
|
||||
nsJARURI::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsJARURI* uri = new nsJARURI();
|
||||
|
||||
if (uri == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(uri);
|
||||
nsresult rv = uri->Init();
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = uri->QueryInterface(aIID, aResult);
|
||||
}
|
||||
NS_RELEASE(uri);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARURI::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define NS_JAR_SCHEME "jar:"
|
||||
#define NS_JAR_DELIMITER "!/"
|
||||
|
||||
nsresult
|
||||
nsJARURI::FormatSpec(const char* entryPath, char* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
char* jarFileSpec;
|
||||
rv = mJARFile->GetSpec(&jarFileSpec);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCString spec(NS_JAR_SCHEME);
|
||||
spec += jarFileSpec;
|
||||
nsCRT::free(jarFileSpec);
|
||||
spec += NS_JAR_DELIMITER;
|
||||
spec += entryPath;
|
||||
|
||||
*result = nsCRT::strdup(spec);
|
||||
return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsURI methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetSpec(char* *aSpec)
|
||||
{
|
||||
return FormatSpec(mJAREntry, aSpec);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetSpec(const char * aSpec)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRUint32 startPos, endPos;
|
||||
rv = serv->ExtractScheme(aSpec, &startPos, &endPos, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (nsCRT::strncmp("jar", &aSpec[startPos], endPos - startPos - 1) != 0)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
// Search backward from the end for the "!/" delimiter. Remember, jar URLs
|
||||
// can nest, e.g.:
|
||||
// jar:jar:http://www.foo.com/bar.jar!/a.jar!/b.html
|
||||
// This gets the b.html document from out of the a.jar file, that's
|
||||
// contained within the bar.jar file.
|
||||
|
||||
nsCAutoString jarPath(aSpec);
|
||||
PRInt32 pos = jarPath.RFind(NS_JAR_DELIMITER);
|
||||
if (pos == -1 || endPos + 1 > (PRUint32)pos)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
jarPath.Cut(pos, jarPath.Length());
|
||||
jarPath.Cut(0, endPos);
|
||||
|
||||
rv = serv->NewURI(jarPath, nsnull, getter_AddRefs(mJARFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString entry(aSpec);
|
||||
entry.Cut(0, pos + 2); // 2 == strlen(NS_JAR_DELIMITER)
|
||||
|
||||
rv = serv->ResolveRelativePath(entry, nsnull, &mJAREntry);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetScheme(char * *aScheme)
|
||||
{
|
||||
*aScheme = nsCRT::strdup("jar");
|
||||
return *aScheme ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetScheme(const char * aScheme)
|
||||
{
|
||||
// doesn't make sense to set the scheme of a jar: URL
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetUsername(char * *aUsername)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetUsername(const char * aUsername)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPassword(char * *aPassword)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetPassword(const char * aPassword)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPreHost(char * *aPreHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetPreHost(const char * aPreHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetHost(char * *aHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetHost(const char * aHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPort(PRInt32 *aPort)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetPort(PRInt32 aPort)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPath(char * *aPath)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetPath(const char * aPath)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetURLParser(nsIURLParser * *aURLParser)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetURLParser(nsIURLParser * aURLParser)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Equals(nsIURI *other, PRBool *result)
|
||||
{
|
||||
nsresult rv;
|
||||
*result = PR_FALSE;
|
||||
|
||||
nsJARURI* otherJAR;
|
||||
rv = other->QueryInterface(NS_GET_IID(nsIJARURI), (void**)&otherJAR);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK; // not equal
|
||||
|
||||
nsCOMPtr<nsIURI> otherJARFile;
|
||||
rv = otherJAR->GetJARFile(getter_AddRefs(otherJARFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool equal;
|
||||
rv = mJARFile->Equals(otherJARFile, &equal);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!equal)
|
||||
return NS_OK; // not equal
|
||||
|
||||
char* otherJAREntry;
|
||||
rv = otherJAR->GetJAREntry(&otherJAREntry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = nsCRT::strcmp(mJAREntry, otherJAREntry) == 0;
|
||||
nsCRT::free(otherJAREntry);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Clone(nsIURI **result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIURI> newJARFile;
|
||||
rv = mJARFile->Clone(getter_AddRefs(newJARFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char* newJAREntry = nsCRT::strdup(mJAREntry);
|
||||
if (newJAREntry == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsJARURI* uri = new nsJARURI();
|
||||
if (uri == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(uri);
|
||||
uri->mJARFile = newJARFile;
|
||||
uri->mJAREntry = newJAREntry;
|
||||
*result = uri;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetRelativePath(const char *relativePath)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString path(mJAREntry);
|
||||
PRInt32 pos = path.RFind("/");
|
||||
if (pos >= 0)
|
||||
path.Truncate(pos + 1);
|
||||
else
|
||||
path = "";
|
||||
|
||||
char* resolvedEntry;
|
||||
rv = serv->ResolveRelativePath(relativePath, path.GetBuffer(),
|
||||
&resolvedEntry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCRT::free(mJAREntry);
|
||||
mJAREntry = resolvedEntry;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Resolve(const char *relativePath, char **result)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString path(mJAREntry);
|
||||
PRInt32 pos = path.RFind("/");
|
||||
if (pos >= 0)
|
||||
path.Truncate(pos + 1);
|
||||
else
|
||||
path = "";
|
||||
|
||||
char* resolvedEntry;
|
||||
rv = serv->ResolveRelativePath(relativePath, path.GetBuffer(),
|
||||
&resolvedEntry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = FormatSpec(resolvedEntry, result);
|
||||
nsCRT::free(resolvedEntry);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIJARUri methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetJARFile(nsIURI* *jarFile)
|
||||
{
|
||||
*jarFile = mJARFile;
|
||||
NS_ADDREF(*jarFile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetJARFile(nsIURI* jarFile)
|
||||
{
|
||||
mJARFile = jarFile;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetJAREntry(char* *entryPath)
|
||||
{
|
||||
nsCAutoString entry(mJAREntry);
|
||||
PRInt32 pos = entry.RFindCharInSet("#?;");
|
||||
if (pos >= 0)
|
||||
entry.Truncate(pos);
|
||||
*entryPath = entry.ToNewCString();
|
||||
return *entryPath ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetJAREntry(const char* entryPath)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mJAREntry)
|
||||
nsCRT::free(mJAREntry);
|
||||
|
||||
rv = serv->ResolveRelativePath(entryPath, nsnull, &mJAREntry);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
55
mozilla/modules/libjar/nsJARURI.h
Normal file
55
mozilla/modules/libjar/nsJARURI.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsJARURI_h__
|
||||
#define nsJARURI_h__
|
||||
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#define NS_JARURI_CID \
|
||||
{ /* 0xc7e410d7-0x85f2-11d3-9f63-006008a6efe9 */ \
|
||||
0xc7e410d7, \
|
||||
0x85f2, \
|
||||
0x11d3, \
|
||||
{0x9f, 0x63, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9} \
|
||||
}
|
||||
|
||||
class nsJARURI : public nsIJARURI
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIURI
|
||||
NS_DECL_NSIJARURI
|
||||
|
||||
// nsJARURI
|
||||
nsJARURI();
|
||||
virtual ~nsJARURI();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
nsresult FormatSpec(const char* entryPath, char* *result);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mJARFile;
|
||||
char *mJAREntry;
|
||||
};
|
||||
|
||||
#endif // nsJARURI_h__
|
||||
45
mozilla/netwerk/Makefile.in
Normal file
45
mozilla/netwerk/Makefile.in
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = \
|
||||
cache \
|
||||
base \
|
||||
dns \
|
||||
socket \
|
||||
build \
|
||||
protocol \
|
||||
mime \
|
||||
streamconv \
|
||||
$(NULL)
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += test
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
32
mozilla/netwerk/base/Makefile.in
Normal file
32
mozilla/netwerk/base/Makefile.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
31
mozilla/netwerk/base/makefile.win
Normal file
31
mozilla/netwerk/base/makefile.win
Normal file
@@ -0,0 +1,31 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ..\..
|
||||
|
||||
MODULE = necko
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
7
mozilla/netwerk/base/public/MANIFEST
Normal file
7
mozilla/netwerk/base/public/MANIFEST
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
netCore.h
|
||||
nsNetUtil.h
|
||||
nsUnixColorPrintf.h
|
||||
17
mozilla/netwerk/base/public/MANIFEST_IDL
Normal file
17
mozilla/netwerk/base/public/MANIFEST_IDL
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
nsIStreamListener.idl
|
||||
nsIStreamObserver.idl
|
||||
nsIURI.idl
|
||||
nsIURL.idl
|
||||
nsIChannel.idl
|
||||
nsIRequest.idl
|
||||
nsISocketTransportService.idl
|
||||
nsIFileTransportService.idl
|
||||
nsIFileSystem.idl
|
||||
nsIPrompt.idl
|
||||
nsIStreamLoader.idl
|
||||
nsIURLParser.idl
|
||||
nsIProtocolProxyService.idl
|
||||
67
mozilla/netwerk/base/public/Makefile.in
Normal file
67
mozilla/netwerk/base/public/Makefile.in
Normal file
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
XPIDL_MODULE = necko_base
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIFileStreams.idl \
|
||||
nsIRequest.idl \
|
||||
nsIChannel.idl \
|
||||
nsIURI.idl \
|
||||
nsIURL.idl \
|
||||
nsIStreamObserver.idl \
|
||||
nsIStreamListener.idl \
|
||||
nsIIOService.idl \
|
||||
nsIPrompt.idl \
|
||||
nsIProtocolHandler.idl \
|
||||
nsIProgressEventSink.idl \
|
||||
nsINetModRegEntry.idl \
|
||||
nsINetModuleMgr.idl \
|
||||
nsINetNotify.idl \
|
||||
nsILoadGroup.idl \
|
||||
nsIFileTransportService.idl \
|
||||
nsISocketTransportService.idl \
|
||||
nsIStatusCodeEventSink.idl \
|
||||
nsIFileSystem.idl \
|
||||
nsIStreamLoader.idl \
|
||||
nsINetPrompt.idl \
|
||||
nsISocketTransport.idl \
|
||||
nsIURLParser.idl \
|
||||
nsIProxy.idl \
|
||||
nsIProtocolProxyService.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
netCore.h \
|
||||
nsNetUtil.h \
|
||||
nsUnixColorPrintf.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
66
mozilla/netwerk/base/public/makefile.win
Normal file
66
mozilla/netwerk/base/public/makefile.win
Normal file
@@ -0,0 +1,66 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
MODULE = necko
|
||||
|
||||
DEPTH = ..\..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
EXPORTS = \
|
||||
netCore.h \
|
||||
nsNetUtil.h \
|
||||
nsUnixColorPrintf.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIFileStreams.idl \
|
||||
.\nsIRequest.idl \
|
||||
.\nsIChannel.idl \
|
||||
.\nsIURI.idl \
|
||||
.\nsIURL.idl \
|
||||
.\nsIStreamObserver.idl \
|
||||
.\nsIStreamListener.idl \
|
||||
.\nsIIOService.idl \
|
||||
.\nsIPrompt.idl \
|
||||
.\nsIProtocolHandler.idl \
|
||||
.\nsIProgressEventSink.idl \
|
||||
.\nsINetModRegEntry.idl \
|
||||
.\nsINetModuleMgr.idl \
|
||||
.\nsINetNotify.idl \
|
||||
.\nsILoadGroup.idl \
|
||||
.\nsISocketTransportService.idl \
|
||||
.\nsIFileTransportService.idl \
|
||||
.\nsIStatusCodeEventSink.idl \
|
||||
.\nsIFileSystem.idl \
|
||||
.\nsIStreamLoader.idl \
|
||||
.\nsINetPrompt.idl \
|
||||
.\nsISocketTransport.idl \
|
||||
.\nsIURLParser.idl \
|
||||
.\nsIProxy.idl \
|
||||
.\nsIProtocolProxyService.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
$(DEPTH)\netwerk\dist\include:
|
||||
-mkdir $(DEPTH)\netwerk\dist
|
||||
-mkdir $(DEPTH)\netwerk\dist\include
|
||||
|
||||
64
mozilla/netwerk/base/public/netCore.h
Normal file
64
mozilla/netwerk/base/public/netCore.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __netCore_h__
|
||||
#define __netCore_h__
|
||||
|
||||
#include "nsError.h"
|
||||
|
||||
/* networking error codes */
|
||||
|
||||
// NET RANGE: 1 -20
|
||||
// FTP RANGE: 21-30
|
||||
// HTTP RANGE: 31-40
|
||||
// DNS RANGE: 41-50
|
||||
|
||||
#define NS_ERROR_ALREADY_CONNECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 11)
|
||||
|
||||
#define NS_ERROR_NOT_CONNECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 12)
|
||||
|
||||
/* NS_ERROR_CONNECTION_REFUSED and NS_ERROR_NET_TIMEOUT moved to nsISocketTransportService.idl */
|
||||
|
||||
#define NS_ERROR_IN_PROGRESS \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 15)
|
||||
|
||||
#define NS_ERROR_OFFLINE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 16)
|
||||
|
||||
#undef NS_NET
|
||||
#ifdef _IMPL_NS_NET
|
||||
#ifdef XP_PC
|
||||
#define NS_NET _declspec(dllexport)
|
||||
#else /* !XP_PC */
|
||||
#define NS_NET
|
||||
#endif /* !XP_PC */
|
||||
#else /* !_IMPL_NS_NET */
|
||||
#ifdef XP_PC
|
||||
#define NS_NET _declspec(dllimport)
|
||||
#else /* !XP_PC */
|
||||
#define NS_NET
|
||||
#endif /* !XP_PC */
|
||||
#endif /* !_IMPL_NS_NET */
|
||||
|
||||
#endif // __netCore_h__
|
||||
403
mozilla/netwerk/base/public/nsIChannel.idl
Normal file
403
mozilla/netwerk/base/public/nsIChannel.idl
Normal file
@@ -0,0 +1,403 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIRequest.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIInputStream;
|
||||
interface nsIOutputStream;
|
||||
interface nsIStreamObserver;
|
||||
interface nsIStreamListener;
|
||||
interface nsILoadGroup;
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsIFile;
|
||||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
/**
|
||||
* The nsIChannel interface allows the user to construct I/O requests for
|
||||
* specific protocols, and manage them in a uniform way. Once a channel
|
||||
* is created (via nsIIOService::NewChannel), parameters for that request
|
||||
* may be set by using the channel attributes, or by QueryInterfacing to a
|
||||
* subclass of nsIChannel for protocol-specific parameters. Then the actual
|
||||
* request can be issued in one of several ways:
|
||||
*
|
||||
* - AsyncRead and AsyncWrite allow for asynchronous requests, calling
|
||||
* back the user's stream listener or observer,
|
||||
* - OpenInputStream and OpenOutputStream allow for synchronous reads
|
||||
* and writes on the underlying channel.
|
||||
*
|
||||
* After a request has been completed, the channel is still valid for
|
||||
* accessing protocol-specific results. For example, QueryInterfacing to
|
||||
* nsIHTTPChannel allows response headers to be retrieved that result from
|
||||
* http transactions.
|
||||
*
|
||||
* Note that a channel is really only valid for one request. Reusing a channel
|
||||
* after a request has completed for a subsequent request may have undefined
|
||||
* results, depending on the channel implementation.
|
||||
*
|
||||
* Also of note are a special kind of channel called "transports." Transports
|
||||
* also implement the nsIChannel interface, but operate at a lower level from
|
||||
* protocol channels. The socket and file transports are notable implementations
|
||||
* of transports and allow higher level channels to be implemented. The cache
|
||||
* may also behave as a transport, and possibly things like sound playing services
|
||||
* etc. Transports usually operate in a separate thread and often multiplex
|
||||
* multiple requests for the same kind of service or resources.
|
||||
*/
|
||||
[scriptable, uuid(1788e79e-f947-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIChannel : nsIRequest
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel accessors
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Returns the original URL used to construct the channel.
|
||||
* This is used in the case of a redirect or URI "resolution" (e.g.
|
||||
* resolving a resource: URI to a file: URI) so that the original
|
||||
* pre-redirect URI can still be obtained.
|
||||
*
|
||||
* Note that this is distinctly different from the http referrer
|
||||
* (referring URI) which is typically the page that contained the
|
||||
* original URI (accessible from nsIHTTPChannel).
|
||||
*/
|
||||
attribute nsIURI originalURI;
|
||||
|
||||
/**
|
||||
* Returns the URL to which the channel currently refers. If a redirect
|
||||
* or URI resolution occurs, this accessor returns the current location
|
||||
* to which the channel is referring.
|
||||
*/
|
||||
attribute nsIURI URI;
|
||||
|
||||
/**
|
||||
* Accesses the start offset from the beginning of the data from/to which
|
||||
* reads/writes will occur. Users may set the transferOffset before making
|
||||
* any of the following requests: asyncOpen, asyncRead, asyncWrite,
|
||||
* openInputStream, openOutputstream.
|
||||
*/
|
||||
attribute unsigned long transferOffset;
|
||||
|
||||
/**
|
||||
* Accesses the count of bytes to be transfered. For openInputStream and
|
||||
* asyncRead, this specifies the amount to read, for asyncWrite, this
|
||||
* specifies the amount to write (note that for openOutputStream, the
|
||||
* end of the data can be signified simply by closing the stream).
|
||||
* If the transferCount is set after reading has been initiated, the
|
||||
* amount specified will become the current remaining amount to read
|
||||
* before the channel is closed (this can be useful if the content
|
||||
* length is encoded at the start of the stream).
|
||||
*
|
||||
* A transferCount value of -1 means the amount is unspecified, i.e.
|
||||
* read or write all the data that is available.
|
||||
*/
|
||||
attribute long transferCount;
|
||||
|
||||
/**
|
||||
* Accesses the load attributes for the channel. E.g. setting the load
|
||||
* attributes with the LOAD_QUIET bit set causes the loading process to
|
||||
* not deliver status notifications to the program performing the load,
|
||||
* and to not contribute to keeping any nsILoadGroup it may be contained
|
||||
* in from firing its OnLoadComplete notification.
|
||||
*/
|
||||
attribute nsLoadFlags loadAttributes;
|
||||
|
||||
/**
|
||||
* Returns the content MIME type of the channel if available. Note that the
|
||||
* content type can often be wrongly specified (wrong file extension, wrong
|
||||
* MIME type, wrong document type stored on a server, etc.) and the caller
|
||||
* most likely wants to verify with the actual data.
|
||||
*/
|
||||
attribute string contentType;
|
||||
|
||||
/**
|
||||
* Returns the length of the data associated with the channel if available.
|
||||
* If the length is unknown then -1 is returned.
|
||||
*/
|
||||
attribute long contentLength;
|
||||
|
||||
/**
|
||||
* Accesses the owner corresponding to the entity that is
|
||||
* responsible for this channel. Used by security code to grant
|
||||
* or deny privileges to mobile code loaded from this channel.
|
||||
*
|
||||
* Note: This is a strong reference to the owner, so if the owner is also
|
||||
* holding a pointer to the channel, care must be taken to explicitly drop
|
||||
* its reference to the channel -- otherwise a leak will result.
|
||||
*/
|
||||
attribute nsISupports owner;
|
||||
|
||||
/**
|
||||
* Accesses the load group in which the channel is a currently a member.
|
||||
*/
|
||||
attribute nsILoadGroup loadGroup;
|
||||
|
||||
/**
|
||||
* Accesses the capabilities callbacks of the channel. This is set by clients
|
||||
* who wish to provide a means to receive progress, status and protocol-specific
|
||||
* notifications.
|
||||
*/
|
||||
attribute nsIInterfaceRequestor notificationCallbacks;
|
||||
|
||||
/**
|
||||
* Any security information about this channel. This can be null.
|
||||
*/
|
||||
readonly attribute nsISupports securityInfo;
|
||||
|
||||
/**
|
||||
* Accesses the buffer segment size. The buffer segment size is used as
|
||||
* the initial size for any transfer buffers, and the increment size for
|
||||
* whenever the buffer space needs to be grown.
|
||||
* (Note this parameter is passed along to any underlying nsIPipe objects.)
|
||||
* If unspecified, the channel implementation picks a default.
|
||||
*/
|
||||
attribute unsigned long bufferSegmentSize;
|
||||
|
||||
/**
|
||||
* Accesses the buffer maximum size. The buffer maximum size is the limit
|
||||
* size that buffer will be grown to before suspending the channel.
|
||||
* (Note this parameter is passed along to any underlying nsIPipe objects.)
|
||||
* If unspecified, the channel implementation picks a default.
|
||||
*/
|
||||
attribute unsigned long bufferMaxSize;
|
||||
|
||||
/**
|
||||
* Returns true if the data from this channel should be cached. Local files
|
||||
* report false because they exist on the local disk and need not be cached.
|
||||
* Input stream channels, data protocol, datetime protocol and finger
|
||||
* protocol channels also should not be cached. Http and ftp on the other
|
||||
* hand should. Note that the value of this attribute doesn't reflect any
|
||||
* http headers that may specify that this channel should not be cached.
|
||||
*/
|
||||
readonly attribute boolean shouldCache;
|
||||
|
||||
/**
|
||||
* Setting pipeliningAllowed causes the load of a URL (issued via asyncOpen,
|
||||
* asyncRead or asyncWrite) to be deferred in order to allow the request to
|
||||
* be pipelined for greater throughput efficiency. Pipelined requests will
|
||||
* be forced to load when the first non-pipelined request is issued.
|
||||
*/
|
||||
attribute boolean pipeliningAllowed;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Load attribute flags. These may be or'd together.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Note that more will follow for each protocol's implementation of a channel,
|
||||
* although channel writers have to be careful to not let the flag bits
|
||||
* overlap. Otherwise, users won't be able to create a single flag word
|
||||
* of load attributes that applies to a number of different channel types.
|
||||
*/
|
||||
|
||||
/**
|
||||
* No special load attributes -- use defaults:
|
||||
*/
|
||||
const unsigned long LOAD_NORMAL = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Don't deliver status notifications to the nsIProgressEventSink, or keep
|
||||
* this load from completing the nsILoadGroup it may belong to:
|
||||
*/
|
||||
const unsigned long LOAD_BACKGROUND = 1 << 0;
|
||||
|
||||
const unsigned long LOAD_DOCUMENT_URI = 1 << 1;
|
||||
|
||||
/**
|
||||
* If the end consumer for this load has been retargeted after discovering
|
||||
* it's content, this flag will be set:
|
||||
*/
|
||||
const unsigned long LOAD_RETARGETED_DOCUMENT_URI = 1 << 2;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* The following flags control caching behavior. Not all protocols pay
|
||||
* attention to all these flags, but they are applicable to more than one
|
||||
* protocol, so they are defined here.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Don't store data in the disk cache. This can be used to preserve
|
||||
* privacy, e.g. so that no https transactions are recorded, or to avoid
|
||||
* caching a stream to disk that is already stored in a local file,
|
||||
* e.g. the mailbox: protocol.
|
||||
*/
|
||||
const unsigned long INHIBIT_PERSISTENT_CACHING = 1 << 8;
|
||||
|
||||
/**
|
||||
* Force an end-to-end download of content data from the origin server (and
|
||||
* any intervening proxies that sit between it and the client), e.g. this
|
||||
* flag is used for a shift-reload.
|
||||
*/
|
||||
const unsigned long FORCE_RELOAD = 1 << 9;
|
||||
|
||||
/**
|
||||
* Force revalidation with server (or proxy) to verify that cached content
|
||||
* is up-to-date, e.g. by comparing last-modified date on server with that
|
||||
* of the cached version. For example, this flag is used when the reload
|
||||
* button is pressed.
|
||||
*/
|
||||
const unsigned long FORCE_VALIDATION = 1 << 10;
|
||||
|
||||
/**
|
||||
* If the CACHE_AS_FILE flag is set, any stream content is stored in the
|
||||
* cache as a single disk file. Content will not be cached in the memory
|
||||
* cache nor will it be stored in any other type of cache, e.g. a flat-file
|
||||
* cache database. This is used to implement the jar protocol handler and
|
||||
* to provide the stream-as-file semantics required by the classic browser
|
||||
* plugin API.
|
||||
*/
|
||||
const unsigned long CACHE_AS_FILE = 1 << 11;
|
||||
|
||||
/**
|
||||
* When cache data is potentially out of date, it can be revalidated with
|
||||
* the origin server to see if the content needs to be reloaded. The
|
||||
* following four flags control how often this validation occurs.
|
||||
* These flags are commonly used for "normal" loading. Note that
|
||||
* the VALIDATE_HEURISTICALLY and VALIDATE_ONCE_PER_SESSION flags can be
|
||||
* combined to validate heuristically but no more than once per session.
|
||||
*/
|
||||
const unsigned long VALIDATE_NEVER = 1 << 12;
|
||||
const unsigned long VALIDATE_ALWAYS = 1 << 13;
|
||||
const unsigned long VALIDATE_ONCE_PER_SESSION = 1 << 14;
|
||||
const unsigned long VALIDATE_HEURISTICALLY = 1 << 15;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel operations
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Opens a blocking input stream to the URL's specified source.
|
||||
* @param startPosition - The offset from the start of the data
|
||||
* from which to read.
|
||||
* @param readCount - The number of bytes to read. If -1, everything
|
||||
* up to the end of the data is read. If greater than the end of
|
||||
* the data, the amount available is returned in the stream.
|
||||
*/
|
||||
nsIInputStream openInputStream();
|
||||
|
||||
/**
|
||||
* Opens a blocking output stream to the URL's specified destination.
|
||||
* @param startPosition - The offset from the start of the data
|
||||
* from which to begin writing.
|
||||
*/
|
||||
nsIOutputStream openOutputStream();
|
||||
|
||||
/**
|
||||
* Opens the channel asynchronously. The nsIStreamObserver's OnStartRequest
|
||||
* method is called back when the channel actually becomes open, providing
|
||||
* the content type. Its OnStopRequest method is called when the channel
|
||||
* becomes closed.
|
||||
*/
|
||||
void asyncOpen(in nsIStreamObserver observer,
|
||||
in nsISupports ctxt);
|
||||
|
||||
/**
|
||||
* Reads asynchronously from the URL's specified source. Notifications
|
||||
* are provided to the stream listener on the thread of the specified
|
||||
* event queue.
|
||||
* The startPosition argument designates the offset in the source where
|
||||
* the data will be read.
|
||||
* If the readCount == -1 then all the available data is delivered to
|
||||
* the stream listener.
|
||||
*/
|
||||
void asyncRead(in nsIStreamListener listener,
|
||||
in nsISupports ctxt);
|
||||
|
||||
/**
|
||||
* Writes asynchronously to the URL's specified destination. Notifications
|
||||
* are provided to the stream observer on the thread of the specified
|
||||
* event queue.
|
||||
* The startPosition argument designates the offset in the destination where
|
||||
* the data will be written.
|
||||
* If the writeCount == -1, then all the available data in the input
|
||||
* stream is written.
|
||||
*/
|
||||
void asyncWrite(in nsIInputStream fromStream,
|
||||
in nsIStreamObserver observer,
|
||||
in nsISupports ctxt);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* nsIInputStreamChannel is an interface that allows for the initialization
|
||||
* of a simple nsIChannel that is constructed from a single input stream and
|
||||
* associated content type. Input stream channels only allow the input stream
|
||||
* to be accessed, not the output stream.
|
||||
*/
|
||||
[scriptable, uuid(43070d6a-f947-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIInputStreamChannel : nsIChannel
|
||||
{
|
||||
void init(in nsIURI uri,
|
||||
in nsIInputStream inStr,
|
||||
in string contentType,
|
||||
in long contentLength);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_INPUTSTREAMCHANNEL_CID \
|
||||
{ /* 54d0d8e6-f947-11d3-8cda-0060b0fc14a3 */ \
|
||||
0x54d0d8e6, \
|
||||
0xf947, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* nsIFileChannel is an interface that allows for the initialization
|
||||
* of a simple nsIChannel that is constructed from a single nsIFile and
|
||||
* associated content type.
|
||||
*/
|
||||
[scriptable, uuid(68a26506-f947-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIFileChannel : nsIChannel
|
||||
{
|
||||
void init(in nsIFile file,
|
||||
in long ioFlags,
|
||||
in long perm);
|
||||
|
||||
readonly attribute nsIFile file;
|
||||
attribute long ioFlags;
|
||||
attribute long permissions;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_LOCALFILECHANNEL_CLASSNAME "Local File Channel"
|
||||
#define NS_LOCALFILECHANNEL_PROGID "component://netscape/network/local-file-channel"
|
||||
|
||||
#define NS_LOCALFILECHANNEL_CID \
|
||||
{ /* 6d5b2d44-f947-11d3-8cda-0060b0fc14a3 */ \
|
||||
0x6d5b2d44, \
|
||||
0xf947, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
30
mozilla/netwerk/base/public/nsIEventSinkGetter.idl
Normal file
30
mozilla/netwerk/base/public/nsIEventSinkGetter.idl
Normal file
@@ -0,0 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(fb65fd70-1881-11d3-9337-00104ba0fd40)]
|
||||
interface nsIEventSinkGetter : nsISupports
|
||||
{
|
||||
nsISupports getEventSink(in string command, in nsIIDRef eventSinkIID);
|
||||
};
|
||||
|
||||
241
mozilla/netwerk/base/public/nsIFileStreams.idl
Normal file
241
mozilla/netwerk/base/public/nsIFileStreams.idl
Normal file
@@ -0,0 +1,241 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIInputStream.idl"
|
||||
#include "nsIOutputStream.idl"
|
||||
#include "nsILocalFile.idl"
|
||||
|
||||
[scriptable, uuid(e3d56a20-c7ec-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIFileInputStream : nsIInputStream
|
||||
{
|
||||
void init(in nsIFile file, in long ioFlags, in long perm);
|
||||
};
|
||||
|
||||
[scriptable, uuid(e6f68040-c7ec-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIFileOutputStream : nsIOutputStream
|
||||
{
|
||||
void init(in nsIFile file, in long ioFlags, in long perm);
|
||||
};
|
||||
|
||||
[scriptable, uuid(e9de5df0-c7ec-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsISeekableStream : nsISupports
|
||||
{
|
||||
// correspond to PRSeekWhence values
|
||||
const long NS_SEEK_SET = 0;
|
||||
const long NS_SEEK_CUR = 1;
|
||||
const long NS_SEEK_END = 2;
|
||||
|
||||
void seek(in long whence, in long offset);
|
||||
unsigned long tell();
|
||||
};
|
||||
|
||||
[scriptable, uuid(616f5b48-da09-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIBufferedInputStream : nsIInputStream
|
||||
{
|
||||
void init(in nsIInputStream fillFromStream,
|
||||
in unsigned long bufferSize);
|
||||
};
|
||||
|
||||
[scriptable, uuid(6476378a-da09-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIBufferedOutputStream : nsIOutputStream
|
||||
{
|
||||
void init(in nsIOutputStream sinkToStream,
|
||||
in unsigned long bufferSize);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_LOCALFILEINPUTSTREAM_CLASSNAME "Local File Input Stream"
|
||||
#define NS_LOCALFILEINPUTSTREAM_PROGID "component://netscape/network/file-input-stream"
|
||||
|
||||
#define NS_LOCALFILEINPUTSTREAM_CID \
|
||||
{ /* be9a53ae-c7e9-11d3-8cda-0060b0fc14a3 */ \
|
||||
0xbe9a53ae, \
|
||||
0xc7e9, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
#define NS_LOCALFILEOUTPUTSTREAM_CLASSNAME "Local File Output Stream"
|
||||
#define NS_LOCALFILEOUTPUTSTREAM_PROGID "component://netscape/network/file-output-stream"
|
||||
|
||||
#define NS_LOCALFILEOUTPUTSTREAM_CID \
|
||||
{ /* c272fee0-c7e9-11d3-8cda-0060b0fc14a3 */ \
|
||||
0xc272fee0, \
|
||||
0xc7e9, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_BUFFEREDINPUTSTREAM_CLASSNAME "Buffered Input Stream"
|
||||
#define NS_BUFFEREDINPUTSTREAM_PROGID "component://netscape/network/buffered-input-stream"
|
||||
|
||||
#define NS_BUFFEREDINPUTSTREAM_CID \
|
||||
{ /* 9226888e-da08-11d3-8cda-0060b0fc14a3 */ \
|
||||
0x9226888e, \
|
||||
0xda08, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
#define NS_BUFFEREDOUTPUTSTREAM_CLASSNAME "Buffered Output Stream"
|
||||
#define NS_BUFFEREDOUTPUTSTREAM_PROGID "component://netscape/network/buffered-output-stream"
|
||||
|
||||
#define NS_BUFFEREDOUTPUTSTREAM_CID \
|
||||
{ /* 9868b4ce-da08-11d3-8cda-0060b0fc14a3 */ \
|
||||
0x9868b4ce, \
|
||||
0xda08, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// move to nsNetUtil.h later...
|
||||
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "prio.h" // for read/write flags, permissions, etc.
|
||||
|
||||
// This will QI the file argument to an nsILocalFile in the Init method.
|
||||
inline nsresult
|
||||
NS_NewLocalFileChannel(nsIFileChannel **result,
|
||||
nsIFile* file,
|
||||
PRInt32 ioFlags = -1,
|
||||
PRInt32 perm = -1)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFileChannel> channel;
|
||||
static NS_DEFINE_CID(kLocalFileChannelCID, NS_LOCALFILECHANNEL_CID);
|
||||
rv = nsComponentManager::CreateInstance(kLocalFileChannelCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIFileChannel),
|
||||
getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = channel->Init(file, ioFlags, perm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = channel;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This will QI the file argument to an nsILocalFile in the Init method.
|
||||
inline nsresult
|
||||
NS_NewLocalFileInputStream(nsIInputStream* *result,
|
||||
nsIFile* file,
|
||||
PRInt32 ioFlags = -1,
|
||||
PRInt32 perm = -1)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFileInputStream> in;
|
||||
static NS_DEFINE_CID(kLocalFileInputStreamCID, NS_LOCALFILEINPUTSTREAM_CID);
|
||||
rv = nsComponentManager::CreateInstance(kLocalFileInputStreamCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIFileInputStream),
|
||||
getter_AddRefs(in));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = in->Init(file, ioFlags, perm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = in;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This will QI the file argument to an nsILocalFile in the Init method.
|
||||
inline nsresult
|
||||
NS_NewLocalFileOutputStream(nsIOutputStream* *result,
|
||||
nsIFile* file,
|
||||
PRInt32 ioFlags = -1,
|
||||
PRInt32 perm = -1)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFileOutputStream> out;
|
||||
static NS_DEFINE_CID(kLocalFileOutputStreamCID, NS_LOCALFILEOUTPUTSTREAM_CID);
|
||||
rv = nsComponentManager::CreateInstance(kLocalFileOutputStreamCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIFileOutputStream),
|
||||
getter_AddRefs(out));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = out->Init(file, ioFlags, perm);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = out;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline nsresult
|
||||
NS_NewBufferedInputStream(nsIInputStream* *result,
|
||||
nsIInputStream* str,
|
||||
PRUint32 bufferSize)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIBufferedInputStream> in;
|
||||
static NS_DEFINE_CID(kBufferedInputStreamCID, NS_BUFFEREDINPUTSTREAM_CID);
|
||||
rv = nsComponentManager::CreateInstance(kBufferedInputStreamCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIBufferedInputStream),
|
||||
getter_AddRefs(in));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = in->Init(str, bufferSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = in;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewBufferedOutputStream(nsIOutputStream* *result,
|
||||
nsIOutputStream* str,
|
||||
PRUint32 bufferSize)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIBufferedOutputStream> out;
|
||||
static NS_DEFINE_CID(kBufferedOutputStreamCID, NS_BUFFEREDOUTPUTSTREAM_CID);
|
||||
rv = nsComponentManager::CreateInstance(kBufferedOutputStreamCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIBufferedOutputStream),
|
||||
getter_AddRefs(out));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = out->Init(str, bufferSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = out;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
%}
|
||||
40
mozilla/netwerk/base/public/nsIFileSystem.idl
Normal file
40
mozilla/netwerk/base/public/nsIFileSystem.idl
Normal file
@@ -0,0 +1,40 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIInputStream;
|
||||
interface nsIOutputStream;
|
||||
|
||||
[scriptable, uuid(818e1370-77c4-11d3-9395-00104ba0fd40)]
|
||||
interface nsIFileSystem : nsISupports
|
||||
{
|
||||
void open(out string contentType,
|
||||
out long contentLength);
|
||||
|
||||
void close(in nsresult status);
|
||||
|
||||
readonly attribute nsIInputStream inputStream;
|
||||
|
||||
readonly attribute nsIOutputStream outputStream;
|
||||
};
|
||||
|
||||
65
mozilla/netwerk/base/public/nsIFileTransportService.idl
Normal file
65
mozilla/netwerk/base/public/nsIFileTransportService.idl
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
%{C++
|
||||
#include "nsFileSpec.h"
|
||||
%}
|
||||
|
||||
interface nsIChannel;
|
||||
interface nsIFileSystem;
|
||||
interface nsIEventSinkGetter;
|
||||
interface nsIInputStream;
|
||||
interface nsIRunnable;
|
||||
interface nsIFile;
|
||||
|
||||
[scriptable, uuid(57211a60-8c45-11d3-93ac-00104ba0fd40)]
|
||||
interface nsIFileTransportService : nsISupports
|
||||
{
|
||||
nsIChannel createTransport(in nsIFile file,
|
||||
in long ioFlags,
|
||||
in long perm);
|
||||
|
||||
// This version can be used with an existing input stream to serve
|
||||
// as a data pump:
|
||||
nsIChannel createTransportFromStream(in nsIInputStream fromStream,
|
||||
in string contentType,
|
||||
in long contentLength);
|
||||
|
||||
nsIChannel createTransportFromFileSystem(in nsIFileSystem fsObj);
|
||||
|
||||
void dispatchRequest(in nsIRunnable runnable);
|
||||
void suspend(in nsIRunnable trans);
|
||||
void resume(in nsIRunnable trans);
|
||||
void processPendingRequests();
|
||||
void shutdown();
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_FILETRANSPORTSERVICE_CID \
|
||||
{ /* 2bb2b250-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x2bb2b250, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
%}
|
||||
169
mozilla/netwerk/base/public/nsIIOService.idl
Normal file
169
mozilla/netwerk/base/public/nsIIOService.idl
Normal file
@@ -0,0 +1,169 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIChannel.idl"
|
||||
|
||||
interface nsIProtocolHandler;
|
||||
interface nsIURI;
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsIStreamObserver;
|
||||
interface nsIStreamListener;
|
||||
interface nsIEventQueue;
|
||||
interface nsIBufferInputStream;
|
||||
interface nsIInputStream;
|
||||
interface nsIBufferOutputStream;
|
||||
interface nsIFileChannel;
|
||||
interface nsILoadGroup;
|
||||
interface nsILoadGroupObserver;
|
||||
interface nsIFile;
|
||||
interface nsIInputStream;
|
||||
interface nsIOutputStream;
|
||||
|
||||
[scriptable, uuid(ab7c3a84-d488-11d3-8cda-0060b0fc14a3)]
|
||||
interface nsIIOService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns a protocol handler for a given URI scheme.
|
||||
*/
|
||||
nsIProtocolHandler getProtocolHandler(in string scheme);
|
||||
|
||||
/**
|
||||
* This method constructs a new URI by first determining the scheme
|
||||
* of the URI spec, and then delegating the construction of the URI
|
||||
* to the protocol handler for that scheme. QueryInterface can be used
|
||||
* on the resulting URI object to obtain a more specific type of URI.
|
||||
*/
|
||||
nsIURI newURI(in string aSpec, in nsIURI aBaseURI);
|
||||
|
||||
/**
|
||||
* Creates a channel for a given URI. The notificationCallbacks argument
|
||||
* is used to obtain the appropriate callbacks for the URI's protocol from the
|
||||
* application.
|
||||
*
|
||||
* @param originalURI - Specifies the original URI which caused the creation
|
||||
* of this channel. This can occur when the construction of one channel
|
||||
* (e.g. for resource:) causes another channel to be created on its behalf
|
||||
* (e.g. a file: channel), or if a redirect occurs, causing the current
|
||||
* URL to become different from the original URL. If NULL, the aURI parameter
|
||||
* will be used as the originalURI instead.
|
||||
*/
|
||||
nsIChannel newChannelFromURI(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* Convenience routine that first creates a URI by calling NewURI, and
|
||||
* then passes the URI to NewChannelFromURI.
|
||||
*
|
||||
* @param originalURI - Specifies the original URI which caused the creation
|
||||
* of this channel. This can occur when the construction of one channel
|
||||
* (e.g. for resource:) causes another channel to be created on its behalf
|
||||
* (e.g. a file: channel), or if a redirect occurs, causing the current
|
||||
* URL to become different from the original URL. If NULL, the aURI parameter
|
||||
* will be used as the originalURI instead.
|
||||
*/
|
||||
nsIChannel newChannel(in string aSpec, in nsIURI aBaseURI);
|
||||
|
||||
/**
|
||||
* Returns true if networking is in "offline" mode. When in offline mode, attempts
|
||||
* to access the network will fail (although this is not necessarily corrolated with
|
||||
* whether there is actually a network available -- that's hard to detect without
|
||||
* causing the dialer to come up).
|
||||
*/
|
||||
attribute boolean offline;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// URL parsing utilities
|
||||
|
||||
/**
|
||||
* Utility for protocol implementors -- extracts the scheme from a URL
|
||||
* string, consistently and according to spec.
|
||||
* @param urlString - the URL string to parse
|
||||
* @param schemeStartPos - the resulting starting position of the scheme substring
|
||||
* (may skip over whitespace)
|
||||
* @param schemeEndPos - the resulting ending position of the scheme substring
|
||||
* (the position of the colon)
|
||||
* @param scheme - an allocated substring containing the scheme. If this parameter
|
||||
* is null going into the routine, then the scheme is not allocated and
|
||||
* returned. Free with nsCRT::free.
|
||||
*
|
||||
* @return NS_OK - if successful
|
||||
* @return NS_ERROR_MALFORMED_URI - if the urlString is not of the right form
|
||||
*/
|
||||
void extractScheme(in string urlString,
|
||||
out unsigned long schemeStartPos,
|
||||
out unsigned long schemeEndPos,
|
||||
out string scheme);
|
||||
|
||||
/**
|
||||
* Constants for the mask in the call to Escape
|
||||
*/
|
||||
const short url_Scheme = (1<<0);
|
||||
const short url_Username = (1<<1);
|
||||
const short url_Password = (1<<2);
|
||||
const short url_Host = (1<<3);
|
||||
const short url_Directory = (1<<4);
|
||||
const short url_FileBaseName = (1<<5);
|
||||
const short url_FileExtension = (1<<6);
|
||||
const short url_Param = (1<<7);
|
||||
const short url_Query = (1<<8);
|
||||
const short url_Ref = (1<<9);
|
||||
const short url_Forced = (1<<10);
|
||||
|
||||
/**
|
||||
* Encode characters into % escaped hexcodes.
|
||||
*/
|
||||
string escape(in string str, in short mask);
|
||||
|
||||
/**
|
||||
* Decode % escaped hex codes into character values.
|
||||
*/
|
||||
string unescape(in string str);
|
||||
|
||||
/**
|
||||
* Get port from string.
|
||||
*/
|
||||
long extractPort(in string str);
|
||||
|
||||
/**
|
||||
* Resolves a relative path string containing "." and ".."
|
||||
* with respect to a base path (assumed to already be resolved).
|
||||
* For example, resolving "../../foo/./bar/../baz.html" w.r.t.
|
||||
* "/a/b/c/d/e/" yields "/a/b/c/foo/baz.html". Attempting to
|
||||
* ascend above the base results in the NS_ERROR_MALFORMED_URI
|
||||
* exception. If basePath is null, it treats it as "/".
|
||||
*/
|
||||
string resolveRelativePath(in string relativePath,
|
||||
in string basePath);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_IOSERVICE_CID \
|
||||
{ /* 9ac9e770-18bc-11d3-9337-00104ba0fd40 */ \
|
||||
0x9ac9e770, \
|
||||
0x18bc, \
|
||||
0x11d3, \
|
||||
{0x93, 0x37, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
#define DUD 3.14
|
||||
%}
|
||||
104
mozilla/netwerk/base/public/nsILoadGroup.idl
Normal file
104
mozilla/netwerk/base/public/nsILoadGroup.idl
Normal file
@@ -0,0 +1,104 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIRequest.idl"
|
||||
|
||||
interface nsIChannel;
|
||||
interface nsISimpleEnumerator;
|
||||
interface nsIStreamObserver;
|
||||
interface nsIStreamListener;
|
||||
interface nsIInputStream;
|
||||
|
||||
|
||||
[scriptable, uuid(60fdf550-5392-11d3-9a97-0080c7cb1080)]
|
||||
interface nsILoadGroupListenerFactory : nsISupports
|
||||
{
|
||||
nsIStreamListener createLoadGroupListener(in nsIStreamListener alistener);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A load group maintains a collection of active URL requests.
|
||||
*/
|
||||
[scriptable, uuid(19845248-29ab-11d3-8cce-0060b0fc14a3)]
|
||||
interface nsILoadGroup : nsIRequest
|
||||
{
|
||||
void init(in nsIStreamObserver observer);
|
||||
|
||||
/**
|
||||
* Accesses the default load attributes for the group, returned as
|
||||
* a flag word. Setting the default load attributes will cause them
|
||||
* to be applied to each new channel inserted into the group.
|
||||
*/
|
||||
attribute unsigned long defaultLoadAttributes;
|
||||
|
||||
/**
|
||||
* Accesses the default load channel for the group. Each time a number
|
||||
* of channels are added to a group, the DefaultLoadChannel may be set
|
||||
* to indicate that all of the channels are related to a particular URL.
|
||||
*/
|
||||
attribute nsIChannel defaultLoadChannel;
|
||||
|
||||
/**
|
||||
* Adds a new channel to the group. This will cause the default load
|
||||
* attributes to be applied to that channel. If the channel added is
|
||||
* the first channel in the group, the group's observer's OnStartRequest
|
||||
* method is called.
|
||||
*/
|
||||
void addChannel(in nsIChannel channel,
|
||||
in nsISupports ctxt);
|
||||
|
||||
/**
|
||||
* Removes a channel from the group. If the channel removed is
|
||||
* the last channel in the group, the group's observer's OnStopRequest
|
||||
* method is called.
|
||||
*/
|
||||
void removeChannel(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in nsresult status,
|
||||
in wstring errorMsg);
|
||||
|
||||
/**
|
||||
* Returns the channels contained directly in this group.
|
||||
* Enumerator element type: nsIChannel.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator channels;
|
||||
|
||||
attribute nsIStreamObserver groupObserver;
|
||||
|
||||
attribute nsILoadGroupListenerFactory groupListenerFactory;
|
||||
|
||||
|
||||
readonly attribute unsigned long activeCount;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_LOADGROUP_CID \
|
||||
{ /* e1c61582-2a84-11d3-8cce-0060b0fc14a3 */ \
|
||||
0xe1c61582, \
|
||||
0x2a84, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xce, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
%}
|
||||
47
mozilla/netwerk/base/public/nsINetModRegEntry.idl
Normal file
47
mozilla/netwerk/base/public/nsINetModRegEntry.idl
Normal file
@@ -0,0 +1,47 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/* This interface defines a registry entry for the networking libraries
|
||||
* external module registry. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsINetNotify.idl"
|
||||
|
||||
interface nsIEventQueue;
|
||||
interface nsINetModRegEntry;
|
||||
interface nsINetNotify;
|
||||
|
||||
%{ C++
|
||||
// {F126BD90-1472-11d3-A15A-0050041CAF44}
|
||||
#define NS_NETMODREGENTRY_CID \
|
||||
{ 0xf126bd90, 0x1472, 0x11d3, { 0xa1, 0x5a, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44 } }
|
||||
%}
|
||||
|
||||
[scriptable, uuid(9F482BD0-1476-11d3-A15A-0050041CAF44)]
|
||||
interface nsINetModRegEntry : nsISupports
|
||||
{
|
||||
readonly attribute nsINetNotify syncProxy;
|
||||
readonly attribute nsINetNotify asyncProxy;
|
||||
readonly attribute string topic;
|
||||
|
||||
boolean equals(in nsINetModRegEntry aEntry);
|
||||
};
|
||||
80
mozilla/netwerk/base/public/nsINetModuleMgr.idl
Normal file
80
mozilla/netwerk/base/public/nsINetModuleMgr.idl
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/* The nsINetModuleMgr singleton service allows external module to register
|
||||
* themselves with the networking library to receive events they want to
|
||||
* receive.
|
||||
*
|
||||
* An external module that is interested in being notified when a particular
|
||||
* networking level event occurs would register with this service, and
|
||||
* implement the appropriate interface(s) that correspond to the events they
|
||||
* want to receive. These interfaces are defined by networking internal
|
||||
* components (for example, http would define a notification interface that
|
||||
* the external cookies module would implement).
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
#include "nsINetNotify.idl"
|
||||
|
||||
interface nsIEventQueue;
|
||||
|
||||
%{ C++
|
||||
|
||||
// {4EBDAFE0-13BA-11d3-A15A-0050041CAF44}
|
||||
#define NS_NETMODULEMGR_CID \
|
||||
{ 0x4ebdafe0, 0x13ba, 0x11d3, { 0xa1, 0x5a, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44 } }
|
||||
|
||||
// The list of available PROGIDS to register for notification on.
|
||||
#define NS_NETWORK_MODULE_MANAGER_HTTP_REQUEST_PROGID "component://netscape/network/moduleMgr/http/request"
|
||||
#define NS_NETWORK_MODULE_MANAGER_HTTP_RESPONSE_PROGID "component://netscape/network/moduleMgr/http/response"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(ff9ead40-0ef2-11d3-9de6-0010a4053fd0)]
|
||||
interface nsINetModuleMgr : nsISupports {
|
||||
|
||||
// Register the external module to receive notifications.
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// aTopic: The internal component that the external module wants to monitor.
|
||||
// aNotify: The external module interface methods to be called when an event is fired.
|
||||
//
|
||||
// RETURNS: nsresult
|
||||
void registerModule(in string aTopic, in nsINetNotify aNotify);
|
||||
|
||||
// Unregister the external module. Removes the nsINetModuleMgr binding between
|
||||
// internal component and external module.
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// aTopic: The internal component being monitored.
|
||||
// aNotify: The external modules notification module.
|
||||
//
|
||||
// RETURNS: nsresult
|
||||
void unregisterModule(in string aTopic, in nsINetNotify aNotify);
|
||||
|
||||
// Enumerates all the registered modules for the specified topic.
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// aTopic: the component to get all the notifiers for.
|
||||
// aEnumerator: the array of notifiers.
|
||||
void enumerateModules(in string aTopic, out nsISimpleEnumerator aEnumerator);
|
||||
};
|
||||
28
mozilla/netwerk/base/public/nsINetNotify.idl
Normal file
28
mozilla/netwerk/base/public/nsINetNotify.idl
Normal file
@@ -0,0 +1,28 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[uuid(4A3019E0-1CF3-11d3-A15B-0050041CAF44)]
|
||||
interface nsINetNotify : nsISupports {
|
||||
|
||||
};
|
||||
76
mozilla/netwerk/base/public/nsINetPrompt.idl
Normal file
76
mozilla/netwerk/base/public/nsINetPrompt.idl
Normal file
@@ -0,0 +1,76 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
|
||||
|
||||
[scriptable, uuid(edd8be01-8e0d-11d3-b7a0-c46e946292bc)]
|
||||
interface nsINetPrompt : nsISupports
|
||||
{
|
||||
/**
|
||||
* Puts up an alert dialog with an OK button.
|
||||
*/
|
||||
void alert( in string url, in boolean stripurl, in wstring title, in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirm( in string url, in boolean stripurl, in wstring title, in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a username/password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptUsernameAndPassword(
|
||||
in string url,
|
||||
in boolean stripurl,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
out wstring user,
|
||||
out wstring pwd);
|
||||
|
||||
/**
|
||||
* Puts up a password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptPassword(
|
||||
in string url,
|
||||
in boolean stripurl,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
out wstring pwd);
|
||||
|
||||
/**
|
||||
* Puts up a prompt dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean prompt(
|
||||
in string url,
|
||||
in boolean stripurl,
|
||||
in wstring title,
|
||||
in wstring text,
|
||||
out wstring pwd);
|
||||
};
|
||||
|
||||
|
||||
51
mozilla/netwerk/base/public/nsIProgressEventSink.idl
Normal file
51
mozilla/netwerk/base/public/nsIProgressEventSink.idl
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIChannel;
|
||||
|
||||
/**
|
||||
* An instance of nsIFfpEventSink should be passed as the eventSink
|
||||
* argument of nsINetService::NewConnection for ftp URLs. It defines
|
||||
* the callbacks to the application program (the html parser).
|
||||
*/
|
||||
[scriptable, uuid(dd47ee00-18c2-11d3-9337-00104ba0fd40)]
|
||||
interface nsIProgressEventSink : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notify the EventSink that progress as occurred for the URL load.<BR>
|
||||
*/
|
||||
void onProgress(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in unsigned long aProgress,
|
||||
in unsigned long aProgressMax);
|
||||
|
||||
/**
|
||||
* Notify the EventSink with a status message for the URL load.<BR>
|
||||
*/
|
||||
void onStatus(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in wstring aMsg);
|
||||
|
||||
};
|
||||
102
mozilla/netwerk/base/public/nsIPrompt.idl
Normal file
102
mozilla/netwerk/base/public/nsIPrompt.idl
Normal file
@@ -0,0 +1,102 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(a63f70c0-148b-11d3-9333-00104ba0fd40)]
|
||||
interface nsIPrompt : nsISupports
|
||||
{
|
||||
/**
|
||||
* Puts up an alert dialog with an OK button.
|
||||
*/
|
||||
void alert(in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirm(in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with OK and Cancel buttons, and
|
||||
* a message with a single checkbox.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirmCheck(in wstring text,
|
||||
in wstring checkMsg,
|
||||
out boolean checkValue);
|
||||
|
||||
/**
|
||||
* Puts up a text input dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean prompt(in wstring text,
|
||||
in wstring defaultText,
|
||||
out wstring result);
|
||||
|
||||
/**
|
||||
* Puts up a username/password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptUsernameAndPassword(in wstring text,
|
||||
out wstring user,
|
||||
out wstring pwd);
|
||||
|
||||
/**
|
||||
* Puts up a password dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean promptPassword(in wstring text,
|
||||
in wstring title,
|
||||
out wstring pwd);
|
||||
|
||||
/**
|
||||
* Puts up a dialog box which has a list box of strings
|
||||
*/
|
||||
boolean select(in wstring inDialogTitle,
|
||||
in wstring inMsg,
|
||||
in PRUint32 inCount,
|
||||
[array, size_is(inCount)] in wstring inList,
|
||||
out long outSelection);
|
||||
|
||||
/**
|
||||
* Put up a universal dialog
|
||||
*/
|
||||
void universalDialog(in wstring inTitleMessage,
|
||||
in wstring inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
in wstring inMsg, /* main message for dialog */
|
||||
in wstring inCheckboxMsg, /* message for checkbox */
|
||||
in wstring inButton0Text, /* text for first button */
|
||||
in wstring inButton1Text, /* text for second button */
|
||||
in wstring inButton2Text, /* text for third button */
|
||||
in wstring inButton3Text, /* text for fourth button */
|
||||
in wstring inEditfield1Msg, /*message for first edit field */
|
||||
in wstring inEditfield2Msg, /* message for second edit field */
|
||||
inout wstring inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
inout wstring inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
in wstring inIConURL, /* url of icon to be displayed in dialog */
|
||||
inout boolean inoutCheckboxState, /* initial and final state of checkbox */
|
||||
in PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
in PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
in PRInt32 inEditField1Password, /* ??? */
|
||||
out PRInt32 outButtonPressed); /* number of button that was pressed (0 to 3) */
|
||||
};
|
||||
67
mozilla/netwerk/base/public/nsIProtocolHandler.idl
Normal file
67
mozilla/netwerk/base/public/nsIProtocolHandler.idl
Normal file
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIChannel.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsILoadGroup;
|
||||
|
||||
[scriptable, uuid(15fd6940-8ea7-11d3-93ad-00104ba0fd40)]
|
||||
interface nsIProtocolHandler : nsISupports
|
||||
{
|
||||
readonly attribute string scheme;
|
||||
|
||||
readonly attribute long defaultPort;
|
||||
|
||||
/**
|
||||
* Makes a URI object that is suitable for loading by this protocol.
|
||||
* In the usual case (when only the accessors provided by nsIURI are
|
||||
* needed), this method just constructs a standard URI using the
|
||||
* component manager with kStandardURLCID.
|
||||
*/
|
||||
nsIURI newURI(in string aSpec, in nsIURI aBaseURI);
|
||||
|
||||
/**
|
||||
* Constructs a new channel for this protocol handler.
|
||||
*
|
||||
* @param originalURI - Specifies the original URI which caused the creation
|
||||
* of this channel. This can occur when the construction of one channel
|
||||
* (e.g. for resource:) causes another channel to be created on its behalf
|
||||
* (e.g. a file: channel), or if a redirect occurs, causing the current
|
||||
* URL to become different from the original URL. If NULL, the aURI parameter
|
||||
* will be used as the originalURI instead.
|
||||
*/
|
||||
nsIChannel newChannel(in nsIURI aURI);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_NETWORK_PROTOCOL_PROGID "component://netscape/network/protocol"
|
||||
#define NS_NETWORK_PROTOCOL_PROGID_PREFIX NS_NETWORK_PROTOCOL_PROGID "?name="
|
||||
#define NS_NETWORK_PROTOCOL_PROGID_PREFIX_LENGTH 43 // nsCRT::strlen(NS_NETWORK_PROTOCOL_PROGID_PREFIX)
|
||||
|
||||
// Unknown Protocol Error
|
||||
#define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
|
||||
|
||||
%}
|
||||
40
mozilla/netwerk/base/public/nsIProtocolProxyService.idl
Normal file
40
mozilla/netwerk/base/public/nsIProtocolProxyService.idl
Normal file
@@ -0,0 +1,40 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIURI.idl"
|
||||
#include "nsIProxy.idl"
|
||||
|
||||
%{C++
|
||||
#define NS_PROTOCOLPROXYSERVICE_CID \
|
||||
{ /* E9B301C0-E0E4-11d3-A1A8-0050041CAF44 */ \
|
||||
0xe9b301c0, 0xe0e4, 0x11d3, { 0xa1, 0xa8, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44 } }
|
||||
%}
|
||||
|
||||
[scriptable, uuid(495CC980-E0D4-11d3-A1A8-0050041CAF44)]
|
||||
interface nsIProtocolProxyService : nsISupports
|
||||
{
|
||||
readonly attribute PRBool proxyEnabled;
|
||||
|
||||
void examineForProxy(in nsIURI aURI, in nsIProxy aProxy);
|
||||
};
|
||||
|
||||
41
mozilla/netwerk/base/public/nsIProxy.idl
Normal file
41
mozilla/netwerk/base/public/nsIProxy.idl
Normal file
@@ -0,0 +1,41 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
The nsIProxy interface allows setting and getting of proxy host and port.
|
||||
This is for use by protocol handlers. If you are writing a protocol handler
|
||||
and would like to support proxy behaviour then derive from this as well as
|
||||
the nsIProtocolHandler class.
|
||||
|
||||
-Gagan Saksena 02/25/99
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(0492D011-CD2F-11d2-B013-006097BFC036)]
|
||||
interface nsIProxy : nsISupports
|
||||
{
|
||||
attribute string proxyHost;
|
||||
|
||||
/* -1 on Set call indicates switch to default port */
|
||||
attribute long proxyPort;
|
||||
};
|
||||
63
mozilla/netwerk/base/public/nsIRequest.idl
Normal file
63
mozilla/netwerk/base/public/nsIRequest.idl
Normal file
@@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(F2CAABA0-2F25-11d3-A164-0050041CAF44)]
|
||||
interface nsIRequest : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns true if the request is pending (active). Returns false
|
||||
* after completion or successful calling Cancel. Suspended requests
|
||||
* are still considered pending.
|
||||
*/
|
||||
boolean isPending();
|
||||
|
||||
/**
|
||||
* Returns any error status associated with the request.
|
||||
*/
|
||||
readonly attribute nsresult status;
|
||||
|
||||
/**
|
||||
* Cancels the current request. This will close any open input or
|
||||
* output streams and terminate any async requests. Users should
|
||||
* normally pass NS_BINDING_ABORTED, although other errors may also
|
||||
* be passed. The error passed in will become the value of the
|
||||
* status attribute.
|
||||
*/
|
||||
void cancel(in nsresult status);
|
||||
|
||||
/**
|
||||
* Suspends the current requests. This may have the effect of closing
|
||||
* any underlying transport (in order to free up resources), although
|
||||
* any open streams remain logically opened and will continue delivering
|
||||
* data when the transport is resumed.
|
||||
*/
|
||||
void suspend();
|
||||
|
||||
/**
|
||||
* Resumes the current request. This may have the effect of re-opening
|
||||
* any underlying transport and will resume the delivery of data to
|
||||
* any open streams.
|
||||
*/
|
||||
void resume();
|
||||
};
|
||||
55
mozilla/netwerk/base/public/nsISocketTransport.idl
Normal file
55
mozilla/netwerk/base/public/nsISocketTransport.idl
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(785CA0F0-C39E-11d3-9ED6-0010A4053FD0)]
|
||||
interface nsISocketTransport : nsISupports
|
||||
{
|
||||
attribute boolean reuseConnection;
|
||||
|
||||
/**
|
||||
* socket read/write timeout in seconds; 0 = no timeout
|
||||
*/
|
||||
attribute unsigned long socketTimeout;
|
||||
|
||||
/**
|
||||
* socket connect timeout in seconds; 0 = no timeout
|
||||
*/
|
||||
attribute unsigned long socketConnectTimeout;
|
||||
|
||||
/**
|
||||
* Is used to tell the channel to stop reading data after a certain point;
|
||||
* needed by HTTP/1.1
|
||||
*/
|
||||
attribute long bytesExpected;
|
||||
attribute unsigned long reuseCount;
|
||||
|
||||
/**
|
||||
* Checks if the socket is still alive
|
||||
*
|
||||
* @param seconds amount of time after which the socket is always deemed to be
|
||||
* dead (no further checking is done in this case); seconds = 0
|
||||
* will cause it not to do the timeout checking at all
|
||||
*/
|
||||
boolean isAlive (in unsigned long seconds);
|
||||
};
|
||||
77
mozilla/netwerk/base/public/nsISocketTransportService.idl
Normal file
77
mozilla/netwerk/base/public/nsISocketTransportService.idl
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIChannel;
|
||||
interface nsIEventSinkGetter;
|
||||
|
||||
[scriptable, uuid(05331390-6884-11d3-9382-00104ba0fd40)]
|
||||
interface nsISocketTransportService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Creates a transport for a specified host and port.
|
||||
* The eventSinkGetter is used to get the appropriate callbacks
|
||||
* for the socket activity from the application. These include
|
||||
* the progress and the status messages like "Contacting host.."
|
||||
* etc. The printHost contains the actual hostname (and not the
|
||||
* proxy) for displaying in status messages.
|
||||
*/
|
||||
nsIChannel createTransport(in string host,
|
||||
in long port,
|
||||
in string printHost,
|
||||
in unsigned long bufferSegmentSize,
|
||||
in unsigned long bufferMaxSize);
|
||||
nsIChannel createTransportOfType(in string socketType,
|
||||
in string host,
|
||||
in long port,
|
||||
in string printHost,
|
||||
in unsigned long bufferSegmentSize,
|
||||
in unsigned long bufferMaxSize);
|
||||
|
||||
/**
|
||||
* Returns true if the specified transport is good enough for
|
||||
* being used again. The situations in which this may return false
|
||||
* include- an error including server resets, an explicit
|
||||
* Connection: close header (for HTTP) and timeouts!
|
||||
*/
|
||||
boolean reuseTransport(in nsIChannel i_Transport);
|
||||
|
||||
void init();
|
||||
void shutdown();
|
||||
void wakeup(in nsIChannel i_Transport);
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_SOCKETTRANSPORTSERVICE_CID \
|
||||
{ /* c07e81e0-ef12-11d2-92b6-00105a1b0d64 */ \
|
||||
0xc07e81e0, \
|
||||
0xef12, \
|
||||
0x11d2, \
|
||||
{0x92, 0xb6, 0x00, 0x10, 0x5a, 0x1b, 0x0d, 0x64} \
|
||||
}
|
||||
|
||||
#define NS_ERROR_CONNECTION_REFUSED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 13)
|
||||
|
||||
#define NS_ERROR_NET_TIMEOUT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 14)
|
||||
|
||||
%}
|
||||
48
mozilla/netwerk/base/public/nsIStatusCodeEventSink.idl
Normal file
48
mozilla/netwerk/base/public/nsIStatusCodeEventSink.idl
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIProgressEventSink;
|
||||
interface nsIChannel;
|
||||
|
||||
/**
|
||||
* The nsIStatusCodeEventSink is a temporary interface to allow passing
|
||||
* status codes from the socket threads onto the UI without having to
|
||||
* pass strings. This could eventually go away if the proxy events
|
||||
* stuff can handle nested event loop. dougt is working on that.
|
||||
* We could continue to use this if this seems reasonable enough.
|
||||
*/
|
||||
[scriptable, uuid(6998ff36-1dd2-11b2-9ab7-e72a0f9fdd8c)]
|
||||
interface nsIStatusCodeEventSink : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* Notify the EventSink with a status code for the URL load.<BR>
|
||||
* Use IOService to request converting that code to a string.
|
||||
*/
|
||||
void onStatus(in nsIProgressEventSink sink,
|
||||
in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in unsigned long aCode);
|
||||
|
||||
};
|
||||
96
mozilla/netwerk/base/public/nsIStreamListener.idl
Normal file
96
mozilla/netwerk/base/public/nsIStreamListener.idl
Normal file
@@ -0,0 +1,96 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIStreamObserver.idl"
|
||||
|
||||
interface nsIBufferInputStream;
|
||||
interface nsIInputStream;
|
||||
interface nsIBufferOutputStream;
|
||||
interface nsIEventQueue;
|
||||
|
||||
[scriptable, uuid(1a637020-1482-11d3-9333-00104ba0fd40)]
|
||||
interface nsIStreamListener : nsIStreamObserver
|
||||
{
|
||||
void onDataAvailable(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in nsIInputStream inStr,
|
||||
in unsigned long sourceOffset,
|
||||
in unsigned long count);
|
||||
};
|
||||
|
||||
/**
|
||||
* An asynchronous stream listener is used to ship data over to another thread specified
|
||||
* by the thread's event queue. The receiver stream listener is then used to receive
|
||||
* the notifications on the other thread.
|
||||
*
|
||||
* This interface only provides the initialization needed after construction. Otherwise,
|
||||
* these objects are used simply as nsIStreamListener.
|
||||
*/
|
||||
[scriptable, uuid(1b012ade-91bf-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsIAsyncStreamListener : nsIStreamListener
|
||||
{
|
||||
/**
|
||||
* Initializes an nsIAsyncStreamListener.
|
||||
* @param eventQueue - may be null indicating the calling thread's event queue
|
||||
*/
|
||||
void init(in nsIStreamListener receiver,
|
||||
in nsIEventQueue eventQueue);
|
||||
};
|
||||
|
||||
/**
|
||||
* A synchronous stream listener pushes data through a pipe that ends up
|
||||
* in an input stream to be read by another thread.
|
||||
*
|
||||
* This interface only provides the initialization needed after construction. Otherwise,
|
||||
* these objects are used simply as nsIStreamListener.
|
||||
*/
|
||||
[scriptable, uuid(1f9fb93e-91bf-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsISyncStreamListener : nsIStreamListener
|
||||
{
|
||||
/**
|
||||
* Initializes an nsISyncStreamListener.
|
||||
*/
|
||||
void init(out nsIInputStream inStream,
|
||||
out nsIBufferOutputStream outStream);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// Use this CID to construct an nsIAsyncStreamListener
|
||||
#define NS_ASYNCSTREAMLISTENER_CID \
|
||||
{ /* 60047bb2-91c0-11d3-8cd9-0060b0fc14a3 */ \
|
||||
0x60047bb2, \
|
||||
0x91c0, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xd9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
// Use this CID to construct an nsISyncStreamListener
|
||||
#define NS_SYNCSTREAMLISTENER_CID \
|
||||
{ /* 65fa5cb2-91c0-11d3-8cd9-0060b0fc14a3 */ \
|
||||
0x65fa5cb2, \
|
||||
0x91c0, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xd9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
%}
|
||||
72
mozilla/netwerk/base/public/nsIStreamLoader.idl
Normal file
72
mozilla/netwerk/base/public/nsIStreamLoader.idl
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIChannel.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsILoadGroup;
|
||||
interface nsIStreamObserver;
|
||||
interface nsIStreamLoader;
|
||||
interface nsIInterfaceRequestor;
|
||||
|
||||
[scriptable, uuid(359F7990-D4E9-11d3-A1A5-0050041CAF44)]
|
||||
interface nsIStreamLoaderObserver : nsISupports
|
||||
{
|
||||
void onStreamComplete(in nsIStreamLoader loader,
|
||||
in nsISupports ctxt,
|
||||
in nsresult status,
|
||||
in unsigned long resultLength,
|
||||
[size_is(resultLength)] in string result);
|
||||
};
|
||||
|
||||
[scriptable, uuid(31d37360-8e5a-11d3-93ad-00104ba0fd40)]
|
||||
interface nsIStreamLoader : nsISupports
|
||||
{
|
||||
void init(in nsIURI uri,
|
||||
in nsIStreamLoaderObserver completionObserver,
|
||||
in nsISupports ctxt,
|
||||
in nsILoadGroup loadGroup,
|
||||
in nsIInterfaceRequestor notificationCallbacks,
|
||||
in nsLoadFlags loadAttributes,
|
||||
in unsigned long bufferSegmentSize,
|
||||
in unsigned long bufferMaxSize);
|
||||
|
||||
/**
|
||||
* Gets the number of bytes read so far.
|
||||
*/
|
||||
readonly attribute unsigned long numBytesRead;
|
||||
|
||||
/**
|
||||
* Gets the owner of this file
|
||||
*/
|
||||
readonly attribute nsISupports owner;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_STREAMLOADER_CID \
|
||||
{ /* 5BA6D920-D4E9-11d3-A1A5-0050041CAF44 */ \
|
||||
0x5ba6d920, 0xd4e9, 0x11d3, { 0xa1, 0xa5, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44 } \
|
||||
}
|
||||
|
||||
%}
|
||||
78
mozilla/netwerk/base/public/nsIStreamObserver.idl
Normal file
78
mozilla/netwerk/base/public/nsIStreamObserver.idl
Normal file
@@ -0,0 +1,78 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIEventQueue;
|
||||
interface nsIChannel;
|
||||
|
||||
[scriptable, uuid(fd91e2e0-1481-11d3-9333-00104ba0fd40)]
|
||||
interface nsIStreamObserver : nsISupports
|
||||
{
|
||||
void onStartRequest(in nsIChannel channel,
|
||||
in nsISupports ctxt);
|
||||
|
||||
void onStopRequest(in nsIChannel channel,
|
||||
in nsISupports ctxt,
|
||||
in nsresult status,
|
||||
in wstring errorMsg);
|
||||
};
|
||||
|
||||
/**
|
||||
* An asynchronous stream observer is used to ship data over to another thread specified
|
||||
* by the thread's event queue. The receiver stream observer is then used to receive
|
||||
* the notifications on the other thread.
|
||||
*
|
||||
* This interface only provides the initialization needed after construction. Otherwise,
|
||||
* these objects are used simply as nsIStreamObservers.
|
||||
*/
|
||||
[scriptable, uuid(a28dc590-91b3-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsIAsyncStreamObserver : nsIStreamObserver
|
||||
{
|
||||
/**
|
||||
* Initializes an nsIAsyncStreamObserver.
|
||||
* @param eventQueue - may be null indicating the calling thread's event queue
|
||||
*/
|
||||
void init(in nsIStreamObserver receiver,
|
||||
in nsIEventQueue eventQueue);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// Use this CID to construct an nsIAsyncStreamObserver
|
||||
#define NS_ASYNCSTREAMOBSERVER_CID \
|
||||
{ /* fcc7c380-91b3-11d3-8cd9-0060b0fc14a3 */ \
|
||||
0xfcc7c380, \
|
||||
0x91b3, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xd9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Generic status codes for OnStopRequest:
|
||||
|
||||
#define NS_BINDING_SUCCEEDED NS_OK
|
||||
#define NS_BINDING_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
|
||||
#define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
|
||||
|
||||
%}
|
||||
|
||||
183
mozilla/netwerk/base/public/nsIURI.idl
Normal file
183
mozilla/netwerk/base/public/nsIURI.idl
Normal file
@@ -0,0 +1,183 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIURLParser.idl"
|
||||
|
||||
/**
|
||||
* URIs are essentially structured names for things -- anything.
|
||||
* This interface provides accessors to destructure those names.
|
||||
*
|
||||
* This interface follows Tim Berners-Lee's URI spec:
|
||||
*
|
||||
* http://www.w3.org/Addressing/URI/URI_Overview.html
|
||||
*
|
||||
* essentially:
|
||||
*
|
||||
* ftp://username:password@hostname:portnumber/pathname
|
||||
* \ / \ / \ / \ /\ /
|
||||
* - --------------- ------ -------- -------
|
||||
* | | | | |
|
||||
* | | | | Path
|
||||
* | | | Port
|
||||
* | | Host
|
||||
* | PreHost
|
||||
* Scheme
|
||||
*
|
||||
* The subclass nsIURL provides a means to open an input or output
|
||||
* stream to a URI as a source/destination, as well as providing additional
|
||||
* accessors to destructure the path, query and reference portions typically
|
||||
* associated with URLs.
|
||||
*/
|
||||
|
||||
%{C++
|
||||
#undef GetPort // XXX Windows!
|
||||
#undef SetPort // XXX Windows!
|
||||
%}
|
||||
|
||||
[scriptable, uuid(07a22cc0-0ce5-11d3-9331-00104ba0fd40)]
|
||||
interface nsIURI : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns a string representation of the URI. Setting the spec
|
||||
* causes the new spec to be parsed, initializing the URI. Setting
|
||||
* the spec (or any of the accessors) causes also any currently
|
||||
* open streams on the URI's channel to be closed.
|
||||
*/
|
||||
attribute string spec;
|
||||
|
||||
/**
|
||||
* The Scheme is the protocol to which this URI refers. Setting
|
||||
* the scheme is a special operation that builds up an equivalent
|
||||
* URI string from the new scheme and all the other URI attributes
|
||||
* and passes the it to the nsIOService to create a new URI for
|
||||
* the new scheme.
|
||||
*/
|
||||
attribute string scheme;
|
||||
|
||||
/**
|
||||
* The PreHost portion includes elements like the optional
|
||||
* username:password, or maybe other scheme specific items.
|
||||
*/
|
||||
attribute string preHost;
|
||||
|
||||
attribute string username;
|
||||
|
||||
attribute string password;
|
||||
|
||||
/**
|
||||
* The Host is the internet domain name to which this URI refers.
|
||||
* Note that it could be an IP address as well.
|
||||
*/
|
||||
attribute string host;
|
||||
|
||||
/**
|
||||
* A return value of -1 indicates that no port value is set and the
|
||||
* implementor of the specific scheme will use its default port.
|
||||
* Similarly setting a value of -1 indicates that the default is to be used.
|
||||
* Thus as an example:
|
||||
* for HTTP, Port 80 is same as a return value of -1.
|
||||
* However after setting a port (even if its default), the port number will
|
||||
* appear in the ToNewCString function.
|
||||
*/
|
||||
attribute long port;
|
||||
|
||||
/**
|
||||
* Note that the path includes the leading '/' Thus if no path is
|
||||
* available the Path accessor will return a "/"
|
||||
* For SetPath if none is provided, one would be prefixed to the path.
|
||||
*/
|
||||
attribute string path;
|
||||
|
||||
/**
|
||||
* This is a handle to the Parser used to parse the URI
|
||||
*/
|
||||
attribute nsIURLParser URLParser;
|
||||
|
||||
/**
|
||||
* Note that this comparison is only on char* level. Use
|
||||
* the scheme specific URI to do a more thorough check. For example,
|
||||
* in HTTP:
|
||||
* http://foo.com:80 == http://foo.com
|
||||
* but this function through nsIURI alone will not return equality
|
||||
* for this case.
|
||||
*/
|
||||
boolean equals(in nsIURI other);
|
||||
|
||||
/**
|
||||
* Clones the current URI. The newly created URI will be in a closed
|
||||
* state even if the underlying channel of the cloned URI is open.
|
||||
* Cloning allows the current location to be retained since once the
|
||||
* channel is opened the URI may get redirected to a new location.
|
||||
*/
|
||||
nsIURI clone();
|
||||
|
||||
/**
|
||||
* Sets the given string to be a relative path for this URI, and
|
||||
* changes this to read relative. Thus for example- if this =
|
||||
* http://foo.com/bar/index.html, then calling SetRelativePath("/baz") will
|
||||
* change this to http://foo.com/baz and calling it with "baz" will
|
||||
* change this to http://foo.com/bar/baz.
|
||||
*/
|
||||
void setRelativePath(in string relativePath);
|
||||
|
||||
/**
|
||||
* This method resolves a relative string into an absolute URI string,
|
||||
* using the URI as the base.
|
||||
*
|
||||
* This method subsumes the deprecated method nsIIOService::MakeAbsolute.
|
||||
*/
|
||||
string resolve(in string relativePath);
|
||||
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Malformed URI Error
|
||||
#define NS_ERROR_MALFORMED_URI NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 10)
|
||||
|
||||
/**
|
||||
* Protocol writers can obtain a very basic (ok, degenerate) implementation
|
||||
* of nsIURI by calling the component manager with NS_SIMPLEURI_CID. The
|
||||
* implementation returned will only parse things of the form:
|
||||
*
|
||||
* about:cache
|
||||
* \ / \ /
|
||||
* --- ---
|
||||
* | |
|
||||
* Scheme Path
|
||||
*
|
||||
* where the path is everything after the colon. Note that this is probably
|
||||
* only useful for cases like about: or javascript: URIs.
|
||||
*
|
||||
* *** What you most likely will want is NS_STANDARDURL_CID which is much more
|
||||
* full featured. Look at nsIURL.idl for more details.
|
||||
*/
|
||||
|
||||
#define NS_SIMPLEURI_CID \
|
||||
{ /* e0da1d70-2f7b-11d3-8cd0-0060b0fc14a3 */ \
|
||||
0xe0da1d70, \
|
||||
0x2f7b, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xd0, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
%}
|
||||
149
mozilla/netwerk/base/public/nsIURL.idl
Normal file
149
mozilla/netwerk/base/public/nsIURL.idl
Normal file
@@ -0,0 +1,149 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIURI.idl"
|
||||
|
||||
interface nsIChannel;
|
||||
interface nsIEventSinkGetter;
|
||||
|
||||
/**
|
||||
* The nsIURL interface provides convenience methods that further
|
||||
* break down the path portion of nsIURI:
|
||||
*
|
||||
* http://directory/fileBaseName.fileExtension?query
|
||||
* http://directory/fileBaseName.fileExtension#ref
|
||||
* http://directory/fileBaseName.fileExtension;param
|
||||
* \ \ /
|
||||
* \ -----------------------
|
||||
* \ | /
|
||||
* \ fileName /
|
||||
* ----------------------------
|
||||
* |
|
||||
* filePath
|
||||
*/
|
||||
[scriptable, uuid(d6116970-8034-11d3-9399-00104ba0fd40)]
|
||||
interface nsIURL : nsIURI
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// The path attribute is broken down into the following attributes:
|
||||
// filePath, param, query, and ref:
|
||||
|
||||
/**
|
||||
* Returns a path including the directory and file portions of a
|
||||
* URL. E.g. The filePath of "http://foo/bar.html#baz" is
|
||||
* "/foo/bar.html".
|
||||
*/
|
||||
attribute string filePath;
|
||||
|
||||
/**
|
||||
* Returns the parameters specified after the ; in the URL.
|
||||
*
|
||||
*/
|
||||
attribute string param;
|
||||
|
||||
/**
|
||||
* Returns the query portion (the part after the "?") of the URL.
|
||||
* If there isn't one, an empty string is returned.
|
||||
*/
|
||||
attribute string query;
|
||||
|
||||
/**
|
||||
* Returns the reference portion (the part after the "#") of the URL.
|
||||
* If there isn't one, an empty string is returned.
|
||||
*/
|
||||
attribute string ref;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// The filePath attribute is further broken down into the following
|
||||
// attributes: directory, file:
|
||||
|
||||
/**
|
||||
* Returns the directory portion of a URL.
|
||||
* If the URL denotes a path to a directory and not a file,
|
||||
* e.g. http://foo/bar/, then the Directory attribute accesses
|
||||
* the complete /foo/bar/ portion, and the FileName is the
|
||||
* empty string. If the trailing slash is omitted, then the
|
||||
* Directory is /foo/ and the file is bar (i.e. this is a
|
||||
* syntactic, not a semantic breakdown of the Path).
|
||||
* And hence dont rely on this for something to be a definitely
|
||||
* be a file. But you can get just the leading directory portion
|
||||
* for sure.
|
||||
*/
|
||||
attribute string directory;
|
||||
|
||||
/**
|
||||
* Returns the file name portion of a URL.
|
||||
* If the URL denotes a path to a directory and not a file,
|
||||
* e.g. http://foo/bar/, then the Directory attribute accesses
|
||||
* the complete /foo/bar/ portion, and the FileName is the
|
||||
* empty string. Note that this is purely based on searching
|
||||
* for the last trailing slash. And hence dont rely on this to
|
||||
* be a definite file.
|
||||
*/
|
||||
attribute string fileName;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// The fileName attribute is further broken down into the following
|
||||
// attributes: fileName, fileExtension:
|
||||
|
||||
attribute string fileBaseName;
|
||||
|
||||
/**
|
||||
* Returns the file extension portion of a filename in a url.
|
||||
* If a file extension does not exist, the empty string is returned.
|
||||
*/
|
||||
attribute string fileExtension;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
/**
|
||||
* Protocol writers can obtain a default nsIURL implementation by calling the
|
||||
* component manager with NS_STANDARDURL_CID. The implementation returned will
|
||||
* only implement the set of accessors specified by nsIURL. After obtaining the
|
||||
* instance from the component manager, the Init routine must be called on it
|
||||
* to initialize it from the user's URL spec.
|
||||
*/
|
||||
|
||||
#define NS_STANDARDURL_CID \
|
||||
{ /* de9472d0-8034-11d3-9399-00104ba0fd40 */ \
|
||||
0xde9472d0, \
|
||||
0x8034, \
|
||||
0x11d3, \
|
||||
{0x93, 0x99, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
interface nsIFile;
|
||||
|
||||
/**
|
||||
* nsIFileURL is used for the file: protocol, and gives access to the
|
||||
* underlying nsIFile object.
|
||||
*/
|
||||
[scriptable, uuid(d26b2e2e-1dd1-11b2-88f3-8545a7ba7949)]
|
||||
interface nsIFileURL : nsIURL
|
||||
{
|
||||
attribute nsIFile file;
|
||||
};
|
||||
125
mozilla/netwerk/base/public/nsIURLParser.idl
Normal file
125
mozilla/netwerk/base/public/nsIURLParser.idl
Normal file
@@ -0,0 +1,125 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Andreas Otte
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* nsIURLParser is the abstract base class for parsing URLs
|
||||
*/
|
||||
|
||||
[scriptable, uuid(4b4975f9-f128-47fd-b11e-88402233cbdf)]
|
||||
interface nsIURLParser : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* Parses a URL and thinks it is parsing the scheme
|
||||
*/
|
||||
void ParseAtScheme(in string i_Spec,
|
||||
out string o_Scheme,
|
||||
out string o_Username,
|
||||
out string o_Password,
|
||||
out string o_Host,
|
||||
out long o_Port,
|
||||
out string o_Path);
|
||||
|
||||
/**
|
||||
* Parses a URL and thinks it is parsing the prehost
|
||||
*/
|
||||
void ParseAtPreHost(in string i_Spec,
|
||||
out string o_Username,
|
||||
out string o_Password,
|
||||
out string o_Host,
|
||||
out long o_Port,
|
||||
out string o_Path);
|
||||
|
||||
/**
|
||||
* Parses a URL and thinks it is parsing the host
|
||||
*/
|
||||
void ParseAtHost(in string i_Spec,
|
||||
out string o_Host,
|
||||
out long o_Port,
|
||||
out string o_Path);
|
||||
|
||||
/**
|
||||
* Parses a URL and thinks it is parsing the port
|
||||
*/
|
||||
void ParseAtPort(in string i_Spec,
|
||||
out long o_Port,
|
||||
out string o_Path);
|
||||
|
||||
/**
|
||||
* Parses a URL and thinks it is parsing the path
|
||||
*/
|
||||
void ParseAtPath(in string i_Spec,
|
||||
out string o_Path);
|
||||
|
||||
/**
|
||||
* Parses a URL-path and thinks it is parsing the directory
|
||||
*/
|
||||
void ParseAtDirectory(in string i_Path,
|
||||
out string o_Directory,
|
||||
out string o_FileBaseName,
|
||||
out string o_FileExtension,
|
||||
out string o_Param,
|
||||
out string o_Query,
|
||||
out string o_Ref);
|
||||
|
||||
/**
|
||||
* Parses the URL-PreHost into its components
|
||||
*/
|
||||
void ParsePreHost(in string i_PreHost,
|
||||
out string o_Username,
|
||||
out string o_Password);
|
||||
|
||||
/**
|
||||
* Parses the URL-Filename into its components
|
||||
*/
|
||||
void ParseFileName(in string i_FileName,
|
||||
out string o_FileBaseName,
|
||||
out string o_FileExtension);
|
||||
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_STANDARDURLPARSER_CID \
|
||||
{ /* dbf72351-4fd8-46f0-9dbc-fa5ba60a30c5 */ \
|
||||
0xdbf72351, \
|
||||
0x4fd8, \
|
||||
0x46f0, \
|
||||
{0x9d, 0xbc, 0xfa, 0x5b, 0xa6, 0x0a, 0x30, 0x5c} \
|
||||
}
|
||||
|
||||
#define NS_AUTHORITYURLPARSER_CID \
|
||||
{ /* 90012125-1616-4fa1-ae14-4e7fa5766eb6 */ \
|
||||
0x90012125, \
|
||||
0x1616, \
|
||||
0x4fa1, \
|
||||
{0xae, 0x14, 0x4e, 0x7f, 0xa5, 0x76, 0x6e, 0xb6} \
|
||||
}
|
||||
|
||||
#define NS_NOAUTHORITYURLPARSER_CID \
|
||||
{ /* 9eeb1b89-c87e-4404-9de6-dbd41aeaf3d7 */ \
|
||||
0x9eeb1b89, \
|
||||
0xc87e, \
|
||||
0x4404, \
|
||||
{0x9d, 0xe6, 0xdb, 0xd4, 0x1a, 0xea, 0xf3, 0xd7} \
|
||||
}
|
||||
|
||||
%}
|
||||
409
mozilla/netwerk/base/public/nsNetUtil.h
Normal file
409
mozilla/netwerk/base/public/nsNetUtil.h
Normal file
@@ -0,0 +1,409 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsNetUtil_h__
|
||||
#define nsNetUtil_h__
|
||||
|
||||
#include "nsIURI.h"
|
||||
#include "netCore.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIAllocator.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIHTTPProtocolHandler.h"
|
||||
#include "nsIStreamLoader.h"
|
||||
#include "prio.h" // for read/write flags, permissions, etc.
|
||||
|
||||
inline nsresult
|
||||
NS_NewURI(nsIURI* *result,
|
||||
const char* spec,
|
||||
nsIURI* baseURI = nsnull,
|
||||
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsIIOService* serv = ioService;
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
if (serv == nsnull) {
|
||||
rv = nsServiceManager::GetService(kIOServiceCID, NS_GET_IID(nsIIOService),
|
||||
(nsISupports**)&serv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
rv = serv->NewURI(spec, baseURI, result);
|
||||
|
||||
if (ioService == nsnull) {
|
||||
(void)nsServiceManager::ReleaseService(kIOServiceCID, serv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewURI(nsIURI* *result,
|
||||
const nsString& spec,
|
||||
nsIURI* baseURI = nsnull,
|
||||
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
||||
{
|
||||
char* specStr = spec.ToNewUTF8String(); // this forces a single byte char*
|
||||
if (specStr == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsresult rv = NS_NewURI(result, specStr, baseURI, ioService);
|
||||
nsAllocator::Free(specStr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_OpenURI(nsIChannel* *result,
|
||||
nsIURI* uri,
|
||||
nsIIOService* ioService = nsnull, // pass in nsIIOService to optimize callers
|
||||
nsILoadGroup* loadGroup = nsnull,
|
||||
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
||||
nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
|
||||
PRUint32 bufferSegmentSize = 0,
|
||||
PRUint32 bufferMaxSize = 0)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsIIOService* serv = ioService;
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
if (serv == nsnull) {
|
||||
rv = nsServiceManager::GetService(kIOServiceCID, NS_GET_IID(nsIIOService),
|
||||
(nsISupports**)&serv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsIChannel* channel = nsnull;
|
||||
rv = serv->NewChannelFromURI(uri, &channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (loadGroup) {
|
||||
rv = channel->SetLoadGroup(loadGroup);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (notificationCallbacks) {
|
||||
rv = channel->SetNotificationCallbacks(notificationCallbacks);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (loadAttributes != nsIChannel::LOAD_NORMAL) {
|
||||
rv = channel->SetLoadAttributes(loadAttributes);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (bufferSegmentSize != 0) {
|
||||
rv = channel->SetBufferSegmentSize(bufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (bufferMaxSize != 0) {
|
||||
rv = channel->SetBufferMaxSize(bufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
if (ioService == nsnull) {
|
||||
(void)nsServiceManager::ReleaseService(kIOServiceCID, serv);
|
||||
}
|
||||
|
||||
*result = channel;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Use this function with CAUTION. And do not use it on
|
||||
// the UI thread. It creates a stream that blocks when
|
||||
// you Read() from it and blocking the UI thread is
|
||||
// illegal. If you don't want to implement a full
|
||||
// blown asyncrhonous consumer (via nsIStreamListener)
|
||||
// look at nsIStreamLoader instead.
|
||||
inline nsresult
|
||||
NS_OpenURI(nsIInputStream* *result,
|
||||
nsIURI* uri,
|
||||
nsIIOService* ioService = nsnull, // pass in nsIIOService to optimize callers
|
||||
nsILoadGroup* loadGroup = nsnull,
|
||||
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
||||
nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
|
||||
PRUint32 bufferSegmentSize = 0,
|
||||
PRUint32 bufferMaxSize = 0)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
||||
rv = NS_OpenURI(getter_AddRefs(channel), uri, ioService,
|
||||
loadGroup, notificationCallbacks, loadAttributes,
|
||||
bufferSegmentSize, bufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIInputStream* inStr;
|
||||
rv = channel->OpenInputStream(&inStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = inStr;
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_OpenURI(nsIStreamListener* aConsumer,
|
||||
nsISupports* context,
|
||||
nsIURI* uri,
|
||||
nsIIOService* ioService = nsnull, // pass in nsIIOService to optimize callers
|
||||
nsILoadGroup* loadGroup = nsnull,
|
||||
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
||||
nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
|
||||
PRUint32 bufferSegmentSize = 0,
|
||||
PRUint32 bufferMaxSize = 0)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
||||
rv = NS_OpenURI(getter_AddRefs(channel), uri, ioService,
|
||||
loadGroup, notificationCallbacks, loadAttributes,
|
||||
bufferSegmentSize, bufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->AsyncRead(aConsumer, context);
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_MakeAbsoluteURI(char* *result,
|
||||
const char* spec,
|
||||
nsIURI* baseURI = nsnull,
|
||||
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ASSERTION(baseURI, "It doesn't make sense to not supply a base URI");
|
||||
|
||||
if (spec == nsnull)
|
||||
return baseURI->GetSpec(result);
|
||||
|
||||
nsIIOService* serv = ioService;
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
if (serv == nsnull) {
|
||||
rv = nsServiceManager::GetService(kIOServiceCID, NS_GET_IID(nsIIOService),
|
||||
(nsISupports**)&serv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
PRUint32 startPos, endPos;
|
||||
rv = serv->ExtractScheme(spec, &startPos, &endPos, nsnull);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// if spec has a scheme, then it's already absolute
|
||||
*result = nsCRT::strdup(spec);
|
||||
rv = (*result == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||
}
|
||||
else {
|
||||
rv = baseURI->Resolve(spec, result);
|
||||
}
|
||||
|
||||
if (ioService == nsnull) {
|
||||
(void)nsServiceManager::ReleaseService(kIOServiceCID, serv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_MakeAbsoluteURI(nsString& result,
|
||||
const nsString& spec,
|
||||
nsIURI* baseURI = nsnull,
|
||||
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
||||
{
|
||||
char* resultStr;
|
||||
char* specStr = spec.ToNewUTF8String();
|
||||
if (!specStr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult rv = NS_MakeAbsoluteURI(&resultStr, specStr, baseURI, ioService);
|
||||
nsAllocator::Free(specStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
result.AssignWithConversion(resultStr);
|
||||
nsAllocator::Free(resultStr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewPostDataStream(nsIInputStream **result,
|
||||
PRBool isFile,
|
||||
const char *data,
|
||||
PRUint32 encodeFlags,
|
||||
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsIIOService* serv = ioService;
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
if (serv == nsnull) {
|
||||
rv = nsServiceManager::GetService(kIOServiceCID, NS_GET_IID(nsIIOService),
|
||||
(nsISupports**)&serv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = serv->GetProtocolHandler("http", getter_AddRefs(handler));
|
||||
|
||||
if (ioService == nsnull) {
|
||||
(void)nsServiceManager::ReleaseService(kIOServiceCID, serv);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIHTTPProtocolHandler> http = do_QueryInterface(handler, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return http->NewPostDataStream(isFile, data, encodeFlags, result);
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewInputStreamChannel(nsIChannel **result,
|
||||
nsIURI* uri,
|
||||
nsIInputStream* inStr,
|
||||
const char* contentType,
|
||||
PRInt32 contentLength)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIInputStreamChannel> channel;
|
||||
static NS_DEFINE_CID(kInputStreamChannelCID, NS_INPUTSTREAMCHANNEL_CID);
|
||||
rv = nsComponentManager::CreateInstance(kInputStreamChannelCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIInputStreamChannel),
|
||||
getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = channel->Init(uri, inStr, contentType, contentLength);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = channel;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewLoadGroup(nsILoadGroup* *result, nsIStreamObserver* obs)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILoadGroup> group;
|
||||
static NS_DEFINE_CID(kLoadGroupCID, NS_LOADGROUP_CID);
|
||||
rv = nsComponentManager::CreateInstance(kLoadGroupCID, nsnull,
|
||||
NS_GET_IID(nsILoadGroup),
|
||||
getter_AddRefs(group));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = group->Init(obs);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = group;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
inline nsresult
|
||||
NS_NewStreamLoader(nsIStreamLoader* *result,
|
||||
nsIURI* uri,
|
||||
nsIStreamLoaderObserver* observer,
|
||||
nsISupports* context = nsnull,
|
||||
nsILoadGroup* loadGroup = nsnull,
|
||||
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
||||
nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
|
||||
PRUint32 bufferSegmentSize = 0,
|
||||
PRUint32 bufferMaxSize = 0)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStreamLoader> loader;
|
||||
static NS_DEFINE_CID(kStreamLoaderCID, NS_STREAMLOADER_CID);
|
||||
rv = nsComponentManager::CreateInstance(kStreamLoaderCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIStreamLoader),
|
||||
getter_AddRefs(loader));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = loader->Init(uri, observer, context, loadGroup, notificationCallbacks, loadAttributes,
|
||||
bufferSegmentSize, bufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
*result = loader;
|
||||
NS_ADDREF(*result);
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewAsyncStreamObserver(nsIStreamObserver **result,
|
||||
nsIStreamObserver *receiver,
|
||||
nsIEventQueue *eventQueue)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAsyncStreamObserver> obs;
|
||||
static NS_DEFINE_CID(kAsyncStreamObserverCID, NS_ASYNCSTREAMOBSERVER_CID);
|
||||
rv = nsComponentManager::CreateInstance(kAsyncStreamObserverCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIAsyncStreamObserver),
|
||||
getter_AddRefs(obs));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = obs->Init(receiver, eventQueue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = obs;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewAsyncStreamListener(nsIStreamListener **result,
|
||||
nsIStreamListener *receiver,
|
||||
nsIEventQueue *eventQueue)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIAsyncStreamListener> lsnr;
|
||||
static NS_DEFINE_CID(kAsyncStreamListenerCID, NS_ASYNCSTREAMLISTENER_CID);
|
||||
rv = nsComponentManager::CreateInstance(kAsyncStreamListenerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIAsyncStreamListener),
|
||||
getter_AddRefs(lsnr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = lsnr->Init(receiver, eventQueue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = lsnr;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
NS_NewSyncStreamListener(nsIInputStream **inStream,
|
||||
nsIBufferOutputStream **outStream,
|
||||
nsIStreamListener **listener)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISyncStreamListener> lsnr;
|
||||
static NS_DEFINE_CID(kSyncStreamListenerCID, NS_SYNCSTREAMLISTENER_CID);
|
||||
rv = nsComponentManager::CreateInstance(kSyncStreamListenerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsISyncStreamListener),
|
||||
getter_AddRefs(lsnr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = lsnr->Init(inStream, outStream);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*listener = lsnr;
|
||||
NS_ADDREF(*listener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif // nsNetUtil_h__
|
||||
100
mozilla/netwerk/base/public/nsUnixColorPrintf.h
Normal file
100
mozilla/netwerk/base/public/nsUnixColorPrintf.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsUnixColorPrintf_h_
|
||||
#define _nsUnixColorPrintf_h_
|
||||
|
||||
#if defined(XP_UNIX) && defined(NS_DEBUG)
|
||||
|
||||
#define STARTGRAY "\033[1;30m"
|
||||
#define STARTRED "\033[1;31m"
|
||||
#define STARTGREEN "\033[1;32m"
|
||||
#define STARTYELLOW "\033[1;33m"
|
||||
#define STARTBLUE "\033[1;34m"
|
||||
#define STARTMAGENTA "\033[1;35m"
|
||||
#define STARTCYAN "\033[1;36m"
|
||||
#define STARTUNDERLINE "\033[4m"
|
||||
#define STARTREVERSE "\033[7m"
|
||||
#define ENDCOLOR "\033[0m"
|
||||
|
||||
#define PRINTF_GRAY nsUnixColorPrintf __color_printf(STARTGREY)
|
||||
#define PRINTF_RED nsUnixColorPrintf __color_printf(STARTRED)
|
||||
#define PRINTF_GREEN nsUnixColorPrintf __color_printf(STARTGREEN)
|
||||
#define PRINTF_YELLOW nsUnixColorPrintf __color_printf(STARTYELLOW)
|
||||
#define PRINTF_BLUE nsUnixColorPrintf __color_printf(STARTBLUE)
|
||||
#define PRINTF_MAGENTA nsUnixColorPrintf __color_printf(STARTMAGENTA)
|
||||
#define PRINTF_CYAN nsUnixColorPrintf __color_printf(STARTCYAN)
|
||||
#define PRINTF_UNDERLINE nsUnixColorPrintf __color_printf(STARTUNDERLINE)
|
||||
#define PRINTF_REVERSE nsUnixColorPrintf __color_printf(STARTREVERSE)
|
||||
|
||||
/*
|
||||
The nsUnixColorPrintf is a handy set of color term codes to change
|
||||
the color of console texts for easier spotting. As of now this is
|
||||
Unix and Debug only.
|
||||
|
||||
Usage is simple.
|
||||
|
||||
See examples in
|
||||
mozilla/netwerk/protocol/http/src/nsHTTPHandler.cpp
|
||||
|
||||
-Gagan Saksena 11/01/99
|
||||
*/
|
||||
|
||||
class nsUnixColorPrintf
|
||||
{
|
||||
public:
|
||||
nsUnixColorPrintf(const char* colorCode)
|
||||
{
|
||||
printf("%s",colorCode);
|
||||
}
|
||||
~nsUnixColorPrintf()
|
||||
{
|
||||
printf("%s",ENDCOLOR);
|
||||
}
|
||||
};
|
||||
|
||||
#else // XP_UNIX
|
||||
|
||||
#define STARTGRAY ""
|
||||
#define STARTRED ""
|
||||
#define STARTGREEN ""
|
||||
#define STARTYELLOW ""
|
||||
#define STARTBLUE ""
|
||||
#define STARTMAGENTA ""
|
||||
#define STARTCYAN ""
|
||||
#define STARTUNDERLINE ""
|
||||
#define STARTREVERSE ""
|
||||
#define ENDCOLOR ""
|
||||
|
||||
#define PRINTF_GRAY
|
||||
#define PRINTF_RED
|
||||
#define PRINTF_GREEN
|
||||
#define PRINTF_YELLOW
|
||||
#define PRINTF_BLUE
|
||||
#define PRINTF_MAGENTA
|
||||
#define PRINTF_CYAN
|
||||
#define PRINTF_UNDERLINE
|
||||
#define PRINTF_REVERSE
|
||||
|
||||
#endif // XP_UNIX
|
||||
#endif // nsUnixColorPrintf
|
||||
|
||||
63
mozilla/netwerk/base/src/Makefile.in
Normal file
63
mozilla/netwerk/base/src/Makefile.in
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
LIBRARY_NAME = neckobase_s
|
||||
|
||||
CPPSRCS = \
|
||||
nsURLHelper.cpp \
|
||||
nsFileStreams.cpp \
|
||||
nsBufferedStreams.cpp \
|
||||
nsAsyncStreamListener.cpp \
|
||||
nsSyncStreamListener.cpp \
|
||||
nsIOService.cpp \
|
||||
nsSocketTransport.cpp \
|
||||
nsSocketTransportService.cpp \
|
||||
nsFileTransport.cpp \
|
||||
nsFileTransportService.cpp \
|
||||
nsStdURLParser.cpp \
|
||||
nsAuthURLParser.cpp \
|
||||
nsNoAuthURLParser.cpp \
|
||||
nsStdURL.cpp \
|
||||
nsSimpleURI.cpp \
|
||||
nsNetModuleMgr.cpp \
|
||||
nsNetModRegEntry.cpp \
|
||||
nsLoadGroup.cpp \
|
||||
nsInputStreamChannel.cpp \
|
||||
nsDirectoryIndexStream.cpp \
|
||||
nsStreamLoader.cpp \
|
||||
nsProtocolProxyService.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
64
mozilla/netwerk/base/src/makefile.win
Normal file
64
mozilla/netwerk/base/src/makefile.win
Normal file
@@ -0,0 +1,64 @@
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
MODULE = necko
|
||||
|
||||
DEPTH = ..\..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
LCFLAGS = -DWIN32_LEAN_AND_MEAN -D_IMPL_NS_NET
|
||||
|
||||
LIBRARY_NAME=neckobase_s
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsURLHelper.obj \
|
||||
.\$(OBJDIR)\nsFileStreams.obj \
|
||||
.\$(OBJDIR)\nsBufferedStreams.obj \
|
||||
.\$(OBJDIR)\nsAsyncStreamListener.obj \
|
||||
.\$(OBJDIR)\nsSyncStreamListener.obj \
|
||||
.\$(OBJDIR)\nsIOService.obj \
|
||||
.\$(OBJDIR)\nsSocketTransport.obj \
|
||||
.\$(OBJDIR)\nsSocketTransportService.obj \
|
||||
.\$(OBJDIR)\nsFileTransport.obj \
|
||||
.\$(OBJDIR)\nsFileTransportService.obj \
|
||||
.\$(OBJDIR)\nsStdURLParser.obj \
|
||||
.\$(OBJDIR)\nsAuthURLParser.obj \
|
||||
.\$(OBJDIR)\nsNoAuthURLParser.obj \
|
||||
.\$(OBJDIR)\nsStdURL.obj \
|
||||
.\$(OBJDIR)\nsSimpleURI.obj \
|
||||
.\$(OBJDIR)\nsNetModuleMgr.obj \
|
||||
.\$(OBJDIR)\nsNetModRegEntry.obj \
|
||||
.\$(OBJDIR)\nsLoadGroup.obj \
|
||||
.\$(OBJDIR)\nsInputStreamChannel.obj \
|
||||
.\$(OBJDIR)\nsDirectoryIndexStream.obj \
|
||||
.\$(OBJDIR)\nsStreamLoader.obj \
|
||||
.\$(OBJDIR)\nsProtocolProxyService.obj \
|
||||
$(NULL)
|
||||
|
||||
INCS = $(INCS) \
|
||||
-I$(DEPTH)\dist\include \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
476
mozilla/netwerk/base/src/nsAsyncStreamListener.cpp
Normal file
476
mozilla/netwerk/base/src/nsAsyncStreamListener.cpp
Normal file
@@ -0,0 +1,476 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsAsyncStreamListener.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "prlog.h"
|
||||
|
||||
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
PRLogModuleInfo* gStreamEventLog = 0;
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsStreamListenerEvent(nsAsyncStreamObserver* listener,
|
||||
nsIChannel* channel, nsISupports* context);
|
||||
virtual ~nsStreamListenerEvent();
|
||||
|
||||
nsresult Fire(nsIEventQueue* aEventQ);
|
||||
|
||||
NS_IMETHOD HandleEvent() = 0;
|
||||
|
||||
protected:
|
||||
static void PR_CALLBACK HandlePLEvent(PLEvent* aEvent);
|
||||
static void PR_CALLBACK DestroyPLEvent(PLEvent* aEvent);
|
||||
|
||||
nsAsyncStreamObserver* mListener;
|
||||
nsIChannel* mChannel;
|
||||
nsISupports* mContext;
|
||||
PLEvent * mEvent;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsStreamListenerEvent::nsStreamListenerEvent(nsAsyncStreamObserver* listener,
|
||||
nsIChannel* channel, nsISupports* context)
|
||||
: mListener(listener), mChannel(channel), mContext(context), mEvent(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStreamListenerEvent);
|
||||
|
||||
NS_IF_ADDREF(mListener);
|
||||
NS_IF_ADDREF(mChannel);
|
||||
NS_IF_ADDREF(mContext);
|
||||
}
|
||||
|
||||
nsStreamListenerEvent::~nsStreamListenerEvent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsStreamListenerEvent);
|
||||
|
||||
NS_IF_RELEASE(mListener);
|
||||
NS_IF_RELEASE(mChannel);
|
||||
NS_IF_RELEASE(mContext);
|
||||
|
||||
if (nsnull != mEvent)
|
||||
{
|
||||
delete mEvent;
|
||||
mEvent = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsStreamListenerEvent::HandlePLEvent(PLEvent* aEvent)
|
||||
{
|
||||
nsStreamListenerEvent * ev =
|
||||
(nsStreamListenerEvent *) PL_GetEventOwner(aEvent);
|
||||
|
||||
NS_ASSERTION(nsnull != ev,"null event.");
|
||||
|
||||
nsresult rv = ev->HandleEvent();
|
||||
//
|
||||
// If the consumer fails, then cancel the transport. This is necessary
|
||||
// in case where the socket transport is blocked waiting for room in the
|
||||
// pipe, but the consumer fails without consuming all the data.
|
||||
//
|
||||
// Unless the transport is cancelled, it will block forever, waiting for
|
||||
// the pipe to empty...
|
||||
//
|
||||
if (NS_FAILED(rv)) {
|
||||
nsresult cancelRv = ev->mChannel->Cancel(rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(cancelRv), "Cancel failed");
|
||||
}
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsStreamListenerEvent::DestroyPLEvent(PLEvent* aEvent)
|
||||
{
|
||||
nsStreamListenerEvent * ev =
|
||||
(nsStreamListenerEvent *) PL_GetEventOwner(aEvent);
|
||||
|
||||
NS_ASSERTION(nsnull != ev,"null event.");
|
||||
|
||||
delete ev;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStreamListenerEvent::Fire(nsIEventQueue* aEventQueue)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aEventQueue, "nsIEventQueue for thread is null");
|
||||
|
||||
NS_PRECONDITION(nsnull == mEvent, "Init plevent only once.");
|
||||
|
||||
mEvent = new PLEvent;
|
||||
|
||||
PL_InitEvent(mEvent,
|
||||
this,
|
||||
(PLHandleEventProc) nsStreamListenerEvent::HandlePLEvent,
|
||||
(PLDestroyEventProc) nsStreamListenerEvent::DestroyPLEvent);
|
||||
|
||||
PRStatus status = aEventQueue->PostEvent(mEvent);
|
||||
return status == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsAsyncStreamObserver,
|
||||
nsIAsyncStreamObserver,
|
||||
nsIStreamObserver)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsAsyncStreamListener, nsAsyncStreamObserver);
|
||||
NS_IMPL_RELEASE_INHERITED(nsAsyncStreamListener, nsAsyncStreamObserver);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(NS_GET_IID(nsIAsyncStreamListener))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIAsyncStreamListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIStreamListener))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIStreamListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return nsAsyncStreamObserver::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::Init(nsIStreamObserver* aObserver, nsIEventQueue* aEventQ)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
mReceiver = aObserver;
|
||||
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueService, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = eventQService->ResolveEventQueue(aEventQ, getter_AddRefs(mEventQueue));
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnStartRequest...
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnStartRequestEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnStartRequestEvent(nsAsyncStreamObserver* listener,
|
||||
nsIChannel* channel, nsISupports* context)
|
||||
: nsStreamListenerEvent(listener, channel, context) {}
|
||||
virtual ~nsOnStartRequestEvent() {}
|
||||
|
||||
NS_IMETHOD HandleEvent();
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnStartRequestEvent::HandleEvent()
|
||||
{
|
||||
#if defined(PR_LOGGING)
|
||||
if (!gStreamEventLog)
|
||||
gStreamEventLog = PR_NewLogModule("netlibStreamEvent");
|
||||
PR_LOG(gStreamEventLog, PR_LOG_DEBUG,
|
||||
("netlibEvent: Handle Start [event=%x]", this));
|
||||
#endif
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
|
||||
nsresult status;
|
||||
nsresult rv = mChannel->GetStatus(&status);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetStatus failed");
|
||||
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(status)) {
|
||||
rv = receiver->OnStartRequest(mChannel, mContext);
|
||||
}
|
||||
else {
|
||||
NS_WARNING("not calling OnStartRequest");
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::OnStartRequest(nsIChannel* channel, nsISupports* context)
|
||||
{
|
||||
nsresult rv;
|
||||
nsOnStartRequestEvent* event =
|
||||
new nsOnStartRequestEvent(this, channel, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
PLEventQueue *equeue;
|
||||
mEventQueue->GetPLEventQueue(&equeue);
|
||||
char ts[80];
|
||||
sprintf(ts, "nsAsyncStreamObserver: Start [this=%lx queue=%lx",
|
||||
(long)this, (long)equeue);
|
||||
if (!gStreamEventLog)
|
||||
gStreamEventLog = PR_NewLogModule("netlibStreamEvent");
|
||||
PR_LOG(gStreamEventLog, PR_LOG_DEBUG,
|
||||
("nsAsyncStreamObserver: Start [this=%x queue=%x event=%x]",
|
||||
this, equeue, event));
|
||||
#endif
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnStopRequest
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnStopRequestEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnStopRequestEvent(nsAsyncStreamObserver* listener,
|
||||
nsISupports* context, nsIChannel* channel)
|
||||
: nsStreamListenerEvent(listener, channel, context),
|
||||
mStatus(NS_OK), mMessage(nsnull) {}
|
||||
virtual ~nsOnStopRequestEvent();
|
||||
|
||||
nsresult Init(nsresult status, const PRUnichar* aMsg);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsresult mStatus;
|
||||
PRUnichar* mMessage;
|
||||
};
|
||||
|
||||
nsOnStopRequestEvent::~nsOnStopRequestEvent()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnStopRequestEvent::Init(nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
mStatus = status;
|
||||
mMessage = (PRUnichar*)aMsg;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnStopRequestEvent::HandleEvent()
|
||||
{
|
||||
#if defined(PR_LOGGING)
|
||||
if (!gStreamEventLog)
|
||||
gStreamEventLog = PR_NewLogModule("netlibStreamEvent");
|
||||
PR_LOG(gStreamEventLog, PR_LOG_DEBUG,
|
||||
("netlibEvent: Handle Stop [event=%x]", this));
|
||||
#endif
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
|
||||
nsresult status = NS_OK;
|
||||
nsresult rv = mChannel->GetStatus(&status);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetStatus failed");
|
||||
|
||||
//
|
||||
// If the consumer returned a failure code, then pass it out in the
|
||||
// OnStopRequest(...) notification...
|
||||
//
|
||||
if (NS_SUCCEEDED(rv) && NS_FAILED(status)) {
|
||||
mStatus = status;
|
||||
}
|
||||
return receiver->OnStopRequest(mChannel, mContext, mStatus, mMessage);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::OnStopRequest(nsIChannel* channel, nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
//
|
||||
// Fire the OnStopRequest(...) regardless of what the current
|
||||
// Status is...
|
||||
//
|
||||
nsOnStopRequestEvent* event =
|
||||
new nsOnStopRequestEvent(this, context, channel);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aStatus, aMsg);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
#if defined(PR_LOGGING)
|
||||
PLEventQueue *equeue;
|
||||
mEventQueue->GetPLEventQueue(&equeue);
|
||||
if (!gStreamEventLog)
|
||||
gStreamEventLog = PR_NewLogModule("netlibStreamEvent");
|
||||
PR_LOG(gStreamEventLog, PR_LOG_DEBUG,
|
||||
("nsAsyncStreamObserver: Stop [this=%x queue=%x event=%x]",
|
||||
this, equeue, event));
|
||||
#endif
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnDataAvailable
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnDataAvailableEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnDataAvailableEvent(nsAsyncStreamObserver* listener,
|
||||
nsIChannel* channel, nsISupports* context)
|
||||
: nsStreamListenerEvent(listener, channel, context),
|
||||
mIStream(nsnull), mLength(0) {}
|
||||
virtual ~nsOnDataAvailableEvent();
|
||||
|
||||
nsresult Init(nsIInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsIInputStream* mIStream;
|
||||
PRUint32 mSourceOffset;
|
||||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
nsOnDataAvailableEvent::~nsOnDataAvailableEvent()
|
||||
{
|
||||
NS_RELEASE(mIStream);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnDataAvailableEvent::Init(nsIInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
mSourceOffset = aSourceOffset;
|
||||
mLength = aLength;
|
||||
mIStream = aIStream;
|
||||
NS_ADDREF(mIStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnDataAvailableEvent::HandleEvent()
|
||||
{
|
||||
#if defined(PR_LOGGING)
|
||||
if (!gStreamEventLog)
|
||||
gStreamEventLog = PR_NewLogModule("netlibStreamEvent");
|
||||
PR_LOG(gStreamEventLog, PR_LOG_DEBUG,
|
||||
("netlibEvent: Handle Data [event=%x]", this));
|
||||
#endif
|
||||
nsIStreamListener* receiver = (nsIStreamListener*)mListener->GetReceiver();
|
||||
nsresult status;
|
||||
nsresult rv = mChannel->GetStatus(&status);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetStatus failed");
|
||||
|
||||
//
|
||||
// Only send OnDataAvailable(... ) notifications if all previous calls
|
||||
// have succeeded...
|
||||
//
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(status)) {
|
||||
rv = receiver->OnDataAvailable(mChannel, mContext,
|
||||
mIStream, mSourceOffset, mLength);
|
||||
}
|
||||
else {
|
||||
NS_WARNING("not calling OnDataAvailable");
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamListener::OnDataAvailable(nsIChannel* channel, nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult rv;
|
||||
nsOnDataAvailableEvent* event =
|
||||
new nsOnDataAvailableEvent(this, channel, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aIStream, aSourceOffset, aLength);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
#if defined(PR_LOGGING)
|
||||
PLEventQueue *equeue;
|
||||
mEventQueue->GetPLEventQueue(&equeue);
|
||||
if (!gStreamEventLog)
|
||||
gStreamEventLog = PR_NewLogModule("netlibStreamEvent");
|
||||
PR_LOG(gStreamEventLog, PR_LOG_DEBUG,
|
||||
("nsAsyncStreamObserver: Data [this=%x queue=%x event=%x]",
|
||||
this, equeue, event));
|
||||
#endif
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_METHOD
|
||||
nsAsyncStreamObserver::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsAsyncStreamObserver* l = new nsAsyncStreamObserver();
|
||||
if (l == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(l);
|
||||
nsresult rv = l->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(l);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsAsyncStreamListener::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsAsyncStreamListener* l = new nsAsyncStreamListener();
|
||||
if (l == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(l);
|
||||
nsresult rv = l->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(l);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
108
mozilla/netwerk/base/src/nsAsyncStreamListener.h
Normal file
108
mozilla/netwerk/base/src/nsAsyncStreamListener.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsAsyncStreamListener_h__
|
||||
#define nsAsyncStreamListener_h__
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIStreamObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsAsyncStreamObserver : public nsIAsyncStreamObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
NS_DECL_NSIASYNCSTREAMOBSERVER
|
||||
|
||||
// nsAsyncStreamObserver methods:
|
||||
nsAsyncStreamObserver()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
virtual ~nsAsyncStreamObserver() {}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsISupports* GetReceiver() { return mReceiver.get(); }
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIEventQueue> mEventQueue;
|
||||
nsCOMPtr<nsIStreamObserver> mReceiver;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsAsyncStreamListener : public nsAsyncStreamObserver,
|
||||
public nsIAsyncStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnStartRequest(nsIChannel* channel,
|
||||
nsISupports* context)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStartRequest(channel, context);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStopRequest(channel, context, aStatus, aMsg);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsIChannel* channel, nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
// nsIAsyncStreamListener methods:
|
||||
NS_IMETHOD Init(nsIStreamListener* aListener, nsIEventQueue* aEventQ) {
|
||||
return nsAsyncStreamObserver::Init(aListener, aEventQ);
|
||||
}
|
||||
|
||||
// nsAsyncStreamListener methods:
|
||||
nsAsyncStreamListener() {
|
||||
MOZ_COUNT_CTOR(nsAsyncStreamListener);
|
||||
}
|
||||
|
||||
virtual ~nsAsyncStreamListener() {
|
||||
MOZ_COUNT_DTOR(nsAsyncStreamListener);
|
||||
}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // nsAsyncStreamListener_h__
|
||||
522
mozilla/netwerk/base/src/nsAuthURLParser.cpp
Normal file
522
mozilla/netwerk/base/src/nsAuthURLParser.cpp
Normal file
@@ -0,0 +1,522 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Andreas Otte.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsAuthURLParser.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
#include "prprf.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsAuthURLParser, NS_GET_IID(nsIURLParser))
|
||||
|
||||
nsAuthURLParser::~nsAuthURLParser()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsAuthURLParser::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsAuthURLParser* p = new nsAuthURLParser();
|
||||
if (p == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(p);
|
||||
nsresult rv = p->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(p);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParseAtScheme(const char* i_Spec, char* *o_Scheme,
|
||||
char* *o_Username, char* *o_Password,
|
||||
char* *o_Host, PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_PRECONDITION( (nsnull != i_Spec), "Parse called on empty url!");
|
||||
if (!i_Spec)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
int len = PL_strlen(i_Spec);
|
||||
if (len >= 2 && *i_Spec == '/' && *(i_Spec+1) == '/') // No Scheme
|
||||
{
|
||||
rv = ParseAtPreHost(i_Spec, o_Username, o_Password, o_Host, o_Port,
|
||||
o_Path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static const char delimiters[] = "/:@?"; //this order is optimized.
|
||||
char* brk = PL_strpbrk(i_Spec, delimiters);
|
||||
|
||||
if (!brk) // everything is a host
|
||||
{
|
||||
rv = ExtractString((char*)i_Spec, o_Host, len);
|
||||
ToLowerCase(*o_Host);
|
||||
return rv;
|
||||
} else
|
||||
len = PL_strlen(brk);
|
||||
|
||||
switch (*brk)
|
||||
{
|
||||
case '/' :
|
||||
case '?' :
|
||||
// If the URL starts with a slash then everything is a path
|
||||
if (brk == i_Spec)
|
||||
{
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
}
|
||||
else // The first part is host, so its host/path
|
||||
{
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
}
|
||||
break;
|
||||
case ':' :
|
||||
if (len >= 2 && *(brk+1) == '/') {
|
||||
// Standard http://... or malformed http:/...
|
||||
rv = ExtractString((char*)i_Spec, o_Scheme, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Scheme);
|
||||
rv = ParseAtPreHost(brk+1, o_Username, o_Password, o_Host,
|
||||
o_Port, o_Path);
|
||||
return rv;
|
||||
} else {
|
||||
// Could be host:port, so try conversion to number
|
||||
PRInt32 port = ExtractPortFrom(brk+1);
|
||||
if (port > 0)
|
||||
{
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPort(brk+1, o_Port, o_Path);
|
||||
return rv;
|
||||
} else {
|
||||
// No, it's not a number try scheme:host...
|
||||
rv = ExtractString((char*)i_Spec, o_Scheme,
|
||||
(brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Scheme);
|
||||
rv = ParseAtPreHost(brk+1, o_Username, o_Password, o_Host,
|
||||
o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '@' :
|
||||
rv = ParseAtPreHost(i_Spec, o_Username, o_Password, o_Host,
|
||||
o_Port, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "This just can't be!");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParseAtPreHost(const char* i_Spec, char* *o_Username,
|
||||
char* *o_Password, char* *o_Host,
|
||||
PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
// Skip leading two slashes
|
||||
char* fwdPtr= (char*) i_Spec;
|
||||
if (fwdPtr && (*fwdPtr != '\0') && (*fwdPtr == '/'))
|
||||
fwdPtr++;
|
||||
if (fwdPtr && (*fwdPtr != '\0') && (*fwdPtr == '/'))
|
||||
fwdPtr++;
|
||||
|
||||
static const char delimiters[] = "/:@?";
|
||||
char* brk = PL_strpbrk(fwdPtr, delimiters);
|
||||
char* brk2 = nsnull;
|
||||
|
||||
if (!brk)
|
||||
{
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
char* e_PreHost = nsnull;
|
||||
switch (*brk)
|
||||
{
|
||||
case ':' :
|
||||
// this maybe the : of host:port or username:password
|
||||
// look if the next special char is @
|
||||
brk2 = PL_strpbrk(brk+1, delimiters);
|
||||
|
||||
if (!brk2)
|
||||
{
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
switch (*brk2)
|
||||
{
|
||||
case '@' :
|
||||
rv = ExtractString(fwdPtr, &e_PreHost, (brk2 - fwdPtr));
|
||||
if (NS_FAILED(rv)) {
|
||||
CRTFREEIF(e_PreHost);
|
||||
return rv;
|
||||
}
|
||||
rv = ParsePreHost(e_PreHost,o_Username,o_Password);
|
||||
CRTFREEIF(e_PreHost);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = ParseAtHost(brk2+1, o_Host, o_Port, o_Path);
|
||||
break;
|
||||
default:
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
break;
|
||||
case '@' :
|
||||
rv = ExtractString(fwdPtr, &e_PreHost, (brk - fwdPtr));
|
||||
if (NS_FAILED(rv)) {
|
||||
CRTFREEIF(e_PreHost);
|
||||
return rv;
|
||||
}
|
||||
rv = ParsePreHost(e_PreHost,o_Username,o_Password);
|
||||
CRTFREEIF(e_PreHost);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = ParseAtHost(brk+1, o_Host, o_Port, o_Path);
|
||||
break;
|
||||
default:
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParseAtHost(const char* i_Spec, char* *o_Host,
|
||||
PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
int len = PL_strlen(i_Spec);
|
||||
static const char delimiters[] = ":/?"; //this order is optimized.
|
||||
char* brk = PL_strpbrk(i_Spec, delimiters);
|
||||
if (!brk) // everything is a host
|
||||
{
|
||||
rv = ExtractString((char*)i_Spec, o_Host, len);
|
||||
if (PL_strlen(*o_Host)==0) {
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
ToLowerCase(*o_Host);
|
||||
return rv;
|
||||
}
|
||||
|
||||
switch (*brk)
|
||||
{
|
||||
case '/' :
|
||||
case '?' :
|
||||
// Get the Host, the rest is Path
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (PL_strlen(*o_Host)==0) {
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
case ':' :
|
||||
// Get the Host
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (PL_strlen(*o_Host)==0) {
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPort(brk+1, o_Port, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "This just can't be!");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParseAtPort(const char* i_Spec, PRInt32 *o_Port,
|
||||
char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
static const char delimiters[] = "/?"; //this order is optimized.
|
||||
char* brk = PL_strpbrk(i_Spec, delimiters);
|
||||
if (!brk) // everything is a Port
|
||||
{
|
||||
if (PL_strlen(i_Spec)==0) {
|
||||
*o_Port = -1;
|
||||
return NS_OK;
|
||||
} else {
|
||||
*o_Port = ExtractPortFrom(i_Spec);
|
||||
if (*o_Port <= 0)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
char* e_Port = nsnull;
|
||||
switch (*brk)
|
||||
{
|
||||
case '/' :
|
||||
case '?' :
|
||||
// Get the Port, the rest is Path
|
||||
rv = ExtractString((char*)i_Spec, &e_Port, brk-i_Spec);
|
||||
if (NS_FAILED(rv)) {
|
||||
CRTFREEIF(e_Port);
|
||||
return rv;
|
||||
}
|
||||
if (PL_strlen(e_Port)==0) {
|
||||
*o_Port = -1;
|
||||
} else {
|
||||
*o_Port = ExtractPortFrom(e_Port);
|
||||
if (*o_Port <= 0)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
CRTFREEIF(e_Port);
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "This just can't be!");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParseAtPath(const char* i_Spec, char* *o_Path)
|
||||
{
|
||||
// Just write the path and check for a starting /
|
||||
nsCAutoString dir;
|
||||
if ('/' != *i_Spec)
|
||||
dir += "/";
|
||||
|
||||
dir += i_Spec;
|
||||
|
||||
*o_Path = dir.ToNewCString();
|
||||
return (*o_Path ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParseAtDirectory(const char* i_Path, char* *o_Directory,
|
||||
char* *o_FileBaseName, char* *o_FileExtension,
|
||||
char* *o_Param, char* *o_Query, char* *o_Ref)
|
||||
{
|
||||
// Cleanout
|
||||
CRTFREEIF(*o_Directory);
|
||||
CRTFREEIF(*o_FileBaseName);
|
||||
CRTFREEIF(*o_FileExtension);
|
||||
CRTFREEIF(*o_Param);
|
||||
CRTFREEIF(*o_Query);
|
||||
CRTFREEIF(*o_Ref);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Parse the Path into its components
|
||||
if (!i_Path)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
return (o_Directory ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
char* dirfile = nsnull;
|
||||
char* options = nsnull;
|
||||
|
||||
int len = PL_strlen(i_Path);
|
||||
|
||||
/* Factor out the optionpart with ;?# */
|
||||
static const char delimiters[] = ";?#"; // for param, query and ref
|
||||
char* brk = PL_strpbrk(i_Path, delimiters);
|
||||
|
||||
if (!brk) // Everything is just path and filename
|
||||
{
|
||||
DupString(&dirfile, i_Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
int dirfileLen = brk - i_Path;
|
||||
ExtractString((char*)i_Path, &dirfile, dirfileLen);
|
||||
len -= dirfileLen;
|
||||
ExtractString((char*)i_Path + dirfileLen, &options, len);
|
||||
brk = options;
|
||||
}
|
||||
|
||||
/* now that we have broken up the path treat every part differently */
|
||||
/* first dir+file */
|
||||
|
||||
char* file;
|
||||
|
||||
int dlen = PL_strlen(dirfile);
|
||||
if (dlen == 0)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
file = dirfile;
|
||||
} else {
|
||||
CoaleseDirs(dirfile);
|
||||
// Get length again
|
||||
dlen = PL_strlen(dirfile);
|
||||
|
||||
// First find the last slash
|
||||
file = PL_strrchr(dirfile, '/');
|
||||
if (!file)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
file = dirfile;
|
||||
}
|
||||
|
||||
// If its not the same as the first slash then extract directory
|
||||
if (file != dirfile)
|
||||
{
|
||||
ExtractString(dirfile, o_Directory, (file - dirfile)+1);
|
||||
} else {
|
||||
DupString(o_Directory, "/");
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract FileBaseName and FileExtension */
|
||||
if (dlen > 0) {
|
||||
// Look again if there was a slash
|
||||
char* slash = PL_strrchr(dirfile, '/');
|
||||
char* e_FileName = nsnull;
|
||||
if (slash) {
|
||||
if (dirfile+dlen-1>slash)
|
||||
ExtractString(slash+1, &e_FileName, dlen-(slash-dirfile+1));
|
||||
} else {
|
||||
// Use the full String as Filename
|
||||
ExtractString(dirfile, &e_FileName, dlen);
|
||||
}
|
||||
|
||||
rv = ParseFileName(e_FileName,o_FileBaseName,o_FileExtension);
|
||||
|
||||
CRTFREEIF(e_FileName);
|
||||
}
|
||||
|
||||
// Now take a look at the options. "#" has precedence over "?"
|
||||
// which has precedence over ";"
|
||||
if (options) {
|
||||
// Look for "#" first. Everything following it is in the ref
|
||||
brk = PL_strchr(options, '#');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Ref, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
|
||||
// Now look for "?"
|
||||
brk = PL_strchr(options, '?');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Query, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
|
||||
// Now look for ';'
|
||||
brk = PL_strchr(options, ';');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Param, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
nsCRT::free(dirfile);
|
||||
nsCRT::free(options);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParsePreHost(const char* i_PreHost, char* *o_Username,
|
||||
char* *o_Password)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!i_PreHost) {
|
||||
*o_Username = nsnull;
|
||||
*o_Password = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Search for :
|
||||
static const char delimiters[] = ":";
|
||||
char* brk = PL_strpbrk(i_PreHost, delimiters);
|
||||
if (brk)
|
||||
{
|
||||
rv = ExtractString((char*)i_PreHost, o_Username, (brk - i_PreHost));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = ExtractString(brk+1, o_Password,
|
||||
(i_PreHost+PL_strlen(i_PreHost) - brk - 1));
|
||||
} else {
|
||||
CRTFREEIF(*o_Password);
|
||||
rv = DupString(o_Username, i_PreHost);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAuthURLParser::ParseFileName(const char* i_FileName, char* *o_FileBaseName,
|
||||
char* *o_FileExtension)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!i_FileName) {
|
||||
*o_FileBaseName = nsnull;
|
||||
*o_FileExtension = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Search for FileExtension
|
||||
// Search for last .
|
||||
// Ignore . at the beginning
|
||||
char* brk = PL_strrchr(i_FileName+1, '.');
|
||||
if (brk)
|
||||
{
|
||||
rv = ExtractString((char*)i_FileName, o_FileBaseName,
|
||||
(brk - i_FileName));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = ExtractString(brk + 1, o_FileExtension,
|
||||
(i_FileName+PL_strlen(i_FileName) - brk - 1));
|
||||
} else {
|
||||
rv = DupString(o_FileBaseName, i_FileName);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
51
mozilla/netwerk/base/src/nsAuthURLParser.h
Normal file
51
mozilla/netwerk/base/src/nsAuthURLParser.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsAuthURLParser_h__
|
||||
#define nsAuthURLParser_h__
|
||||
|
||||
#include "nsIURLParser.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsAgg.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
class nsAuthURLParser : public nsIURLParser
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsAuthURLParser methods:
|
||||
nsAuthURLParser() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
virtual ~nsAuthURLParser();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsIURLParser methods:
|
||||
NS_DECL_NSIURLPARSER
|
||||
|
||||
};
|
||||
|
||||
#endif // nsAuthURLParser_h__
|
||||
318
mozilla/netwerk/base/src/nsBufferedStreams.cpp
Normal file
318
mozilla/netwerk/base/src/nsBufferedStreams.cpp
Normal file
@@ -0,0 +1,318 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsBufferedStreams.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBufferedStream
|
||||
|
||||
nsBufferedStream::nsBufferedStream()
|
||||
: mBuffer(nsnull),
|
||||
mBufferStartOffset(0),
|
||||
mCursor(0),
|
||||
mFillPoint(0),
|
||||
mStream(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsBufferedStream::~nsBufferedStream()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsBufferedStream,
|
||||
nsIBaseStream,
|
||||
nsISeekableStream);
|
||||
|
||||
nsresult
|
||||
nsBufferedStream::Init(nsIBaseStream* stream, PRUint32 bufferSize)
|
||||
{
|
||||
NS_ASSERTION(stream, "need to supply a stream");
|
||||
NS_ASSERTION(mStream == nsnull, "already inited");
|
||||
mStream = stream;
|
||||
NS_ADDREF(mStream);
|
||||
mBufferSize = bufferSize;
|
||||
mBufferStartOffset = 0;
|
||||
mCursor = 0;
|
||||
mBuffer = new char[bufferSize];
|
||||
if (mBuffer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedStream::Close()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mStream) {
|
||||
rv = mStream->Close();
|
||||
NS_RELEASE(mStream);
|
||||
mStream = nsnull;
|
||||
delete[] mBuffer;
|
||||
mBuffer = nsnull;
|
||||
mBufferSize = 0;
|
||||
mBufferStartOffset = 0;
|
||||
mCursor = 0;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedStream::Seek(PRInt32 whence, PRInt32 offset)
|
||||
{
|
||||
if (mStream == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
// If the underlying stream isn't a random access store, then fail early.
|
||||
// We could possibly succeed for the case where the seek position denotes
|
||||
// something that happens to be read into the buffer, but that would make
|
||||
// the failure data-dependent.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISeekableStream> ras = do_QueryInterface(mStream, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 absPos;
|
||||
switch (whence) {
|
||||
case nsISeekableStream::NS_SEEK_SET:
|
||||
absPos = offset;
|
||||
break;
|
||||
case nsISeekableStream::NS_SEEK_CUR:
|
||||
absPos = mBufferStartOffset + mCursor + offset;
|
||||
break;
|
||||
case nsISeekableStream::NS_SEEK_END:
|
||||
absPos = -1;
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("bogus seek whence parameter");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if ((PRInt32)mBufferStartOffset <= absPos
|
||||
&& absPos < (PRInt32)(mBufferStartOffset + mFillPoint)) {
|
||||
mCursor = absPos - mBufferStartOffset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = Flush();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = ras->Seek(whence, offset);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (absPos == -1) {
|
||||
// then we had the SEEK_END case, above
|
||||
rv = ras->Tell(&mBufferStartOffset);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
else {
|
||||
mBufferStartOffset = absPos;
|
||||
}
|
||||
mCursor = 0;
|
||||
mFillPoint = 0;
|
||||
return Fill();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedStream::Tell(PRUint32 *result)
|
||||
{
|
||||
if (mStream == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
*result = mBufferStartOffset + mCursor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBufferedInputStream
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsBufferedInputStream,
|
||||
nsBufferedStream,
|
||||
nsIInputStream,
|
||||
nsIBufferedInputStream);
|
||||
|
||||
NS_METHOD
|
||||
nsBufferedInputStream::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsBufferedInputStream* stream = new nsBufferedInputStream();
|
||||
if (stream == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(stream);
|
||||
nsresult rv = stream->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(stream);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedInputStream::Init(nsIInputStream* stream, PRUint32 bufferSize)
|
||||
{
|
||||
return nsBufferedStream::Init(stream, bufferSize);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedInputStream::Close()
|
||||
{
|
||||
return nsBufferedStream::Close();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedInputStream::Available(PRUint32 *result)
|
||||
{
|
||||
*result = mFillPoint - mCursor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedInputStream::Read(char * buf, PRUint32 count, PRUint32 *result)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 read = 0;
|
||||
while (count > 0) {
|
||||
PRUint32 amt = PR_MIN(count, mFillPoint - mCursor);
|
||||
if (amt > 0) {
|
||||
nsCRT::memcpy(buf, mBuffer + mCursor, amt);
|
||||
read += amt;
|
||||
count -= amt;
|
||||
mCursor += amt;
|
||||
}
|
||||
else {
|
||||
rv = Fill();
|
||||
if (NS_FAILED(rv)) break;
|
||||
}
|
||||
}
|
||||
*result = read;
|
||||
return (read > 0 || rv == NS_BASE_STREAM_CLOSED) ? NS_OK : rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedInputStream::Fill()
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 rem = mFillPoint - mCursor;
|
||||
if (rem > 0) {
|
||||
// slide the remainder down to the start of the buffer
|
||||
// |<------------->|<--rem-->|<--->|
|
||||
// b c f s
|
||||
nsCRT::memcpy(mBuffer, mBuffer + mCursor, rem);
|
||||
}
|
||||
mBufferStartOffset += mCursor;
|
||||
mFillPoint = rem;
|
||||
mCursor = 0;
|
||||
|
||||
PRUint32 amt;
|
||||
rv = Source()->Read(mBuffer + mFillPoint, mBufferSize - mFillPoint, &amt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mFillPoint += amt;
|
||||
return amt > 0 ? NS_OK : NS_BASE_STREAM_CLOSED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBufferedOutputStream
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsBufferedOutputStream,
|
||||
nsBufferedStream,
|
||||
nsIOutputStream,
|
||||
nsIBufferedOutputStream);
|
||||
|
||||
NS_METHOD
|
||||
nsBufferedOutputStream::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsBufferedOutputStream* stream = new nsBufferedOutputStream();
|
||||
if (stream == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(stream);
|
||||
nsresult rv = stream->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(stream);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedOutputStream::Init(nsIOutputStream* stream, PRUint32 bufferSize)
|
||||
{
|
||||
mFillPoint = bufferSize; // always fill to the end for buffered output streams
|
||||
return nsBufferedStream::Init(stream, bufferSize);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedOutputStream::Close()
|
||||
{
|
||||
nsresult rv1, rv2;
|
||||
rv1 = Flush();
|
||||
// If we fail to Flush all the data, then we close anyway and drop the
|
||||
// remaining data in the buffer. We do this because it's what Unix does
|
||||
// for fclose and close. However, we report the error from Flush anyway.
|
||||
rv2 = nsBufferedStream::Close();
|
||||
if (NS_FAILED(rv1)) return rv1;
|
||||
return rv2;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedOutputStream::Write(const char *buf, PRUint32 count, PRUint32 *result)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 written = 0;
|
||||
while (count > 0) {
|
||||
PRUint32 amt = PR_MIN(count, mFillPoint - mCursor);
|
||||
if (amt > 0) {
|
||||
nsCRT::memcpy(mBuffer + mCursor, buf + written, amt);
|
||||
written += amt;
|
||||
count -= amt;
|
||||
mCursor += amt;
|
||||
}
|
||||
else {
|
||||
rv = Flush();
|
||||
if (NS_FAILED(rv)) break;
|
||||
}
|
||||
}
|
||||
*result = written;
|
||||
return (written > 0) ? NS_OK : rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedOutputStream::Flush(void)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 amt;
|
||||
rv = Sink()->Write(mBuffer, mCursor, &amt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mBufferStartOffset += amt;
|
||||
if (mCursor == amt) {
|
||||
mCursor = 0;
|
||||
return NS_OK; // flushed everything
|
||||
}
|
||||
|
||||
// slide the remainder down to the start of the buffer
|
||||
// |<-------------->|<---|----->|
|
||||
// b a c s
|
||||
PRUint32 rem = mCursor - amt;
|
||||
nsCRT::memcpy(mBuffer, mBuffer + amt, rem);
|
||||
mCursor = rem;
|
||||
return NS_ERROR_FAILURE; // didn't flush all
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
117
mozilla/netwerk/base/src/nsBufferedStreams.h
Normal file
117
mozilla/netwerk/base/src/nsBufferedStreams.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsBufferedStreams_h__
|
||||
#define nsBufferedStreams_h__
|
||||
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsBufferedStream : public nsIBaseStream,
|
||||
public nsISeekableStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIBASESTREAM
|
||||
NS_DECL_NSISEEKABLESTREAM
|
||||
|
||||
nsBufferedStream();
|
||||
virtual ~nsBufferedStream();
|
||||
|
||||
protected:
|
||||
nsresult Init(nsIBaseStream* stream, PRUint32 bufferSize);
|
||||
NS_IMETHOD Fill() = 0;
|
||||
NS_IMETHOD Flush() = 0;
|
||||
|
||||
protected:
|
||||
PRUint32 mBufferSize;
|
||||
char* mBuffer;
|
||||
// mBufferStartOffset is the offset relative to the start of mStream:
|
||||
PRUint32 mBufferStartOffset;
|
||||
// mCursor is the read cursor for input streams, or write cursor for
|
||||
// output streams, and is relative to mBufferStartOffset:
|
||||
PRUint32 mCursor;
|
||||
// mFillPoint is the amount available in the buffer for input streams,
|
||||
// or the end of the buffer for output streams, and is relative to
|
||||
// mBufferStartOffset:
|
||||
PRUint32 mFillPoint;
|
||||
nsIBaseStream* mStream; // cast to appropriate subclass
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsBufferedInputStream : public nsBufferedStream,
|
||||
public nsIBufferedInputStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIBASESTREAM
|
||||
NS_DECL_NSIINPUTSTREAM
|
||||
NS_DECL_NSIBUFFEREDINPUTSTREAM
|
||||
|
||||
nsBufferedInputStream() : nsBufferedStream() {}
|
||||
virtual ~nsBufferedInputStream() {}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsIInputStream* Source() {
|
||||
return (nsIInputStream*)mStream;
|
||||
}
|
||||
|
||||
protected:
|
||||
NS_IMETHOD Fill();
|
||||
NS_IMETHOD Flush() { return NS_OK; } // no-op for input streams
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsBufferedOutputStream : public nsBufferedStream,
|
||||
public nsIBufferedOutputStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIBASESTREAM
|
||||
NS_DECL_NSIOUTPUTSTREAM
|
||||
NS_DECL_NSIBUFFEREDOUTPUTSTREAM
|
||||
|
||||
nsBufferedOutputStream() : nsBufferedStream() {}
|
||||
virtual ~nsBufferedOutputStream() {}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsIOutputStream* Sink() {
|
||||
return (nsIOutputStream*)mStream;
|
||||
}
|
||||
|
||||
protected:
|
||||
NS_IMETHOD Fill() { return NS_OK; } // no-op for output streams
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // nsBufferedStreams_h__
|
||||
272
mozilla/netwerk/base/src/nsDirectoryIndexStream.cpp
Normal file
272
mozilla/netwerk/base/src/nsDirectoryIndexStream.cpp
Normal file
@@ -0,0 +1,272 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
The converts a filesystem directory into an "HTTP index" stream per
|
||||
Lou Montulli's original spec:
|
||||
|
||||
http://www.area.com/~roeber/file_format.html
|
||||
|
||||
*/
|
||||
|
||||
#include "nsEscape.h"
|
||||
#include "nsDirectoryIndexStream.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "prio.h"
|
||||
#include "prlog.h"
|
||||
#include "prlong.h"
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gLog;
|
||||
#endif
|
||||
|
||||
nsDirectoryIndexStream::nsDirectoryIndexStream()
|
||||
: mOffset(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (! gLog)
|
||||
gLog = PR_NewLogModule("nsDirectoryIndexStream");
|
||||
#endif
|
||||
|
||||
PR_LOG(gLog, PR_LOG_DEBUG,
|
||||
("nsDirectoryIndexStream[%p]: created", this));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDirectoryIndexStream::Init(nsIFile* aDir)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool isDir;
|
||||
rv = aDir->IsDirectory(&isDir);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_PRECONDITION(isDir, "not a directory");
|
||||
if (!isDir)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
|
||||
nsXPIDLCString path;
|
||||
aDir->GetPath(getter_Copies(path));
|
||||
PR_LOG(gLog, PR_LOG_DEBUG,
|
||||
("nsDirectoryIndexStream[%p]: initialized on %s",
|
||||
this, (const char*) path));
|
||||
}
|
||||
#endif
|
||||
|
||||
mDir = aDir;
|
||||
|
||||
// Sigh. We have to allocate on the heap because there are no
|
||||
// assignment operators defined.
|
||||
rv = mDir->GetDirectoryEntries(getter_AddRefs(mIter));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mBuf = "200: filename content-length last-modified file-type\n";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDirectoryIndexStream::~nsDirectoryIndexStream()
|
||||
{
|
||||
PR_LOG(gLog, PR_LOG_DEBUG,
|
||||
("nsDirectoryIndexStream[%p]: destroyed", this));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDirectoryIndexStream::Create(nsIFile* aDir, nsIInputStream** aResult)
|
||||
{
|
||||
nsDirectoryIndexStream* result = new nsDirectoryIndexStream();
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv;
|
||||
rv = result->Init(aDir);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aResult = result;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsDirectoryIndexStream,
|
||||
nsIInputStream,
|
||||
nsIBaseStream)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryIndexStream::Close()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryIndexStream::Available(PRUint32* aLength)
|
||||
{
|
||||
// Lie, and tell the caller that the stream is endless (until we
|
||||
// actually don't have anything left).
|
||||
PRBool more;
|
||||
nsresult rv = mIter->HasMoreElements(&more);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (more) {
|
||||
*aLength = PRUint32(-1);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
*aLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirectoryIndexStream::Read(char* aBuf, PRUint32 aCount, PRUint32* aReadCount)
|
||||
{
|
||||
PRUint32 nread = 0;
|
||||
|
||||
// If anything is enqueued (or left-over) in mBuf, then feed it to
|
||||
// the reader first.
|
||||
while (mOffset < mBuf.Length() && aCount != 0) {
|
||||
*(aBuf++) = char(mBuf.CharAt(mOffset++));
|
||||
--aCount;
|
||||
++nread;
|
||||
}
|
||||
|
||||
// Room left?
|
||||
if (aCount > 0) {
|
||||
mOffset = 0;
|
||||
mBuf.Truncate();
|
||||
|
||||
// Okay, now we'll suck stuff off of our iterator into the mBuf...
|
||||
while (PRUint32(mBuf.Length()) < aCount) {
|
||||
PRBool more;
|
||||
nsresult rv = mIter->HasMoreElements(&more);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!more) break;
|
||||
|
||||
nsCOMPtr<nsISupports> cur;
|
||||
rv = mIter->GetNext(getter_AddRefs(cur));
|
||||
nsCOMPtr<nsIFile> current = do_QueryInterface(cur, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
|
||||
nsXPIDLCString path;
|
||||
current->GetPath(getter_Copies(path));
|
||||
PR_LOG(gLog, PR_LOG_DEBUG,
|
||||
("nsDirectoryIndexStream[%p]: iterated %s",
|
||||
this, (const char*) path));
|
||||
}
|
||||
#endif
|
||||
|
||||
// rjc: don't return hidden files/directories!
|
||||
PRBool hidden;
|
||||
rv = current->IsHidden(&hidden);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (hidden) {
|
||||
PR_LOG(gLog, PR_LOG_DEBUG,
|
||||
("nsDirectoryIndexStream[%p]: skipping hidden file/directory",
|
||||
this));
|
||||
continue;
|
||||
}
|
||||
|
||||
PRInt64 fileSize;
|
||||
PRInt64 fileInfoModifyTime;
|
||||
rv = current->GetFileSize( &fileSize );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PROffset32 fileInfoSize;
|
||||
LL_L2I( fileInfoSize,fileSize );
|
||||
|
||||
rv = current->GetLastModificationDate( &fileInfoModifyTime );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mBuf += "201: ";
|
||||
|
||||
// The "filename" field
|
||||
{
|
||||
char* leafname;
|
||||
rv = current->GetLeafName(&leafname);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (leafname) {
|
||||
char* escaped = nsEscape(leafname, url_Path);
|
||||
if (escaped) {
|
||||
mBuf += escaped;
|
||||
mBuf.Append(' ');
|
||||
nsCRT::free(escaped);
|
||||
}
|
||||
nsCRT::free(leafname);
|
||||
}
|
||||
}
|
||||
|
||||
// The "content-length" field
|
||||
mBuf.AppendWithConversion(fileInfoSize, 10);
|
||||
mBuf.Append(' ');
|
||||
|
||||
// The "last-modified" field
|
||||
PRExplodedTime tm;
|
||||
PR_ExplodeTime(fileInfoModifyTime, PR_GMTParameters, &tm);
|
||||
{
|
||||
char buf[64];
|
||||
PR_FormatTimeUSEnglish(buf, sizeof(buf), "%a,%%20%d%%20%b%%20%Y%%20%H:%M:%S%%20GMT ", &tm);
|
||||
mBuf.Append(buf);
|
||||
}
|
||||
|
||||
// The "file-type" field
|
||||
PRBool isFile;
|
||||
rv = current->IsFile(&isFile);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (isFile) {
|
||||
mBuf += "FILE ";
|
||||
}
|
||||
else {
|
||||
PRBool isDir;
|
||||
rv = current->IsDirectory(&isDir);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (isDir) {
|
||||
mBuf += "DIRECTORY ";
|
||||
}
|
||||
else {
|
||||
PRBool isLink;
|
||||
rv = current->IsSymlink(&isLink);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (isLink) {
|
||||
mBuf += "SYMBOLIC-LINK ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mBuf.Append('\n');
|
||||
}
|
||||
|
||||
// ...and once we've either run out of directory entries, or
|
||||
// filled up the buffer, then we'll push it to the reader.
|
||||
while (mOffset < mBuf.Length() && aCount != 0) {
|
||||
*(aBuf++) = char(mBuf.CharAt(mOffset++));
|
||||
--aCount;
|
||||
++nread;
|
||||
}
|
||||
}
|
||||
|
||||
*aReadCount = nread;
|
||||
return NS_OK;
|
||||
}
|
||||
59
mozilla/netwerk/base/src/nsDirectoryIndexStream.h
Normal file
59
mozilla/netwerk/base/src/nsDirectoryIndexStream.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsDirectoryIndexStream_h__
|
||||
#define nsDirectoryIndexStream_h__
|
||||
|
||||
#include "nsIFile.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsDirectoryIndexStream : public nsIInputStream
|
||||
{
|
||||
protected:
|
||||
nsCAutoString mBuf;
|
||||
PRInt32 mOffset;
|
||||
|
||||
nsCOMPtr<nsIFile> mDir;
|
||||
nsCOMPtr<nsISimpleEnumerator> mIter;
|
||||
|
||||
nsDirectoryIndexStream();
|
||||
nsresult Init(nsIFile* aDir);
|
||||
virtual ~nsDirectoryIndexStream();
|
||||
|
||||
public:
|
||||
static nsresult
|
||||
Create(nsIFile* aDir, nsIInputStream** aStreamResult);
|
||||
|
||||
// nsISupportsInterface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIBaseStream interface
|
||||
NS_DECL_NSIBASESTREAM
|
||||
|
||||
// nsIInputStream interface
|
||||
NS_DECL_NSIINPUTSTREAM
|
||||
};
|
||||
|
||||
#endif // nsDirectoryIndexStream_h__
|
||||
|
||||
225
mozilla/netwerk/base/src/nsFileStreams.cpp
Normal file
225
mozilla/netwerk/base/src/nsFileStreams.cpp
Normal file
@@ -0,0 +1,225 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsFileStreams.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "prerror.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFileStream
|
||||
|
||||
nsFileStream::nsFileStream()
|
||||
: mFD(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsFileStream::~nsFileStream()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsFileStream,
|
||||
nsIBaseStream,
|
||||
nsISeekableStream);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileStream::Close()
|
||||
{
|
||||
if (mFD) {
|
||||
PR_Close(mFD);
|
||||
mFD = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileStream::Seek(PRInt32 whence, PRInt32 offset)
|
||||
{
|
||||
if (mFD == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRInt32 cnt = PR_Seek(mFD, offset, (PRSeekWhence)whence);
|
||||
if (cnt == -1) {
|
||||
return NS_ErrorAccordingToNSPR();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileStream::Tell(PRUint32 *result)
|
||||
{
|
||||
if (mFD == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRInt32 cnt = PR_Seek(mFD, 0, PR_SEEK_CUR);
|
||||
if (cnt == -1) {
|
||||
return NS_ErrorAccordingToNSPR();
|
||||
}
|
||||
*result = cnt;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFileInputStream
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsFileInputStream,
|
||||
nsFileStream,
|
||||
nsIInputStream,
|
||||
nsIFileInputStream);
|
||||
|
||||
NS_METHOD
|
||||
nsFileInputStream::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsFileInputStream* stream = new nsFileInputStream();
|
||||
if (stream == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(stream);
|
||||
nsresult rv = stream->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(stream);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileInputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm)
|
||||
{
|
||||
NS_ASSERTION(mFD == nsnull, "already inited");
|
||||
if (mFD != nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (ioFlags == -1)
|
||||
ioFlags = PR_RDONLY;
|
||||
if (perm == -1)
|
||||
perm = 0;
|
||||
return localFile->OpenNSPRFileDesc(ioFlags, perm, &mFD);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileInputStream::Close()
|
||||
{
|
||||
return nsFileStream::Close();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileInputStream::Available(PRUint32 *result)
|
||||
{
|
||||
if (mFD == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRInt32 avail = PR_Available(mFD);
|
||||
if (avail == -1) {
|
||||
return NS_ErrorAccordingToNSPR();
|
||||
}
|
||||
*result = avail;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileInputStream::Read(char * buf, PRUint32 count, PRUint32 *result)
|
||||
{
|
||||
if (mFD == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRInt32 cnt = PR_Read(mFD, buf, count);
|
||||
if (cnt == -1) {
|
||||
return NS_ErrorAccordingToNSPR();
|
||||
}
|
||||
*result = cnt;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFileOutputStream
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsFileOutputStream,
|
||||
nsFileStream,
|
||||
nsIOutputStream,
|
||||
nsIFileOutputStream);
|
||||
|
||||
NS_METHOD
|
||||
nsFileOutputStream::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
nsFileOutputStream* stream = new nsFileOutputStream();
|
||||
if (stream == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(stream);
|
||||
nsresult rv = stream->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(stream);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileOutputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm)
|
||||
{
|
||||
NS_ASSERTION(mFD == nsnull, "already inited");
|
||||
if (mFD != nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (ioFlags == -1)
|
||||
ioFlags = PR_WRONLY | PR_CREATE_FILE;
|
||||
if (perm == -1)
|
||||
perm = 0664;
|
||||
return localFile->OpenNSPRFileDesc(ioFlags, perm, &mFD);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileOutputStream::Close()
|
||||
{
|
||||
return nsFileStream::Close();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileOutputStream::Write(const char *buf, PRUint32 count, PRUint32 *result)
|
||||
{
|
||||
if (mFD == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRInt32 cnt = PR_Write(mFD, buf, count);
|
||||
if (cnt == -1) {
|
||||
return NS_ErrorAccordingToNSPR();
|
||||
}
|
||||
*result = cnt;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileOutputStream::Flush(void)
|
||||
{
|
||||
if (mFD == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRInt32 cnt = PR_Sync(mFD);
|
||||
if (cnt == -1) {
|
||||
return NS_ErrorAccordingToNSPR();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
87
mozilla/netwerk/base/src/nsFileStreams.h
Normal file
87
mozilla/netwerk/base/src/nsFileStreams.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsFileStreams_h__
|
||||
#define nsFileStreams_h__
|
||||
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsFileStream : public nsIBaseStream,
|
||||
public nsISeekableStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIBASESTREAM
|
||||
NS_DECL_NSISEEKABLESTREAM
|
||||
|
||||
nsFileStream();
|
||||
virtual ~nsFileStream();
|
||||
|
||||
protected:
|
||||
PRFileDesc* mFD;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsFileInputStream : public nsFileStream,
|
||||
public nsIFileInputStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIBASESTREAM
|
||||
NS_DECL_NSIINPUTSTREAM
|
||||
NS_DECL_NSIFILEINPUTSTREAM
|
||||
|
||||
nsFileInputStream() : nsFileStream() {}
|
||||
virtual ~nsFileInputStream() {}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsFileOutputStream : public nsFileStream,
|
||||
public nsIFileOutputStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIBASESTREAM
|
||||
NS_DECL_NSIOUTPUTSTREAM
|
||||
NS_DECL_NSIFILEOUTPUTSTREAM
|
||||
|
||||
nsFileOutputStream() : nsFileStream() {}
|
||||
virtual ~nsFileOutputStream() {}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // nsFileStreams_h__
|
||||
1374
mozilla/netwerk/base/src/nsFileTransport.cpp
Normal file
1374
mozilla/netwerk/base/src/nsFileTransport.cpp
Normal file
File diff suppressed because it is too large
Load Diff
139
mozilla/netwerk/base/src/nsFileTransport.h
Normal file
139
mozilla/netwerk/base/src/nsFileTransport.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsFileTransport_h__
|
||||
#define nsFileTransport_h__
|
||||
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "prlock.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIPipe.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsIFileSystem.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIFile.h"
|
||||
#include "prlog.h"
|
||||
|
||||
class nsIInterfaceRequestor;
|
||||
|
||||
class nsFileTransport : public nsIChannel,
|
||||
public nsIRunnable,
|
||||
public nsIPipeObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIPIPEOBSERVER
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
nsFileTransport();
|
||||
// Always make the destructor virtual:
|
||||
virtual ~nsFileTransport();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
|
||||
nsresult Init(nsIFile* file,
|
||||
PRInt32 ioFlags,
|
||||
PRInt32 perm);
|
||||
nsresult Init(nsIInputStream* fromStream,
|
||||
const char* contentType,
|
||||
PRInt32 contentLength);
|
||||
nsresult Init(nsIFileSystem* fsObj);
|
||||
|
||||
void Process(void);
|
||||
void DoClose(void);
|
||||
|
||||
enum State {
|
||||
CLOSED,
|
||||
OPENING,
|
||||
OPENED,
|
||||
START_READ,
|
||||
READING,
|
||||
END_READ,
|
||||
START_WRITE,
|
||||
WRITING,
|
||||
END_WRITE,
|
||||
CLOSING
|
||||
};
|
||||
|
||||
enum Command {
|
||||
NONE,
|
||||
INITIATE_READ,
|
||||
INITIATE_WRITE
|
||||
};
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIFile> mFile;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsIProgressEventSink> mProgress;
|
||||
nsCOMPtr<nsIFileSystem> mFileObject;
|
||||
char* mContentType;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
PRInt32 mIOFlags;
|
||||
PRInt32 mPerm;
|
||||
|
||||
nsCOMPtr<nsIStreamObserver> mOpenObserver;
|
||||
nsCOMPtr<nsISupports> mOpenContext;
|
||||
|
||||
nsCOMPtr<nsISupports> mContext;
|
||||
State mState;
|
||||
Command mCommand;
|
||||
PRBool mSuspended;
|
||||
PRMonitor* mMonitor;
|
||||
|
||||
// state variables:
|
||||
nsresult mStatus;
|
||||
PRUint32 mOffset;
|
||||
PRInt32 mTotalAmount;
|
||||
PRInt32 mTransferAmount;
|
||||
|
||||
// reading state varialbles:
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
nsCOMPtr<nsIInputStream> mSource;
|
||||
nsCOMPtr<nsIBufferInputStream> mBufferInputStream;
|
||||
nsCOMPtr<nsIBufferOutputStream> mBufferOutputStream;
|
||||
|
||||
// writing state variables:
|
||||
nsCOMPtr<nsIStreamObserver> mObserver;
|
||||
nsCOMPtr<nsIOutputStream> mSink;
|
||||
char* mBuffer;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
char* mSpec;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NS_FILE_TRANSPORT_DEFAULT_SEGMENT_SIZE (2*1024)
|
||||
#define NS_FILE_TRANSPORT_DEFAULT_BUFFER_SIZE (8*1024)
|
||||
|
||||
#endif // nsFileTransport_h__
|
||||
191
mozilla/netwerk/base/src/nsFileTransportService.cpp
Normal file
191
mozilla/netwerk/base/src/nsFileTransportService.cpp
Normal file
@@ -0,0 +1,191 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsFileTransport.h"
|
||||
#include "nsFileTransportService.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIThreadPool.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsAutoLock.h"
|
||||
|
||||
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFileTransportService::nsFileTransportService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
#define NS_FILE_TRANSPORT_WORKER_STACK_SIZE (64 * 1024) /* (8*1024) */
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = NS_NewThreadPool(getter_AddRefs(mPool),
|
||||
NS_FILE_TRANSPORT_WORKER_COUNT_MIN,
|
||||
NS_FILE_TRANSPORT_WORKER_COUNT_MAX,
|
||||
NS_FILE_TRANSPORT_WORKER_STACK_SIZE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsFileTransportService::~nsFileTransportService()
|
||||
{
|
||||
mPool->Shutdown();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsFileTransportService, nsFileTransportService);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransportService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsFileTransportService* ph = new nsFileTransportService();
|
||||
if (ph == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(ph);
|
||||
nsresult rv = ph->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = ph->QueryInterface(aIID, aResult);
|
||||
}
|
||||
NS_RELEASE(ph);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransportService::CreateTransport(nsIFile* file,
|
||||
PRInt32 ioFlags,
|
||||
PRInt32 perm,
|
||||
nsIChannel** result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsFileTransport* trans = new nsFileTransport();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(trans);
|
||||
rv = trans->Init(file, ioFlags, perm);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(trans);
|
||||
return rv;
|
||||
}
|
||||
*result = trans;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransportService::CreateTransportFromStream(nsIInputStream *fromStream,
|
||||
const char* contentType,
|
||||
PRInt32 contentLength,
|
||||
nsIChannel** result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsFileTransport* trans = new nsFileTransport();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(trans);
|
||||
rv = trans->Init(fromStream, contentType, contentLength);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(trans);
|
||||
return rv;
|
||||
}
|
||||
*result = trans;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransportService::CreateTransportFromFileSystem(nsIFileSystem *fsObj,
|
||||
nsIChannel **result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsFileTransport* trans = new nsFileTransport();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(trans);
|
||||
rv = trans->Init(fsObj);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(trans);
|
||||
return rv;
|
||||
}
|
||||
*result = trans;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::ProcessPendingRequests(void)
|
||||
{
|
||||
return mPool->ProcessPendingRequests();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::Shutdown(void)
|
||||
{
|
||||
return mPool->Shutdown();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::DispatchRequest(nsIRunnable* runnable)
|
||||
{
|
||||
return mPool->DispatchRequest(runnable);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::Suspend(nsIRunnable* request)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoCMonitor mon(this); // protect mSuspended
|
||||
if (mSuspended == nsnull) {
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mSuspended));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mSuspended->AppendElement(request) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::Resume(nsIRunnable* request)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoCMonitor mon(this); // protect mSuspended
|
||||
if (mSuspended == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
// XXX RemoveElement returns a bool instead of nsresult!
|
||||
PRBool removed = mSuspended->RemoveElement(request);
|
||||
rv = removed ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// restart the request
|
||||
rv = mPool->DispatchRequest(request);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
54
mozilla/netwerk/base/src/nsFileTransportService.h
Normal file
54
mozilla/netwerk/base/src/nsFileTransportService.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsFileTransportService_h___
|
||||
#define nsFileTransportService_h___
|
||||
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsIThreadPool.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
#define NS_FILE_TRANSPORT_WORKER_COUNT_MIN 1
|
||||
#define NS_FILE_TRANSPORT_WORKER_COUNT_MAX 16
|
||||
|
||||
class nsFileTransportService : public nsIFileTransportService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIFILETRANSPORTSERVICE
|
||||
|
||||
// nsFileTransportService methods:
|
||||
nsFileTransportService();
|
||||
virtual ~nsFileTransportService();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIThreadPool> mPool;
|
||||
nsCOMPtr<nsISupportsArray> mOpened;
|
||||
nsCOMPtr<nsISupportsArray> mSuspended;
|
||||
};
|
||||
|
||||
#endif /* nsFileTransportService_h___ */
|
||||
400
mozilla/netwerk/base/src/nsIOService.cpp
Normal file
400
mozilla/netwerk/base/src/nsIOService.cpp
Normal file
@@ -0,0 +1,400 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIOService.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "prprf.h"
|
||||
#include "nsLoadGroup.h"
|
||||
#include "nsInputStreamChannel.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
static NS_DEFINE_CID(kFileTransportService, NS_FILETRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsIOService::nsIOService()
|
||||
: mOffline(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsIOService::Init()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
// We need to get references to these services so that we can shut them
|
||||
// down later. If we wait until the nsIOService is being shut down,
|
||||
// GetService will fail at that point.
|
||||
rv = nsServiceManager::GetService(kSocketTransportServiceCID,
|
||||
NS_GET_IID(nsISocketTransportService),
|
||||
getter_AddRefs(mSocketTransportService));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsServiceManager::GetService(kFileTransportService,
|
||||
NS_GET_IID(nsIFileTransportService),
|
||||
getter_AddRefs(mFileTransportService));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsServiceManager::GetService(kDNSServiceCID,
|
||||
NS_GET_IID(nsIDNSService),
|
||||
getter_AddRefs(mDNSService));
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIOService::~nsIOService()
|
||||
{
|
||||
(void)SetOffline(PR_TRUE);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsIOService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsIOService* _ios = new nsIOService();
|
||||
if (_ios == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(_ios);
|
||||
rv = _ios->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete _ios;
|
||||
return rv;
|
||||
}
|
||||
rv = _ios->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(_ios);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsIOService, nsIIOService);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define MAX_SCHEME_LENGTH 64 // XXX big enough?
|
||||
|
||||
#define MAX_NET_PROGID_LENGTH (MAX_SCHEME_LENGTH + NS_NETWORK_PROTOCOL_PROGID_PREFIX_LENGTH + 1)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetProtocolHandler(const char* scheme, nsIProtocolHandler* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(NS_NETWORK_PROTOCOL_PROGID_PREFIX_LENGTH
|
||||
== nsCRT::strlen(NS_NETWORK_PROTOCOL_PROGID_PREFIX),
|
||||
"need to fix NS_NETWORK_PROTOCOL_PROGID_PREFIX_LENGTH");
|
||||
|
||||
// XXX we may want to speed this up by introducing our own protocol
|
||||
// scheme -> protocol handler mapping, avoiding the string manipulation
|
||||
// and service manager stuff
|
||||
|
||||
char buf[MAX_NET_PROGID_LENGTH];
|
||||
nsCAutoString progID(NS_NETWORK_PROTOCOL_PROGID_PREFIX);
|
||||
progID += scheme;
|
||||
progID.ToLowerCase();
|
||||
progID.ToCString(buf, MAX_NET_PROGID_LENGTH);
|
||||
|
||||
rv = nsServiceManager::GetService(buf, NS_GET_IID(nsIProtocolHandler), (nsISupports **)result);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::ExtractScheme(const char* inURI, PRUint32 *startPos, PRUint32 *endPos,
|
||||
char* *scheme)
|
||||
{
|
||||
// search for something up to a colon, and call it the scheme
|
||||
NS_ASSERTION(inURI, "null pointer");
|
||||
if (!inURI) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
const char* uri = inURI;
|
||||
|
||||
// skip leading white space
|
||||
while (nsCRT::IsAsciiSpace(*uri))
|
||||
uri++;
|
||||
|
||||
PRUint32 start = uri - inURI;
|
||||
if (startPos) {
|
||||
*startPos = start;
|
||||
}
|
||||
|
||||
PRUint32 length = 0;
|
||||
char c;
|
||||
while ((c = *uri++) != '\0') {
|
||||
if (c == ':') {
|
||||
if (endPos) {
|
||||
*endPos = start + length + 1;
|
||||
}
|
||||
|
||||
if (scheme) {
|
||||
char* str = (char*)nsAllocator::Alloc(length + 1);
|
||||
if (str == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCRT::memcpy(str, &inURI[start], length);
|
||||
str[length] = '\0';
|
||||
*scheme = str;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
else if (nsCRT::IsAsciiAlpha(c)) {
|
||||
length++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsIOService::NewURI(const char* aSpec, nsIURI* aBaseURI,
|
||||
nsIURI* *result, nsIProtocolHandler* *hdlrResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIURI* base;
|
||||
char* scheme;
|
||||
rv = ExtractScheme(aSpec, nsnull, nsnull, &scheme);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// then aSpec is absolute
|
||||
// ignore aBaseURI in this case
|
||||
base = nsnull;
|
||||
}
|
||||
else {
|
||||
// then aSpec is relative
|
||||
if (aBaseURI == nsnull)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
rv = aBaseURI->GetScheme(&scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
base = aBaseURI;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = GetProtocolHandler(scheme, getter_AddRefs(handler));
|
||||
nsCRT::free(scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (hdlrResult) {
|
||||
*hdlrResult = handler;
|
||||
NS_ADDREF(*hdlrResult);
|
||||
}
|
||||
return handler->NewURI(aSpec, base, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewURI(const char* aSpec, nsIURI* aBaseURI,
|
||||
nsIURI* *result)
|
||||
{
|
||||
return NewURI(aSpec, aBaseURI, result, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannelFromURI(nsIURI *aURI, nsIChannel **result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsXPIDLCString scheme;
|
||||
rv = aURI->GetScheme(getter_Copies(scheme));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = GetProtocolHandler((const char*)scheme, getter_AddRefs(handler));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = handler->NewChannel(aURI, result);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannel(const char *aSpec, nsIURI *aBaseURI, nsIChannel **result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = NewURI(aSpec, aBaseURI, getter_AddRefs(uri), getter_AddRefs(handler));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = handler->NewChannel(uri, result);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetOffline(PRBool *offline)
|
||||
{
|
||||
*offline = mOffline;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::SetOffline(PRBool offline)
|
||||
{
|
||||
nsresult rv1 = NS_OK;
|
||||
nsresult rv2 = NS_OK;
|
||||
if (offline) {
|
||||
// be sure to try and shutdown both (even if the first fails)
|
||||
if (mSocketTransportService)
|
||||
rv1 = mSocketTransportService->Shutdown();
|
||||
if (mDNSService)
|
||||
rv2 = mDNSService->Shutdown();
|
||||
if (NS_FAILED(rv1)) return rv1;
|
||||
if (NS_FAILED(rv2)) return rv2;
|
||||
}
|
||||
else if (!offline && mOffline) {
|
||||
// go online
|
||||
if (mSocketTransportService)
|
||||
rv1 = mSocketTransportService->Init();
|
||||
if (NS_FAILED(rv1)) return rv1;
|
||||
|
||||
if (mDNSService)
|
||||
rv2 = mDNSService->Init();
|
||||
if (NS_FAILED(rv2)) return rv2; //XXX should we shutdown the socket transport service?
|
||||
}
|
||||
mOffline = offline;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// URL parsing utilities
|
||||
|
||||
/* encode characters into % escaped hexcodes */
|
||||
|
||||
/* use the following masks to specify which
|
||||
part of an URL you want to escape:
|
||||
|
||||
url_Scheme = 1
|
||||
url_Username = 2
|
||||
url_Password = 4
|
||||
url_Host = 8
|
||||
url_Directory = 16
|
||||
url_FileBaseName = 32
|
||||
url_FileExtension = 64
|
||||
url_Param = 128
|
||||
url_Query = 256
|
||||
url_Ref = 512
|
||||
*/
|
||||
|
||||
/* by default this function will not escape parts of a string
|
||||
that already look escaped, which means it already includes
|
||||
a valid hexcode. This is done to avoid multiple escapes of
|
||||
a string. Use the following mask to force escaping of a
|
||||
string:
|
||||
|
||||
url_Forced = 1024
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsIOService::Escape(const char *str, PRInt16 mask, char** result)
|
||||
{
|
||||
nsCAutoString esc_str;
|
||||
nsresult rv = nsURLEscape((char*)str,mask,esc_str);
|
||||
CRTFREEIF(*result);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
*result = esc_str.ToNewCString();
|
||||
if (!*result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::Unescape(const char *str, char **result)
|
||||
{
|
||||
return nsURLUnescape((char*)str,result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::ExtractPort(const char *str, PRInt32 *result)
|
||||
{
|
||||
PRInt32 returnValue = -1;
|
||||
*result = (0 < PR_sscanf(str, "%d", &returnValue)) ? returnValue : -1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::ResolveRelativePath(const char *relativePath, const char* basePath,
|
||||
char **result)
|
||||
{
|
||||
nsCAutoString name;
|
||||
nsCAutoString path(basePath);
|
||||
|
||||
PRUnichar last = path.Last();
|
||||
PRBool needsDelim = !(last == '/' || last == '\\' || last == '\0');
|
||||
|
||||
PRBool end = PR_FALSE;
|
||||
char c;
|
||||
while (!end) {
|
||||
c = *relativePath++;
|
||||
switch (c) {
|
||||
case '\0':
|
||||
case '#':
|
||||
case ';':
|
||||
case '?':
|
||||
end = PR_TRUE;
|
||||
// fall through...
|
||||
case '/':
|
||||
case '\\':
|
||||
// delimiter found
|
||||
if (name.Equals("..")) {
|
||||
// pop path
|
||||
PRInt32 pos = path.RFind("/");
|
||||
if (pos > 0) {
|
||||
path.Truncate(pos + 1);
|
||||
path += name;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
}
|
||||
else if (name.Equals(".") || name.Equals("")) {
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
// append name to path
|
||||
if (needsDelim)
|
||||
path += "/";
|
||||
path += name;
|
||||
needsDelim = PR_TRUE;
|
||||
}
|
||||
name = "";
|
||||
break;
|
||||
|
||||
default:
|
||||
// append char to name
|
||||
name += c;
|
||||
}
|
||||
}
|
||||
// append anything left on relativePath (e.g. #..., ;..., ?...)
|
||||
if (c != '\0')
|
||||
path += --relativePath;
|
||||
|
||||
*result = path.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
60
mozilla/netwerk/base/src/nsIOService.h
Normal file
60
mozilla/netwerk/base/src/nsIOService.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIOService_h__
|
||||
#define nsIOService_h__
|
||||
|
||||
#include "nsIIOService.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsURLHelper.h"
|
||||
|
||||
class nsIOService : public nsIIOService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIIOService methods:
|
||||
NS_DECL_NSIIOSERVICE
|
||||
|
||||
// nsIOService methods:
|
||||
nsIOService();
|
||||
virtual ~nsIOService();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
nsresult NewURI(const char* aSpec, nsIURI* aBaseURI,
|
||||
nsIURI* *result, nsIProtocolHandler* *hdlrResult);
|
||||
|
||||
protected:
|
||||
PRBool mOffline;
|
||||
nsCOMPtr<nsISocketTransportService> mSocketTransportService;
|
||||
nsCOMPtr<nsIFileTransportService> mFileTransportService;
|
||||
nsCOMPtr<nsIDNSService> mDNSService;
|
||||
};
|
||||
|
||||
#endif // nsIOService_h__
|
||||
487
mozilla/netwerk/base/src/nsInputStreamChannel.cpp
Normal file
487
mozilla/netwerk/base/src/nsInputStreamChannel.cpp
Normal file
@@ -0,0 +1,487 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsInputStreamChannel.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "netCore.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
|
||||
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsInputStreamChannel methods:
|
||||
|
||||
nsInputStreamChannel::nsInputStreamChannel()
|
||||
: mContentType(nsnull), mContentLength(-1), mLoadAttributes(LOAD_NORMAL),
|
||||
mBufferSegmentSize(0), mBufferMaxSize(0), mStatus(NS_OK)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsInputStreamChannel::~nsInputStreamChannel()
|
||||
{
|
||||
if (mContentType) nsCRT::free(mContentType);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsInputStreamChannel::Create(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsInputStreamChannel* channel = new nsInputStreamChannel();
|
||||
if (channel == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(channel);
|
||||
nsresult rv = channel->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(channel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::Init(nsIURI* uri,
|
||||
nsIInputStream* in,
|
||||
const char* contentType,
|
||||
PRInt32 contentLength)
|
||||
{
|
||||
mURI = uri;
|
||||
mContentLength = contentLength;
|
||||
|
||||
if (contentType) {
|
||||
mContentType = nsCRT::strdup(contentType);
|
||||
const char *constContentType = mContentType;
|
||||
if (!constContentType) return NS_ERROR_OUT_OF_MEMORY;
|
||||
char* semicolon = PL_strchr(constContentType, ';');
|
||||
CBufDescriptor cbd(constContentType,
|
||||
PR_TRUE,
|
||||
semicolon ? (semicolon-constContentType) + 1: PL_strlen(constContentType), // capacity
|
||||
semicolon ? (semicolon-constContentType) : PL_strlen(constContentType));
|
||||
nsCAutoString(cbd).ToLowerCase();
|
||||
}
|
||||
mInputStream = in;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS5(nsInputStreamChannel,
|
||||
nsIInputStreamChannel,
|
||||
nsIChannel,
|
||||
nsIRequest,
|
||||
nsIStreamObserver,
|
||||
nsIStreamListener);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::IsPending(PRBool *result)
|
||||
{
|
||||
if (mFileTransport)
|
||||
return mFileTransport->IsPending(result);
|
||||
*result = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetStatus(nsresult *status)
|
||||
{
|
||||
*status = mStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::Cancel(nsresult status)
|
||||
{
|
||||
mStatus = status;
|
||||
if (mFileTransport)
|
||||
return mFileTransport->Cancel(status);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::Suspend(void)
|
||||
{
|
||||
if (mFileTransport)
|
||||
return mFileTransport->Suspend();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::Resume(void)
|
||||
{
|
||||
if (mFileTransport)
|
||||
return mFileTransport->Resume();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetOriginalURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mOriginalURI ? mOriginalURI : mURI;
|
||||
NS_IF_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetOriginalURI(nsIURI* aURI)
|
||||
{
|
||||
mOriginalURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mURI;
|
||||
NS_IF_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetURI(nsIURI* aURI)
|
||||
{
|
||||
mURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::AsyncOpen(nsIStreamObserver *observer, nsISupports* ctxt)
|
||||
{
|
||||
if (mFileTransport)
|
||||
return NS_ERROR_IN_PROGRESS;
|
||||
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = fts->CreateTransportFromStream(mInputStream, mContentType, mContentLength,
|
||||
getter_AddRefs(mFileTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mBufferSegmentSize > 0) {
|
||||
rv = mFileTransport->SetBufferSegmentSize(mBufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (mBufferMaxSize > 0) {
|
||||
rv = mFileTransport->SetBufferMaxSize(mBufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
return mFileTransport->AsyncOpen(observer, ctxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::OpenInputStream(nsIInputStream **result)
|
||||
{
|
||||
*result = mInputStream;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::OpenOutputStream(nsIOutputStream **_retval)
|
||||
{
|
||||
// we don't do output
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(listener, "no listener");
|
||||
mRealListener = listener;
|
||||
|
||||
if (mLoadGroup) {
|
||||
nsCOMPtr<nsILoadGroupListenerFactory> factory;
|
||||
//
|
||||
// Create a load group "proxy" listener...
|
||||
//
|
||||
rv = mLoadGroup->GetGroupListenerFactory(getter_AddRefs(factory));
|
||||
if (factory) {
|
||||
nsIStreamListener *newListener;
|
||||
rv = factory->CreateLoadGroupListener(mRealListener, &newListener);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mRealListener = newListener;
|
||||
NS_RELEASE(newListener);
|
||||
}
|
||||
}
|
||||
|
||||
rv = mLoadGroup->AddChannel(this, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
if (mFileTransport == nsnull) {
|
||||
NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = fts->CreateTransportFromStream(mInputStream, mContentType, mContentLength,
|
||||
getter_AddRefs(mFileTransport));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (mBufferSegmentSize > 0) {
|
||||
rv = mFileTransport->SetBufferSegmentSize(mBufferSegmentSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
if (mBufferMaxSize > 0) {
|
||||
rv = mFileTransport->SetBufferMaxSize(mBufferMaxSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return mFileTransport->AsyncRead(this, ctxt);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::AsyncWrite(nsIInputStream *fromStream,
|
||||
nsIStreamObserver *observer, nsISupports *ctxt)
|
||||
{
|
||||
// we don't do output
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
|
||||
{
|
||||
*aLoadAttributes = mLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetLoadAttributes(nsLoadFlags aLoadAttributes)
|
||||
{
|
||||
mLoadAttributes = aLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetContentType(char * *aContentType)
|
||||
{
|
||||
*aContentType = nsCRT::strdup(mContentType);
|
||||
if (*aContentType == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetContentType(const char *aContentType)
|
||||
{
|
||||
if (mContentType) {
|
||||
nsCRT::free(mContentType);
|
||||
}
|
||||
mContentType = nsCRT::strdup(aContentType);
|
||||
if (aContentType == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetContentLength(PRInt32 *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetTransferOffset(PRUint32 *aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("GetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetTransferOffset(PRUint32 aTransferOffset)
|
||||
{
|
||||
NS_NOTREACHED("SetTransferOffset");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetTransferCount(PRInt32 *aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("GetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetTransferCount(PRInt32 aTransferCount)
|
||||
{
|
||||
NS_NOTREACHED("SetTransferCount");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetBufferSegmentSize(PRUint32 *aBufferSegmentSize)
|
||||
{
|
||||
*aBufferSegmentSize = mBufferSegmentSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetBufferSegmentSize(PRUint32 aBufferSegmentSize)
|
||||
{
|
||||
mBufferSegmentSize = aBufferSegmentSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetBufferMaxSize(PRUint32 *aBufferMaxSize)
|
||||
{
|
||||
*aBufferMaxSize = mBufferMaxSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetBufferMaxSize(PRUint32 aBufferMaxSize)
|
||||
{
|
||||
mBufferMaxSize = aBufferMaxSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetShouldCache(PRBool *aShouldCache)
|
||||
{
|
||||
*aShouldCache = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetPipeliningAllowed(PRBool *aPipeliningAllowed)
|
||||
{
|
||||
*aPipeliningAllowed = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetPipeliningAllowed(PRBool aPipeliningAllowed)
|
||||
{
|
||||
NS_NOTREACHED("SetPipeliningAllowed");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
*aLoadGroup = mLoadGroup.get();
|
||||
NS_IF_ADDREF(*aLoadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
mLoadGroup = aLoadGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetOwner(nsISupports* *aOwner)
|
||||
{
|
||||
*aOwner = mOwner.get();
|
||||
NS_IF_ADDREF(*aOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetOwner(nsISupports* aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
||||
{
|
||||
*aNotificationCallbacks = mCallbacks.get();
|
||||
NS_IF_ADDREF(*aNotificationCallbacks);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
|
||||
{
|
||||
mCallbacks = aNotificationCallbacks;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamListener methods:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::OnStartRequest(nsIChannel* transportChannel, nsISupports* context)
|
||||
{
|
||||
NS_ASSERTION(mRealListener, "No listener...");
|
||||
return mRealListener->OnStartRequest(this, context);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::OnStopRequest(nsIChannel* transportChannel, nsISupports* context,
|
||||
nsresult aStatus, const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = mRealListener->OnStopRequest(this, context, aStatus, aMsg);
|
||||
|
||||
if (mLoadGroup) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLoadGroup->RemoveChannel(this, context, aStatus, aMsg);
|
||||
}
|
||||
}
|
||||
|
||||
// Release the reference to the consumer stream listener...
|
||||
mRealListener = null_nsCOMPtr();
|
||||
mFileTransport = null_nsCOMPtr();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::OnDataAvailable(nsIChannel* transportChannel, nsISupports* context,
|
||||
nsIInputStream *aIStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
return mRealListener->OnDataAvailable(this, context, aIStream,
|
||||
aSourceOffset, aLength);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
69
mozilla/netwerk/base/src/nsInputStreamChannel.h
Normal file
69
mozilla/netwerk/base/src/nsInputStreamChannel.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsInputStreamChannel_h__
|
||||
#define nsInputStreamChannel_h__
|
||||
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsInputStreamChannel : public nsIInputStreamChannel,
|
||||
public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIINPUTSTREAMCHANNEL
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
nsInputStreamChannel();
|
||||
virtual ~nsInputStreamChannel();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
char* mContentType;
|
||||
PRInt32 mContentLength;
|
||||
nsCOMPtr<nsIInputStream> mInputStream;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsIChannel> mFileTransport;
|
||||
nsCOMPtr<nsIStreamListener> mRealListener;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
PRUint32 mLoadAttributes;
|
||||
nsresult mStatus;
|
||||
};
|
||||
|
||||
#endif // nsInputStreamChannel_h__
|
||||
679
mozilla/netwerk/base/src/nsLoadGroup.cpp
Normal file
679
mozilla/netwerk/base/src/nsLoadGroup.cpp
Normal file
@@ -0,0 +1,679 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsLoadGroup.h"
|
||||
#include "nsIStreamObserver.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURI.h"
|
||||
#include "prlog.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
// Log module for nsILoadGroup logging...
|
||||
//
|
||||
// To enable logging (see prlog.h for full details):
|
||||
//
|
||||
// set NSPR_LOG_MODULES=LoadGroup:5
|
||||
// set NSPR_LOG_FILE=nspr.log
|
||||
//
|
||||
// this enables PR_LOG_DEBUG level information and places all output in
|
||||
// the file nspr.log
|
||||
//
|
||||
PRLogModuleInfo* gLoadGroupLog = nsnull;
|
||||
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsLoadGroup::nsLoadGroup(nsISupports* outer)
|
||||
: mDefaultLoadAttributes(nsIChannel::LOAD_NORMAL),
|
||||
mForegroundCount(0),
|
||||
mChannels(nsnull)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
// Initialize the global PRLogModule for nsILoadGroup logging
|
||||
// if necessary...
|
||||
//
|
||||
if (nsnull == gLoadGroupLog) {
|
||||
gLoadGroupLog = PR_NewLogModule("LoadGroup");
|
||||
}
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Created.\n", this));
|
||||
}
|
||||
|
||||
nsLoadGroup::~nsLoadGroup()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = Cancel(NS_BINDING_ABORTED);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cancel failed");
|
||||
|
||||
NS_IF_RELEASE(mChannels);
|
||||
mDefaultLoadChannel = null_nsCOMPtr();
|
||||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Destroyed.\n", this));
|
||||
}
|
||||
|
||||
|
||||
nsresult nsLoadGroup::Init()
|
||||
{
|
||||
return NS_NewISupportsArray(&mChannels);
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsLoadGroup::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
|
||||
nsresult rv;
|
||||
nsLoadGroup* group = new nsLoadGroup(aOuter);
|
||||
if (group == nsnull) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = group->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = group->AggregatedQueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
delete group;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_AGGREGATED(nsLoadGroup);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports)))
|
||||
*aInstancePtr = GetInner();
|
||||
else if (aIID.Equals(NS_GET_IID(nsILoadGroup)) ||
|
||||
aIID.Equals(NS_GET_IID(nsIRequest)) ||
|
||||
aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsILoadGroup*, this);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsISupportsWeakReference))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupportsWeakReference*,this);
|
||||
}
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::IsPending(PRBool *aResult)
|
||||
{
|
||||
if (mForegroundCount > 0) {
|
||||
*aResult = PR_TRUE;
|
||||
} else {
|
||||
*aResult = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetStatus(nsresult *status)
|
||||
{
|
||||
*status = NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::Cancel(nsresult status)
|
||||
{
|
||||
nsresult rv, firstError;
|
||||
PRUint32 count;
|
||||
|
||||
rv = mChannels->Count(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
firstError = NS_OK;
|
||||
|
||||
if (count) {
|
||||
nsIChannel* channel;
|
||||
|
||||
//
|
||||
// Operate the elements from back to front so that if items get
|
||||
// get removed from the list it won't affect our iteration
|
||||
//
|
||||
while (count > 0) {
|
||||
channel = NS_STATIC_CAST(nsIChannel*, mChannels->ElementAt(--count));
|
||||
|
||||
NS_ASSERTION(channel, "NULL channel found in list.");
|
||||
if (!channel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
char* uriStr;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = uri->GetSpec(&uriStr);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
uriStr = nsCRT::strdup("?");
|
||||
}
|
||||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Canceling channel %x %s.\n",
|
||||
this, channel, uriStr));
|
||||
nsCRT::free(uriStr);
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
//
|
||||
// Remove the channel from the load group... This may cause
|
||||
// the OnStopRequest notification to fire...
|
||||
//
|
||||
// XXX: What should the context and error message be?
|
||||
//
|
||||
(void)RemoveChannel(channel, nsnull, status, nsnull);
|
||||
|
||||
// Cancel the channel...
|
||||
rv = channel->Cancel(status);
|
||||
|
||||
// Remember the first failure and return it...
|
||||
if (NS_FAILED(rv) && NS_SUCCEEDED(firstError)) {
|
||||
firstError = rv;
|
||||
}
|
||||
|
||||
NS_RELEASE(channel);
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
(void)mChannels->Count(&count);
|
||||
|
||||
NS_ASSERTION(count == 0, "Channel list is not empty.");
|
||||
NS_ASSERTION(mForegroundCount == 0, "Foreground URLs are active.");
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
return firstError;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::Suspend()
|
||||
{
|
||||
nsresult rv, firstError;
|
||||
PRUint32 count;
|
||||
|
||||
rv = mChannels->Count(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
firstError = NS_OK;
|
||||
//
|
||||
// Operate the elements from back to front so that if items get
|
||||
// get removed from the list it won't affect our iteration
|
||||
//
|
||||
while (count > 0) {
|
||||
nsIChannel* channel;
|
||||
|
||||
channel = NS_STATIC_CAST(nsIChannel*, mChannels->ElementAt(--count));
|
||||
|
||||
NS_ASSERTION(channel, "NULL channel found in list.");
|
||||
if (!channel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
char* uriStr;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = uri->GetSpec(&uriStr);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
uriStr = nsCRT::strdup("?");
|
||||
}
|
||||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Suspending channel %x %s.\n",
|
||||
this, channel, uriStr));
|
||||
nsCRT::free(uriStr);
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
// Suspend the channel...
|
||||
rv = channel->Suspend();
|
||||
|
||||
// Remember the first failure and return it...
|
||||
if (NS_FAILED(rv) && NS_SUCCEEDED(firstError)) {
|
||||
firstError = rv;
|
||||
}
|
||||
|
||||
NS_RELEASE(channel);
|
||||
}
|
||||
|
||||
return firstError;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::Resume()
|
||||
{
|
||||
nsresult rv, firstError;
|
||||
PRUint32 count;
|
||||
|
||||
rv = mChannels->Count(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
firstError = NS_OK;
|
||||
//
|
||||
// Operate the elements from back to front so that if items get
|
||||
// get removed from the list it won't affect our iteration
|
||||
//
|
||||
while (count > 0) {
|
||||
nsIChannel* channel;
|
||||
|
||||
channel = NS_STATIC_CAST(nsIChannel*, mChannels->ElementAt(--count));
|
||||
|
||||
NS_ASSERTION(channel, "NULL channel found in list.");
|
||||
if (!channel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
char* uriStr;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = uri->GetSpec(&uriStr);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
uriStr = nsCRT::strdup("?");
|
||||
}
|
||||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Resuming channel %x %s.\n",
|
||||
this, channel, uriStr));
|
||||
nsCRT::free(uriStr);
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
// Resume the channel...
|
||||
rv = channel->Resume();
|
||||
|
||||
// Remember the first failure and return it...
|
||||
if (NS_FAILED(rv) && NS_SUCCEEDED(firstError)) {
|
||||
firstError = rv;
|
||||
}
|
||||
|
||||
NS_RELEASE(channel);
|
||||
}
|
||||
|
||||
return firstError;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsILoadGroup methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::Init(nsIStreamObserver *aObserver)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = SetGroupObserver(aObserver);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetDefaultLoadAttributes(PRUint32 *aDefaultLoadAttributes)
|
||||
{
|
||||
*aDefaultLoadAttributes = mDefaultLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::SetDefaultLoadAttributes(PRUint32 aDefaultLoadAttributes)
|
||||
{
|
||||
mDefaultLoadAttributes = aDefaultLoadAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetDefaultLoadChannel(nsIChannel * *aChannel)
|
||||
{
|
||||
*aChannel = mDefaultLoadChannel;
|
||||
NS_IF_ADDREF(*aChannel);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::SetDefaultLoadChannel(nsIChannel *aChannel)
|
||||
{
|
||||
mDefaultLoadChannel = aChannel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::AddChannel(nsIChannel *channel, nsISupports* ctxt)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
{
|
||||
PRUint32 count;
|
||||
char* uriStr;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = uri->GetSpec(&uriStr);
|
||||
if (NS_FAILED(rv))
|
||||
uriStr = nsCRT::strdup("?");
|
||||
|
||||
(void)mChannels->Count(&count);
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Adding channel %x %s (count=%d).\n",
|
||||
this, channel, uriStr, count));
|
||||
nsCRT::free(uriStr);
|
||||
}
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
nsLoadFlags flags;
|
||||
|
||||
MergeLoadAttributes(channel);
|
||||
|
||||
rv = channel->GetLoadAttributes(&flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//
|
||||
// Add the channel to the list of active channels...
|
||||
//
|
||||
// XXX this method incorrectly returns a bool
|
||||
//
|
||||
rv = mChannels->AppendElement(channel) ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!(flags & nsIChannel::LOAD_BACKGROUND)) {
|
||||
// Update the count of foreground URIs..
|
||||
mForegroundCount += 1;
|
||||
|
||||
//
|
||||
// Fire the OnStartRequest notification out to the observer...
|
||||
//
|
||||
// If the notification fails then DO NOT add the channel to
|
||||
// the load group.
|
||||
//
|
||||
nsCOMPtr<nsIStreamObserver> observer (do_QueryReferent(mObserver));
|
||||
if (observer) {
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Firing OnStartRequest for channel %x."
|
||||
"(foreground count=%d).\n",
|
||||
this, channel, mForegroundCount));
|
||||
|
||||
rv = observer->OnStartRequest(channel, ctxt);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_ERROR,
|
||||
("LOADGROUP [%x]: OnStartRequest for channel %x FAILED.\n",
|
||||
this, channel));
|
||||
//
|
||||
// The URI load has been canceled by the observer. Clean up
|
||||
// the damage...
|
||||
//
|
||||
// XXX this method incorrectly returns a bool
|
||||
//
|
||||
rv = mChannels->RemoveElement(channel) ? NS_OK : NS_ERROR_FAILURE;
|
||||
mForegroundCount -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::RemoveChannel(nsIChannel *channel, nsISupports* ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
{
|
||||
PRUint32 count = 0;
|
||||
char* uriStr;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
if (channel) {
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = uri->GetSpec(&uriStr);
|
||||
if (NS_FAILED(rv))
|
||||
uriStr = nsCRT::strdup("?");
|
||||
|
||||
(void)mChannels->Count(&count);
|
||||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Removing channel %x %s status %x (count=%d).\n",
|
||||
this, channel, uriStr, status, count-1));
|
||||
nsCRT::free(uriStr);
|
||||
}
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
//
|
||||
// Remove the channel from the group. If this fails, it means that
|
||||
// the channel was *not* in the group so do not update the foreground
|
||||
// count or it will get messed up...
|
||||
//
|
||||
//
|
||||
// XXX this method incorrectly returns a bool
|
||||
//
|
||||
rv = mChannels->RemoveElement(channel) ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_ERROR,
|
||||
("LOADGROUP [%x]: Unable to remove channel %x. Not in group!\n",
|
||||
this, channel));
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsLoadFlags flags;
|
||||
rv = channel->GetLoadAttributes(&flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!(flags & nsIChannel::LOAD_BACKGROUND)) {
|
||||
NS_ASSERTION(mForegroundCount > 0, "ForegroundCount messed up");
|
||||
mForegroundCount -= 1;
|
||||
|
||||
// Fire the OnStopRequest out to the observer...
|
||||
nsCOMPtr<nsIStreamObserver> observer (do_QueryReferent(mObserver));
|
||||
if (observer) {
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP [%x]: Firing OnStopRequest for channel %x."
|
||||
"(foreground count=%d).\n",
|
||||
this, channel, mForegroundCount));
|
||||
|
||||
rv = observer->OnStopRequest(channel, ctxt, status, errorMsg);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_ERROR,
|
||||
("LOADGROUP [%x]: OnStopRequest for channel %x FAILED.\n",
|
||||
this, channel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetChannels(nsISimpleEnumerator * *aChannels)
|
||||
{
|
||||
return NS_NewArrayEnumerator(aChannels, mChannels);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetGroupListenerFactory(nsILoadGroupListenerFactory * *aFactory)
|
||||
{
|
||||
if (mGroupListenerFactory) {
|
||||
mGroupListenerFactory->QueryReferent(NS_GET_IID(nsILoadGroupListenerFactory), (void**)aFactory);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::SetGroupListenerFactory(nsILoadGroupListenerFactory *aFactory)
|
||||
{
|
||||
mGroupListenerFactory = getter_AddRefs(NS_GetWeakReference(aFactory));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::SetGroupObserver(nsIStreamObserver* aObserver)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Release the old observer (if any...)
|
||||
mObserver = null_nsCOMPtr();
|
||||
#if 0
|
||||
if (aObserver) {
|
||||
nsCOMPtr<nsIEventQueue> eventQueue;
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueService, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQueue));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewAsyncStreamObserver(getter_AddRefs(mObserver),
|
||||
eventQueue, aObserver);
|
||||
}
|
||||
#else
|
||||
//mObserver = aObserver;
|
||||
mObserver = getter_AddRefs(NS_GetWeakReference(aObserver));
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetGroupObserver(nsIStreamObserver* *aResult)
|
||||
{
|
||||
nsCOMPtr<nsIStreamObserver> observer (do_QueryReferent(mObserver));
|
||||
*aResult = observer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::GetActiveCount(PRUint32* aResult)
|
||||
{
|
||||
*aResult = mForegroundCount;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult nsLoadGroup::MergeLoadAttributes(nsIChannel *aChannel)
|
||||
{
|
||||
nsresult rv;
|
||||
nsLoadFlags flags, oldFlags;
|
||||
|
||||
rv = aChannel->GetLoadAttributes(&flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
oldFlags = flags;
|
||||
//
|
||||
// Inherit the group cache validation policy (bits 12-15)
|
||||
//
|
||||
if ( !((nsIChannel::VALIDATE_NEVER |
|
||||
nsIChannel::VALIDATE_ALWAYS |
|
||||
nsIChannel::VALIDATE_ONCE_PER_SESSION |
|
||||
nsIChannel::VALIDATE_HEURISTICALLY) & flags)) {
|
||||
flags |= (nsIChannel::VALIDATE_NEVER |
|
||||
nsIChannel::VALIDATE_ALWAYS |
|
||||
nsIChannel::VALIDATE_ONCE_PER_SESSION |
|
||||
nsIChannel::VALIDATE_HEURISTICALLY) & mDefaultLoadAttributes;
|
||||
}
|
||||
//
|
||||
// Inherit the group reload policy (bits 9-10)
|
||||
//
|
||||
if (!(nsIChannel::FORCE_VALIDATION & flags)) {
|
||||
flags |= (nsIChannel::FORCE_VALIDATION & mDefaultLoadAttributes);
|
||||
}
|
||||
|
||||
if (!(nsIChannel::FORCE_RELOAD & flags)) {
|
||||
flags |= (nsIChannel::FORCE_RELOAD & mDefaultLoadAttributes);
|
||||
}
|
||||
//
|
||||
// Inherit the group persistent cache policy (bit 8)
|
||||
//
|
||||
if (!(nsIChannel::INHIBIT_PERSISTENT_CACHING & flags)) {
|
||||
flags |= (nsIChannel::INHIBIT_PERSISTENT_CACHING & mDefaultLoadAttributes);
|
||||
}
|
||||
//
|
||||
// Inherit the group loading policy (bit 0)
|
||||
//
|
||||
if (!(nsIChannel::LOAD_BACKGROUND & flags)) {
|
||||
flags |= (nsIChannel::LOAD_BACKGROUND & mDefaultLoadAttributes);
|
||||
}
|
||||
|
||||
if (flags != oldFlags) {
|
||||
rv = aChannel->SetLoadAttributes(flags);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
77
mozilla/netwerk/base/src/nsLoadGroup.h
Normal file
77
mozilla/netwerk/base/src/nsLoadGroup.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsLoadGroup_h__
|
||||
#define nsLoadGroup_h__
|
||||
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsAgg.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsISupportsArray;
|
||||
|
||||
class nsLoadGroup : public nsILoadGroup,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods:
|
||||
NS_DECL_NSIREQUEST
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsILoadGroup methods:
|
||||
NS_DECL_NSILOADGROUP
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsLoadGroup methods:
|
||||
|
||||
nsLoadGroup(nsISupports* outer);
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
virtual ~nsLoadGroup();
|
||||
nsresult Init();
|
||||
|
||||
nsresult MergeLoadAttributes(nsIChannel *aChannel);
|
||||
|
||||
protected:
|
||||
PRUint32 mDefaultLoadAttributes;
|
||||
PRUint32 mForegroundCount;
|
||||
|
||||
nsISupportsArray* mChannels;
|
||||
|
||||
nsWeakPtr mObserver;
|
||||
// nsCOMPtr<nsIStreamObserver> mObserver;
|
||||
nsCOMPtr<nsIChannel> mDefaultLoadChannel;
|
||||
|
||||
nsWeakPtr mGroupListenerFactory;
|
||||
};
|
||||
|
||||
#endif // nsLoadGroup_h__
|
||||
183
mozilla/netwerk/base/src/nsNetModRegEntry.cpp
Normal file
183
mozilla/netwerk/base/src/nsNetModRegEntry.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsNetModRegEntry.h"
|
||||
#include "plstr.h"
|
||||
#include "nsIAllocator.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsProxyObjectManager.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsISupports
|
||||
//////////////////////////////
|
||||
NS_IMPL_ISUPPORTS(nsNetModRegEntry, NS_GET_IID(nsINetModRegEntry));
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsINetModRegEntry
|
||||
//////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetSyncProxy(nsINetNotify **aNotify)
|
||||
{
|
||||
if (mSyncProxy)
|
||||
{
|
||||
*aNotify = mSyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = BuildProxy(PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*aNotify = mSyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetAsyncProxy(nsINetNotify **aNotify)
|
||||
{
|
||||
if (mAsyncProxy)
|
||||
{
|
||||
*aNotify = mAsyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = BuildProxy(PR_FALSE);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*aNotify = mAsyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetTopic(char **topic)
|
||||
{
|
||||
if (mTopic)
|
||||
{
|
||||
*topic = (char *) nsAllocator::Clone(mTopic, nsCRT::strlen(mTopic) + 1);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::Equals(nsINetModRegEntry* aEntry, PRBool *_retVal)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
*_retVal = PR_FALSE;
|
||||
|
||||
char* topic;
|
||||
|
||||
rv = aEntry->GetTopic(&topic);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (topic && PL_strcmp(topic, mTopic))
|
||||
{
|
||||
nsCOMPtr<nsINetNotify> aSyncProxy;
|
||||
rv = aEntry->GetSyncProxy(getter_AddRefs(aSyncProxy));
|
||||
|
||||
if(aSyncProxy == mSyncProxy)
|
||||
{
|
||||
*_retVal = PR_TRUE;
|
||||
}
|
||||
nsAllocator::Free(topic);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsNetModRegEntry
|
||||
//////////////////////////////
|
||||
|
||||
nsNetModRegEntry::nsNetModRegEntry(const char *aTopic,
|
||||
nsINetNotify *aNotify,
|
||||
nsresult *result)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mTopic = new char [PL_strlen(aTopic) + 1];
|
||||
PL_strcpy(mTopic, aTopic);
|
||||
|
||||
mAsyncProxy = nsnull;
|
||||
mSyncProxy = nsnull;
|
||||
mRealNotifier = aNotify;
|
||||
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, result);
|
||||
|
||||
if (NS_FAILED(*result)) return;
|
||||
|
||||
*result = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQ));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNetModRegEntry::BuildProxy(PRBool sync)
|
||||
{
|
||||
if (mEventQ == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult result;
|
||||
|
||||
NS_WITH_SERVICE( nsIProxyObjectManager, proxyManager, kProxyObjectManagerCID, &result);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
if (sync)
|
||||
{
|
||||
result = proxyManager->GetProxyObject( mEventQ,
|
||||
NS_GET_IID(nsINetNotify),
|
||||
mRealNotifier,
|
||||
PROXY_SYNC | PROXY_ALWAYS,
|
||||
getter_AddRefs(mSyncProxy));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = proxyManager->GetProxyObject( mEventQ,
|
||||
NS_GET_IID(nsINetNotify),
|
||||
mRealNotifier,
|
||||
PROXY_ASYNC | PROXY_ALWAYS,
|
||||
getter_AddRefs(mAsyncProxy));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsNetModRegEntry::~nsNetModRegEntry()
|
||||
{
|
||||
delete [] mTopic;
|
||||
}
|
||||
55
mozilla/netwerk/base/src/nsNetModRegEntry.h
Normal file
55
mozilla/netwerk/base/src/nsNetModRegEntry.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef ___nsNetModRegEntry_h___
|
||||
#define ___nsNetModRegEntry_h___
|
||||
|
||||
#include "nsINetModRegEntry.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsNetModRegEntry : public nsINetModRegEntry {
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetModRegEntry
|
||||
NS_IMETHOD GetSyncProxy(nsINetNotify * *aSyncProxy);
|
||||
NS_IMETHOD GetAsyncProxy(nsINetNotify * *aAsyncProxy);
|
||||
NS_IMETHOD GetTopic(char * *aTopic);
|
||||
NS_IMETHOD Equals(nsINetModRegEntry* aEntry, PRBool *_retVal);
|
||||
|
||||
// nsNetModRegEntry
|
||||
nsNetModRegEntry(const char *aTopic, nsINetNotify *aNotify, nsresult *result);
|
||||
virtual ~nsNetModRegEntry();
|
||||
|
||||
protected:
|
||||
char *mTopic;
|
||||
nsCOMPtr<nsINetNotify> mRealNotifier;
|
||||
nsCOMPtr<nsINetNotify> mSyncProxy;
|
||||
nsCOMPtr<nsINetNotify> mAsyncProxy;
|
||||
nsCOMPtr<nsIEventQueue> mEventQ;
|
||||
|
||||
nsresult BuildProxy(PRBool sync);
|
||||
};
|
||||
|
||||
#endif //___nsNetModRegEntry_h___
|
||||
203
mozilla/netwerk/base/src/nsNetModuleMgr.cpp
Normal file
203
mozilla/netwerk/base/src/nsNetModuleMgr.cpp
Normal file
@@ -0,0 +1,203 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsNetModuleMgr.h"
|
||||
#include "nsNetModRegEntry.h"
|
||||
#include "nsEnumeratorUtils.h" // for nsArrayEnumerator
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
nsNetModuleMgr* nsNetModuleMgr::gManager;
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsISupports
|
||||
///////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsNetModuleMgr, NS_GET_IID(nsINetModuleMgr));
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsINetModuleMgr
|
||||
///////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::RegisterModule(const char *aTopic, nsINetNotify *aNotify)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 cnt;
|
||||
|
||||
// XXX before registering an object for a particular topic
|
||||
// XXX QI the nsINetNotify interface passed in for the interfaces
|
||||
// XXX supported by the topic.
|
||||
|
||||
nsAutoLock lock(mLock);
|
||||
nsNetModRegEntry *newEntry = new nsNetModRegEntry(aTopic, aNotify, &rv);
|
||||
if (!newEntry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
delete newEntry;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINetModRegEntry> newEntryI = do_QueryInterface(newEntry, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete newEntry;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Check for a previous registration
|
||||
mEntries->Count(&cnt);
|
||||
for (PRUint32 i = 0; i < cnt; i++)
|
||||
{
|
||||
nsCOMPtr<nsINetModRegEntry> curEntry =
|
||||
dont_AddRef(NS_STATIC_CAST(nsINetModRegEntry*, mEntries->ElementAt(i)));
|
||||
|
||||
PRBool same = PR_FALSE;
|
||||
rv = newEntryI->Equals(curEntry, &same);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// if we've already got this one registered, yank it, and replace it with the new one
|
||||
if (same) {
|
||||
mEntries->DeleteElementAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rv = mEntries->AppendElement(NS_STATIC_CAST(nsISupports*, newEntryI)) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::UnregisterModule(const char *aTopic, nsINetNotify *aNotify)
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsINetModRegEntry> tmpEntryI;
|
||||
nsNetModRegEntry *tmpEntry = new nsNetModRegEntry(aTopic, aNotify, &rv);
|
||||
if (!tmpEntry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = tmpEntry->QueryInterface(NS_GET_IID(nsINetModRegEntry), getter_AddRefs(tmpEntryI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRUint32 cnt;
|
||||
mEntries->Count(&cnt);
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsCOMPtr<nsINetModRegEntry> curEntry =
|
||||
dont_AddRef(NS_STATIC_CAST(nsINetModRegEntry*, mEntries->ElementAt(i)));
|
||||
|
||||
PRBool same = PR_FALSE;
|
||||
rv = tmpEntryI->Equals(curEntry, &same);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (same) {
|
||||
mEntries->DeleteElementAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::EnumerateModules(const char *aTopic, nsISimpleEnumerator **aEnumerator) {
|
||||
|
||||
nsresult rv;
|
||||
// get all the entries for this topic
|
||||
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
PRUint32 cnt;
|
||||
rv = mEntries->Count(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// create the new array
|
||||
nsCOMPtr<nsISupportsArray> topicEntries;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(topicEntries));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// run through the main entry array looking for topic matches.
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsCOMPtr<nsINetModRegEntry> entry =
|
||||
dont_AddRef(NS_STATIC_CAST(nsINetModRegEntry*, mEntries->ElementAt(i)));
|
||||
|
||||
nsXPIDLCString topic;
|
||||
rv = entry->GetTopic(getter_Copies(topic));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (0 == PL_strcmp(aTopic, topic)) {
|
||||
// found a match, add it to the list
|
||||
rv = topicEntries->AppendElement(NS_STATIC_CAST(nsISupports*, entry)) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = NS_NewArrayEnumerator(getter_AddRefs(enumerator), topicEntries);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aEnumerator = enumerator;
|
||||
NS_ADDREF(*aEnumerator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsNetModuleMgr
|
||||
///////////////////////////////////
|
||||
|
||||
nsNetModuleMgr::nsNetModuleMgr() {
|
||||
NS_INIT_REFCNT();
|
||||
NS_NewISupportsArray(&mEntries);
|
||||
mLock = PR_NewLock();
|
||||
}
|
||||
|
||||
nsNetModuleMgr::~nsNetModuleMgr() {
|
||||
NS_IF_RELEASE(mEntries);
|
||||
PR_DestroyLock(mLock);
|
||||
gManager = nsnull;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsNetModuleMgr::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
if (! gManager) {
|
||||
gManager = new nsNetModuleMgr();
|
||||
if (! gManager)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(gManager);
|
||||
nsresult rv = gManager->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(gManager);
|
||||
|
||||
return rv;
|
||||
}
|
||||
55
mozilla/netwerk/base/src/nsNetModuleMgr.h
Normal file
55
mozilla/netwerk/base/src/nsNetModuleMgr.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef ___nsNetModuleMgr_h__
|
||||
#define ___nsNetModuleMgr_h__
|
||||
|
||||
#include "nsINetModuleMgr.h"
|
||||
#include "prlock.h"
|
||||
#include "nspr.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
class nsNetModuleMgr : public nsINetModuleMgr {
|
||||
protected:
|
||||
static nsNetModuleMgr* gManager;
|
||||
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetModuleMgr
|
||||
NS_DECL_NSINETMODULEMGR
|
||||
|
||||
// nsNetModuleMgr
|
||||
nsNetModuleMgr();
|
||||
virtual ~nsNetModuleMgr();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
|
||||
nsISupportsArray *mEntries;
|
||||
PRLock *mLock;
|
||||
};
|
||||
|
||||
|
||||
#endif // ___nsNetModuleMgr_h__
|
||||
313
mozilla/netwerk/base/src/nsNoAuthURLParser.cpp
Normal file
313
mozilla/netwerk/base/src/nsNoAuthURLParser.cpp
Normal file
@@ -0,0 +1,313 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Andreas Otte.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsNoAuthURLParser.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
#include "prprf.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsNoAuthURLParser, NS_GET_IID(nsIURLParser))
|
||||
|
||||
nsNoAuthURLParser::~nsNoAuthURLParser()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsNoAuthURLParser::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsNoAuthURLParser* p = new nsNoAuthURLParser();
|
||||
if (p == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(p);
|
||||
nsresult rv = p->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(p);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParseAtScheme(const char* i_Spec, char* *o_Scheme,
|
||||
char* *o_Username, char* *o_Password,
|
||||
char* *o_Host, PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_PRECONDITION( (nsnull != i_Spec), "Parse called on empty url!");
|
||||
if (!i_Spec)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
int len = PL_strlen(i_Spec);
|
||||
if (len >= 2 && *i_Spec == '/' && *(i_Spec+1) == '/') // No Scheme
|
||||
{
|
||||
rv = ParseAtPreHost(i_Spec, o_Username, o_Password, o_Host, o_Port,
|
||||
o_Path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static const char delimiters[] = ":"; //this order is optimized.
|
||||
char* brk = PL_strpbrk(i_Spec, delimiters);
|
||||
|
||||
if (!brk) // everything is a path
|
||||
{
|
||||
rv = ParseAtPath((char*)i_Spec, o_Path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
switch (*brk)
|
||||
{
|
||||
case ':' :
|
||||
rv = ExtractString((char*)i_Spec, o_Scheme, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Scheme);
|
||||
rv = ParseAtPreHost(brk+1, o_Username, o_Password, o_Host,
|
||||
o_Port, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "This just can't be!");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParseAtPreHost(const char* i_Spec, char* *o_Username,
|
||||
char* *o_Password, char* *o_Host,
|
||||
PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
// Skip leading two slashes
|
||||
char* fwdPtr= (char*) i_Spec;
|
||||
if (fwdPtr && (*fwdPtr != '\0') && (*fwdPtr == '/'))
|
||||
fwdPtr++;
|
||||
if (fwdPtr && (*fwdPtr != '\0') && (*fwdPtr == '/'))
|
||||
fwdPtr++;
|
||||
|
||||
// There is no PreHost
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParseAtHost(const char* i_Spec, char* *o_Host,
|
||||
PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
// There is no Host, but take care of a localhost
|
||||
if ((nsCRT::strcasecmp(i_Spec,"localhost")==0) ||
|
||||
(PL_strcasestr(i_Spec,"localhost/")==i_Spec))
|
||||
return ParseAtPath(i_Spec+9,o_Path);
|
||||
rv = ParseAtPath(i_Spec, o_Path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParseAtPort(const char* i_Spec, PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
// There is no Port
|
||||
rv = ParseAtPath(i_Spec, o_Path);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParseAtPath(const char* i_Spec, char* *o_Path)
|
||||
{
|
||||
// Just write the path and check for a starting /
|
||||
nsCAutoString dir;
|
||||
if ('/' != *i_Spec)
|
||||
dir += "/";
|
||||
|
||||
dir += i_Spec;
|
||||
|
||||
*o_Path = dir.ToNewCString();
|
||||
return (*o_Path ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParseAtDirectory(const char* i_Path, char* *o_Directory,
|
||||
char* *o_FileBaseName, char* *o_FileExtension,
|
||||
char* *o_Param, char* *o_Query, char* *o_Ref)
|
||||
{
|
||||
// Cleanout
|
||||
CRTFREEIF(*o_Directory);
|
||||
CRTFREEIF(*o_FileBaseName);
|
||||
CRTFREEIF(*o_FileExtension);
|
||||
CRTFREEIF(*o_Param);
|
||||
CRTFREEIF(*o_Query);
|
||||
CRTFREEIF(*o_Ref);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Parse the Path into its components
|
||||
if (!i_Path)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
return (o_Directory ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
char* dirfile = nsnull;
|
||||
char* options = nsnull;
|
||||
|
||||
int len = PL_strlen(i_Path);
|
||||
|
||||
/* Factor out the optionpart with ;?# */
|
||||
static const char delimiters[] = ";?#"; // for param, query and ref
|
||||
char* brk = PL_strpbrk(i_Path, delimiters);
|
||||
|
||||
if (!brk) // Everything is just path and filename
|
||||
{
|
||||
DupString(&dirfile, i_Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
int dirfileLen = brk - i_Path;
|
||||
ExtractString((char*)i_Path, &dirfile, dirfileLen);
|
||||
len -= dirfileLen;
|
||||
ExtractString((char*)i_Path + dirfileLen, &options, len);
|
||||
brk = options;
|
||||
}
|
||||
|
||||
/* now that we have broken up the path treat every part differently */
|
||||
/* first dir+file */
|
||||
|
||||
char* file;
|
||||
|
||||
int dlen = PL_strlen(dirfile);
|
||||
if (dlen == 0)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
file = dirfile;
|
||||
} else {
|
||||
CoaleseDirs(dirfile);
|
||||
// Get length again
|
||||
dlen = PL_strlen(dirfile);
|
||||
|
||||
// First find the last slash
|
||||
file = PL_strrchr(dirfile, '/');
|
||||
if (!file)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
file = dirfile;
|
||||
}
|
||||
|
||||
// If its not the same as the first slash then extract directory
|
||||
if (file != dirfile)
|
||||
{
|
||||
ExtractString(dirfile, o_Directory, (file - dirfile)+1);
|
||||
} else {
|
||||
DupString(o_Directory, "/");
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract FileBaseName and FileExtension */
|
||||
if (dlen > 0) {
|
||||
// Look again if there was a slash
|
||||
char* slash = PL_strrchr(dirfile, '/');
|
||||
char* e_FileName = nsnull;
|
||||
if (slash) {
|
||||
if (dirfile+dlen-1>slash)
|
||||
ExtractString(slash+1, &e_FileName, dlen-(slash-dirfile+1));
|
||||
} else {
|
||||
// Use the full String as Filename
|
||||
ExtractString(dirfile, &e_FileName, dlen);
|
||||
}
|
||||
|
||||
rv = ParseFileName(e_FileName,o_FileBaseName,o_FileExtension);
|
||||
CRTFREEIF(e_FileName);
|
||||
}
|
||||
|
||||
// Now take a look at the options. "#" has precedence over "?"
|
||||
// which has precedence over ";"
|
||||
if (options) {
|
||||
// Look for "#" first. Everything following it is in the ref
|
||||
brk = PL_strchr(options, '#');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Ref, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
|
||||
// Now look for "?"
|
||||
brk = PL_strchr(options, '?');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Query, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
|
||||
// Now look for ';'
|
||||
brk = PL_strchr(options, ';');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Param, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
nsCRT::free(dirfile);
|
||||
nsCRT::free(options);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParsePreHost(const char* i_PreHost, char* *o_Username,
|
||||
char* *o_Password)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNoAuthURLParser::ParseFileName(const char* i_FileName,
|
||||
char* *o_FileBaseName,
|
||||
char* *o_FileExtension)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!i_FileName) {
|
||||
*o_FileBaseName = nsnull;
|
||||
*o_FileExtension = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Search for FileExtension
|
||||
// Search for last .
|
||||
// Ignore . at the beginning
|
||||
char* brk = PL_strrchr(i_FileName+1, '.');
|
||||
if (brk)
|
||||
{
|
||||
rv = ExtractString((char*)i_FileName, o_FileBaseName,
|
||||
(brk - i_FileName));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = ExtractString(brk + 1, o_FileExtension,
|
||||
(i_FileName+PL_strlen(i_FileName) - brk - 1));
|
||||
} else {
|
||||
rv = DupString(o_FileBaseName, i_FileName);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
51
mozilla/netwerk/base/src/nsNoAuthURLParser.h
Normal file
51
mozilla/netwerk/base/src/nsNoAuthURLParser.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsNoAuthURLParser_h__
|
||||
#define nsNoAuthURLParser_h__
|
||||
|
||||
#include "nsIURLParser.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsAgg.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
class nsNoAuthURLParser : public nsIURLParser
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsNoAuthURLParser methods:
|
||||
nsNoAuthURLParser() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
virtual ~nsNoAuthURLParser();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsIURLParser methods:
|
||||
NS_DECL_NSIURLPARSER
|
||||
|
||||
};
|
||||
|
||||
#endif // nsNoAuthURLParser_h__
|
||||
236
mozilla/netwerk/base/src/nsProtocolProxyService.cpp
Normal file
236
mozilla/netwerk/base/src/nsProtocolProxyService.cpp
Normal file
@@ -0,0 +1,236 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsProtocolProxyService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
static const char PROXY_PREFS[] = "network.proxy";
|
||||
PRInt32 PR_CALLBACK ProxyPrefsCallback(const char* pref, void* instance)
|
||||
{
|
||||
nsProtocolProxyService* proxyServ = (nsProtocolProxyService*) instance;
|
||||
NS_ASSERTION(proxyServ, "bad instance data");
|
||||
if (proxyServ) proxyServ->PrefsChanged(pref);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsProtocolProxyService, nsIProtocolProxyService);
|
||||
|
||||
|
||||
// nsProtocolProxyService methods
|
||||
NS_IMETHODIMP
|
||||
nsProtocolProxyService::Init() {
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
mPrefs = do_GetService(kPrefServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// register for change callbacks
|
||||
rv = mPrefs->RegisterCallback(PROXY_PREFS, ProxyPrefsCallback, (void*)this);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PrefsChanged(nsnull);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsProtocolProxyService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) {
|
||||
nsresult rv;
|
||||
if (aOuter) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsProtocolProxyService* serv = new nsProtocolProxyService();
|
||||
if (!serv) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(serv);
|
||||
rv = serv->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete serv;
|
||||
return rv;
|
||||
}
|
||||
rv = serv->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(serv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsProtocolProxyService::PrefsChanged(const char* pref) {
|
||||
PRBool bChangeAll = (pref) ? PR_FALSE : PR_TRUE;
|
||||
NS_ASSERTION(mPrefs, "No preference service available!");
|
||||
if (!mPrefs) return;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (bChangeAll || !PL_strcmp(pref, "network.proxy.type"))
|
||||
{
|
||||
PRInt32 type = -1;
|
||||
rv = mPrefs->GetIntPref("network.proxy.type",&type);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mUseProxy = (type == 1); // type == 2 is autoconfig stuff
|
||||
}
|
||||
|
||||
nsXPIDLCString tempString;
|
||||
if (bChangeAll || !PL_strcmp(pref, "network.proxy.http"))
|
||||
{
|
||||
mHTTPProxyHost = "";
|
||||
rv = mPrefs->CopyCharPref("network.proxy.http",
|
||||
getter_Copies(tempString));
|
||||
if (NS_SUCCEEDED(rv) && tempString && *tempString)
|
||||
mHTTPProxyHost = nsCRT::strdup(tempString);
|
||||
}
|
||||
|
||||
if (bChangeAll || !PL_strcmp(pref, "network.proxy.http_port"))
|
||||
{
|
||||
mHTTPProxyPort = -1;
|
||||
PRInt32 proxyPort = -1;
|
||||
rv = mPrefs->GetIntPref("network.proxy.http_port",&proxyPort);
|
||||
if (NS_SUCCEEDED(rv) && proxyPort>0)
|
||||
mHTTPProxyPort = proxyPort;
|
||||
}
|
||||
|
||||
if (bChangeAll || !PL_strcmp(pref, "network.proxy.ftp"))
|
||||
{
|
||||
mFTPProxyHost = "";
|
||||
rv = mPrefs->CopyCharPref("network.proxy.ftp",
|
||||
getter_Copies(tempString));
|
||||
if (NS_SUCCEEDED(rv) && tempString && *tempString)
|
||||
mFTPProxyHost = nsCRT::strdup(tempString);
|
||||
}
|
||||
|
||||
if (bChangeAll || !PL_strcmp(pref, "network.proxy.ftp_port"))
|
||||
{
|
||||
mFTPProxyPort = -1;
|
||||
PRInt32 proxyPort = -1;
|
||||
rv = mPrefs->GetIntPref("network.proxy.ftp_port",&proxyPort);
|
||||
if (NS_SUCCEEDED(rv) && proxyPort>0)
|
||||
mFTPProxyPort = proxyPort;
|
||||
}
|
||||
|
||||
if (bChangeAll || !PL_strcmp(pref, "network.proxy.no_proxies_on"))
|
||||
{
|
||||
CRTFREEIF(mFilters);
|
||||
rv = mPrefs->CopyCharPref("network.proxy.no_proxies_on",
|
||||
getter_Copies(tempString));
|
||||
if (NS_SUCCEEDED(rv) && tempString && *tempString)
|
||||
mFilters = nsCRT::strdup(tempString);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsProtocolProxyService::CanUseProxy(nsIURI* aURI)
|
||||
{
|
||||
if (!mFilters || !*mFilters)
|
||||
return PR_TRUE;
|
||||
|
||||
PRInt32 port;
|
||||
nsXPIDLCString host;
|
||||
|
||||
nsresult rv = aURI->GetHost(getter_Copies(host));
|
||||
if (NS_FAILED(rv) || !host || !*host)
|
||||
return PR_FALSE;
|
||||
|
||||
rv = aURI->GetPort(&port);
|
||||
if (NS_FAILED(rv)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// TODO this parsing should occur when mFilters is read in from the pref
|
||||
// into an array of hosts/port combinations.
|
||||
// so that we just compare the strings and be quicker. -Gagan
|
||||
char* np= mFilters;
|
||||
while (*np)
|
||||
{
|
||||
while (*np && (*np == ',' || nsCRT::IsAsciiSpace(*np)))
|
||||
np++;
|
||||
|
||||
char* endproxy = np+1;
|
||||
char* portLocation = 0;
|
||||
PRInt32 nport = 0; // no proxy port
|
||||
// find the end of this element.
|
||||
while (*endproxy && (*endproxy != ',' &&
|
||||
!nsCRT::IsAsciiSpace(*endproxy)))
|
||||
{
|
||||
if (*endproxy == ':')
|
||||
portLocation=endproxy;
|
||||
endproxy++;
|
||||
}
|
||||
|
||||
if (portLocation)
|
||||
nport = atoi(portLocation+1);
|
||||
|
||||
if (!nport || (nport == port)) // ports match...
|
||||
{
|
||||
int nlength = (portLocation ? portLocation : endproxy) - np;
|
||||
// compare the trailing portion of the host-
|
||||
if (0 == PL_strncasecmp(host+PL_strlen(host)-nlength, np, nlength))
|
||||
return PR_FALSE;
|
||||
}
|
||||
np = endproxy;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// nsIProtocolProxyService
|
||||
NS_IMETHODIMP
|
||||
nsProtocolProxyService::ExamineForProxy(nsIURI *aURI, nsIProxy *aProxy) {
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(aURI && aProxy, "need a uri and proxy iface folks.");
|
||||
|
||||
// if proxies are enabled and this host:port combo is
|
||||
// supposed to use a proxy, check for a proxy.
|
||||
if (!mUseProxy || !CanUseProxy(aURI)) {
|
||||
rv = aProxy->SetProxyHost(nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = aProxy->SetProxyPort(-1);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsXPIDLCString scheme;
|
||||
rv = aURI->GetScheme(getter_Copies(scheme));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!PL_strcasecmp(scheme, "http")) {
|
||||
rv = aProxy->SetProxyHost(mHTTPProxyHost);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return aProxy->SetProxyPort(mHTTPProxyPort);
|
||||
}
|
||||
|
||||
if (!PL_strcasecmp(scheme, "ftp")) {
|
||||
rv = aProxy->SetProxyHost(mFTPProxyHost);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return aProxy->SetProxyPort(mFTPProxyPort);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsProtocolProxyService::GetProxyEnabled(PRBool* o_Enabled)
|
||||
{
|
||||
if (!o_Enabled)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*o_Enabled = mUseProxy;
|
||||
return NS_OK;
|
||||
}
|
||||
70
mozilla/netwerk/base/src/nsProtocolProxyService.h
Normal file
70
mozilla/netwerk/base/src/nsProtocolProxyService.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsprotocolproxyservice___h___
|
||||
#define __nsprotocolproxyservice___h___
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIProtocolProxyService.h"
|
||||
|
||||
class nsProtocolProxyService : public nsIProtocolProxyService {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLPROXYSERVICE
|
||||
|
||||
nsProtocolProxyService() {
|
||||
NS_INIT_REFCNT();
|
||||
mUseProxy = PR_FALSE;
|
||||
mFilters=0;
|
||||
};
|
||||
|
||||
virtual ~nsProtocolProxyService() {
|
||||
CRTFREEIF(mFilters);
|
||||
};
|
||||
|
||||
NS_IMETHOD Init();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
void PrefsChanged(const char* pref);
|
||||
|
||||
protected:
|
||||
PRBool CanUseProxy(nsIURI* aURI);
|
||||
|
||||
nsCOMPtr<nsIPref> mPrefs;
|
||||
char *mFilters;
|
||||
PRBool mUseProxy;
|
||||
|
||||
nsXPIDLCString mHTTPProxyHost;
|
||||
PRInt32 mHTTPProxyPort;
|
||||
|
||||
nsXPIDLCString mFTPProxyHost;
|
||||
PRInt32 mFTPProxyPort;
|
||||
};
|
||||
|
||||
#endif // __nsprotocolproxyservice___h___
|
||||
|
||||
294
mozilla/netwerk/base/src/nsSimpleURI.cpp
Normal file
294
mozilla/netwerk/base/src/nsSimpleURI.cpp
Normal file
@@ -0,0 +1,294 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#include "nsSimpleURI.h"
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
#include "nsURLHelper.h"
|
||||
|
||||
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
||||
static NS_DEFINE_CID(kThisSimpleURIImplementationCID,
|
||||
NS_THIS_SIMPLEURI_IMPLEMENTATION_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsSimpleURI methods:
|
||||
|
||||
nsSimpleURI::nsSimpleURI(nsISupports* outer)
|
||||
: mScheme(nsnull),
|
||||
mPath(nsnull)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
}
|
||||
|
||||
nsSimpleURI::~nsSimpleURI()
|
||||
{
|
||||
if (mScheme) nsCRT::free(mScheme);
|
||||
if (mPath) nsCRT::free(mPath);
|
||||
}
|
||||
|
||||
NS_IMPL_AGGREGATED(nsSimpleURI);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
*aInstancePtr = GetInner();
|
||||
else if (aIID.Equals(kThisSimpleURIImplementationCID) || // used by Equals
|
||||
aIID.Equals(NS_GET_IID(nsIURI)))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIURI*, this);
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURI methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetSpec(char* *result)
|
||||
{
|
||||
nsAutoString string;
|
||||
// NS_LOCK_INSTANCE();
|
||||
|
||||
// STRING USE WARNING: perhaps |string| should be |nsCAutoString|? -- scc
|
||||
string.AssignWithConversion(mScheme);
|
||||
string.AppendWithConversion(':');
|
||||
string.AppendWithConversion(mPath);
|
||||
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
*result = string.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetSpec(const char* aSpec)
|
||||
{
|
||||
nsAutoString spec;
|
||||
spec.AssignWithConversion(aSpec);
|
||||
|
||||
PRInt32 pos = spec.Find(":");
|
||||
if (pos == -1)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsAutoString scheme;
|
||||
PRInt32 n = spec.Left(scheme, pos);
|
||||
NS_ASSERTION(n == pos, "Left failed");
|
||||
nsAutoString path;
|
||||
PRInt32 count = spec.Length() - pos - 1;
|
||||
n = spec.Mid(path, pos + 1, count);
|
||||
NS_ASSERTION(n == count, "Mid failed");
|
||||
if (mScheme)
|
||||
nsCRT::free(mScheme);
|
||||
mScheme = scheme.ToNewCString();
|
||||
if (mScheme == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (mPath)
|
||||
nsCRT::free(mPath);
|
||||
mPath = path.ToNewCString();
|
||||
if (mPath == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetScheme(char* *result)
|
||||
{
|
||||
*result = nsCRT::strdup(mScheme);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetScheme(const char* scheme)
|
||||
{
|
||||
if (mScheme) nsCRT::free(mScheme);
|
||||
mScheme = nsCRT::strdup(scheme);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetPreHost(char* *result)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetPreHost(const char* preHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetUsername(char* *result)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetUsername(const char* userName)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetPassword(char* *result)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetPassword(const char* password)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetHost(char* *result)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetHost(const char* host)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetPort(PRInt32 *result)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetPort(PRInt32 port)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetPath(char* *result)
|
||||
{
|
||||
*result = nsCRT::strdup(mPath);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetPath(const char* path)
|
||||
{
|
||||
if (mPath) nsCRT::free(mPath);
|
||||
mPath = nsCRT::strdup(path);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetURLParser(nsIURLParser* *result)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetURLParser(nsIURLParser* URLParser)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::Equals(nsIURI* other, PRBool *result)
|
||||
{
|
||||
PRBool eq = PR_FALSE;
|
||||
if (other) {
|
||||
// NS_LOCK_INSTANCE();
|
||||
nsSimpleURI* otherUrl;
|
||||
nsresult rv =
|
||||
other->QueryInterface(kThisSimpleURIImplementationCID,
|
||||
(void**)&otherUrl);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
eq = PRBool((0 == PL_strcmp(mScheme, otherUrl->mScheme)) &&
|
||||
(0 == PL_strcmp(mPath, otherUrl->mPath)));
|
||||
NS_RELEASE(otherUrl);
|
||||
}
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
}
|
||||
*result = eq;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::Clone(nsIURI* *result)
|
||||
{
|
||||
nsSimpleURI* url = new nsSimpleURI(nsnull); // XXX outer?
|
||||
if (url == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->mScheme = nsCRT::strdup(mScheme);
|
||||
if (url->mScheme == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->mPath = nsCRT::strdup(mPath);
|
||||
if (url->mPath == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*result = url;
|
||||
NS_ADDREF(url);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetRelativePath(const char *i_RelativePath)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "This is meaningless in hack context!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::Resolve(const char *relativePath, char **result)
|
||||
{
|
||||
return DupString(result,(char*)relativePath);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_METHOD
|
||||
nsSimpleURI::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
|
||||
nsSimpleURI* url = new nsSimpleURI(aOuter);
|
||||
if (url == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = url->AggregatedQueryInterface(aIID, aResult);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
delete url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
56
mozilla/netwerk/base/src/nsSimpleURI.h
Normal file
56
mozilla/netwerk/base/src/nsSimpleURI.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSimpleURI_h__
|
||||
#define nsSimpleURI_h__
|
||||
|
||||
#include "nsIURL.h"
|
||||
#include "nsAgg.h"
|
||||
|
||||
#define NS_THIS_SIMPLEURI_IMPLEMENTATION_CID \
|
||||
{ /* 22b8f64a-2f7b-11d3-8cd0-0060b0fc14a3 */ \
|
||||
0x22b8f64a, \
|
||||
0x2f7b, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xd0, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
class nsSimpleURI : public nsIURI
|
||||
{
|
||||
public:
|
||||
NS_DECL_AGGREGATED
|
||||
NS_DECL_NSIURI
|
||||
|
||||
// nsSimpleURI methods:
|
||||
|
||||
nsSimpleURI(nsISupports* outer);
|
||||
virtual ~nsSimpleURI();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
char* mScheme;
|
||||
char* mPath;
|
||||
};
|
||||
|
||||
#endif // nsSimpleURI_h__
|
||||
2323
mozilla/netwerk/base/src/nsSocketTransport.cpp
Normal file
2323
mozilla/netwerk/base/src/nsSocketTransport.cpp
Normal file
File diff suppressed because it is too large
Load Diff
258
mozilla/netwerk/base/src/nsSocketTransport.h
Normal file
258
mozilla/netwerk/base/src/nsSocketTransport.h
Normal file
@@ -0,0 +1,258 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSocketTransport_h___
|
||||
#define nsSocketTransport_h___
|
||||
|
||||
#include "prclist.h"
|
||||
#include "prio.h"
|
||||
#include "prnetdb.h"
|
||||
#include "prinrval.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISocketTransport.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIDNSListener.h"
|
||||
#include "nsIPipe.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
#define NS_SOCKET_TRANSPORT_SEGMENT_SIZE (2*1024)
|
||||
#define NS_SOCKET_TRANSPORT_BUFFER_SIZE (8*1024)
|
||||
|
||||
//
|
||||
// This is the maximum amount of data that will be read into a stream before
|
||||
// another transport is processed...
|
||||
//
|
||||
#define MAX_IO_TRANSFER_SIZE (8*1024)
|
||||
|
||||
enum nsSocketState {
|
||||
eSocketState_Created = 0,
|
||||
eSocketState_WaitDNS = 1,
|
||||
eSocketState_Closed = 2,
|
||||
eSocketState_WaitConnect = 3,
|
||||
eSocketState_Connected = 4,
|
||||
eSocketState_WaitReadWrite = 5,
|
||||
eSocketState_Done = 6,
|
||||
eSocketState_Timeout = 7,
|
||||
eSocketState_Error = 8,
|
||||
eSocketState_Max = 9
|
||||
};
|
||||
|
||||
enum nsSocketOperation {
|
||||
eSocketOperation_None = 0,
|
||||
eSocketOperation_Connect = 1,
|
||||
eSocketOperation_ReadWrite = 2,
|
||||
eSocketOperation_Max = 3
|
||||
};
|
||||
|
||||
//
|
||||
// The following emun provides information about the currently
|
||||
// active read and/or write requests...
|
||||
//
|
||||
// +-------------------------------+
|
||||
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
// +-------------------------------+
|
||||
// <-----flag bits----><-type bits->
|
||||
//
|
||||
// Bits:
|
||||
// 0-3: Type (ie. None, Async, Sync)
|
||||
// 4: Done flag.
|
||||
// 5: Wait flag.
|
||||
// 6-7: Unused flags...
|
||||
//
|
||||
//
|
||||
//
|
||||
enum nsSocketReadWriteInfo {
|
||||
eSocketRead_None = 0x0000,
|
||||
eSocketRead_Async = 0x0001,
|
||||
eSocketRead_Sync = 0x0002,
|
||||
eSocketRead_Done = 0x0010,
|
||||
eSocketRead_Wait = 0x0020,
|
||||
eSocketRead_Type_Mask = 0x000F,
|
||||
eSocketRead_Flag_Mask = 0x00F0,
|
||||
|
||||
eSocketWrite_None = 0x0000,
|
||||
eSocketWrite_Async = 0x0100,
|
||||
eSocketWrite_Sync = 0x0200,
|
||||
eSocketWrite_Done = 0x1000,
|
||||
eSocketWrite_Wait = 0x2000,
|
||||
eSocketWrite_Type_Mask = 0x0F00,
|
||||
eSocketWrite_Flag_Mask = 0xF000,
|
||||
|
||||
eSocketDNS_Wait = 0x2020
|
||||
};
|
||||
|
||||
//
|
||||
// This is the default timeout value (in milliseconds) for sockets which have
|
||||
// no activity...
|
||||
//
|
||||
#define DEFAULT_SOCKET_CONNECT_TIMEOUT_IN_MS 35*1000
|
||||
|
||||
// Forward declarations...
|
||||
class nsSocketTransportService;
|
||||
class nsIInterfaceRequestor;
|
||||
|
||||
class nsSocketTransport : public nsISocketTransport,
|
||||
public nsIChannel,
|
||||
public nsIDNSListener,
|
||||
public nsIPipeObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISOCKETTRANSPORT
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIPIPEOBSERVER
|
||||
NS_DECL_NSIDNSLISTENER
|
||||
|
||||
// nsSocketTransport methods:
|
||||
nsSocketTransport();
|
||||
virtual ~nsSocketTransport();
|
||||
|
||||
nsresult Init(nsSocketTransportService* aService,
|
||||
const char* aHost,
|
||||
PRInt32 aPort,
|
||||
const char* aSocketType,
|
||||
const char* aPrintHost, // This host is used for status mesg
|
||||
PRUint32 bufferSegmentSize,
|
||||
PRUint32 bufferMaxSize);
|
||||
|
||||
nsresult Process(PRInt16 aSelectFlags);
|
||||
|
||||
nsresult CheckForTimeout (PRIntervalTime aCurrentTime);
|
||||
|
||||
// Close this socket either right away or once done with the transaction.
|
||||
nsresult CloseConnection(PRBool bNow=PR_TRUE);
|
||||
|
||||
// Access methods used by the socket transport service...
|
||||
PRFileDesc* GetSocket(void) { return mSocketFD; }
|
||||
PRInt16 GetSelectFlags(void) { return mSelectFlags; }
|
||||
PRCList* GetListNode(void) { return &mListLink; }
|
||||
|
||||
static nsSocketTransport* GetInstance(PRCList* qp) { return (nsSocketTransport*)((char*)qp - offsetof(nsSocketTransport, mListLink)); }
|
||||
|
||||
PRBool CanBeReused(void) { return
|
||||
(mCurrentState != eSocketState_Error) && !mCloseConnectionOnceDone;}
|
||||
|
||||
protected:
|
||||
nsresult doConnection(PRInt16 aSelectFlags);
|
||||
nsresult doResolveHost(void);
|
||||
nsresult doRead(PRInt16 aSelectFlags);
|
||||
nsresult doWrite(PRInt16 aSelectFlags);
|
||||
|
||||
nsresult doWriteFromBuffer(PRUint32 *aCount);
|
||||
nsresult doWriteFromStream(PRUint32 *aCount);
|
||||
|
||||
nsresult fireStatus(PRUint32 aCode);
|
||||
nsresult GetSocketErrorString(PRUint32 iCode, PRUnichar** oString) const;
|
||||
|
||||
private:
|
||||
PRIntervalTime mSocketTimeout;
|
||||
PRIntervalTime mSocketConnectTimeout;
|
||||
|
||||
// Access methods for manipulating the ReadWriteInfo...
|
||||
inline void SetReadType(nsSocketReadWriteInfo aType) {
|
||||
mReadWriteState = (mReadWriteState & ~eSocketRead_Type_Mask) | aType;
|
||||
}
|
||||
inline PRUint32 GetReadType(void) {
|
||||
return mReadWriteState & eSocketRead_Type_Mask;
|
||||
}
|
||||
inline void SetWriteType(nsSocketReadWriteInfo aType) {
|
||||
mReadWriteState = (mReadWriteState & ~eSocketWrite_Type_Mask) | aType;
|
||||
}
|
||||
inline PRUint32 GetWriteType(void) {
|
||||
return mReadWriteState & eSocketWrite_Type_Mask;
|
||||
}
|
||||
inline void SetFlag(nsSocketReadWriteInfo aFlag) {
|
||||
mReadWriteState |= aFlag;
|
||||
}
|
||||
inline PRUint32 GetFlag(nsSocketReadWriteInfo aFlag) {
|
||||
return mReadWriteState & aFlag;
|
||||
}
|
||||
|
||||
inline void ClearFlag(nsSocketReadWriteInfo aFlag) {
|
||||
mReadWriteState &= ~aFlag;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
nsresult mCancelStatus;
|
||||
PRBool mCloseConnectionOnceDone;
|
||||
nsSocketState mCurrentState;
|
||||
nsCOMPtr<nsIRequest> mDNSRequest;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsIProgressEventSink> mEventSink;
|
||||
char* mHostName;
|
||||
PRIntervalTime mLastActiveTime;
|
||||
PRCList mListLink;
|
||||
PRUint32 mLoadAttributes;
|
||||
PRMonitor* mMonitor;
|
||||
PRNetAddr mNetAddress;
|
||||
nsCOMPtr<nsISupports> mOpenContext;
|
||||
nsCOMPtr<nsIStreamObserver> mOpenObserver;
|
||||
nsSocketOperation mOperation;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsISupports> mSecurityInfo;
|
||||
PRInt32 mPort;
|
||||
char* mPrintHost; // not the proxy
|
||||
nsCOMPtr<nsISupports> mReadContext;
|
||||
nsCOMPtr<nsIStreamListener> mReadListener;
|
||||
nsCOMPtr<nsIBufferInputStream> mReadPipeIn;
|
||||
nsCOMPtr<nsIBufferOutputStream> mReadPipeOut;
|
||||
PRUint32 mReadWriteState;
|
||||
PRInt16 mSelectFlags;
|
||||
nsSocketTransportService* mService;
|
||||
PRFileDesc* mSocketFD;
|
||||
char* mSocketType;
|
||||
PRUint32 mReadOffset;
|
||||
PRUint32 mWriteOffset;
|
||||
nsresult mStatus;
|
||||
PRInt32 mSuspendCount;
|
||||
PRInt32 mWriteCount;
|
||||
nsCOMPtr<nsISupports> mWriteContext;
|
||||
PRInt32 mBytesExpected;
|
||||
PRUint32 mReuseCount;
|
||||
PRUint32 mLastReuseCount;
|
||||
|
||||
// The following four members are used when AsyncWrite(...) is called
|
||||
// with an nsIInputStream which does not also support the
|
||||
// nsIBufferedInputStream interface...
|
||||
//
|
||||
nsCOMPtr<nsIInputStream> mWriteFromStream;
|
||||
char * mWriteBuffer;
|
||||
PRUint32 mWriteBufferIndex;
|
||||
PRUint32 mWriteBufferLength;
|
||||
|
||||
nsCOMPtr<nsIStreamObserver> mWriteObserver;
|
||||
nsCOMPtr<nsIBufferInputStream> mWritePipeIn;
|
||||
nsCOMPtr<nsIBufferOutputStream> mWritePipeOut;
|
||||
PRUint32 mBufferSegmentSize;
|
||||
PRUint32 mBufferMaxSize;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsSocketTransport_h___ */
|
||||
623
mozilla/netwerk/base/src/nsSocketTransportService.cpp
Normal file
623
mozilla/netwerk/base/src/nsSocketTransportService.cpp
Normal file
@@ -0,0 +1,623 @@
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsILoadGroup.h"
|
||||
#include "netCore.h"
|
||||
#include "nsSocketTransportService.h"
|
||||
#include "nsSocketTransport.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
nsSocketTransportService::nsSocketTransportService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
PR_INIT_CLIST(&mWorkQ);
|
||||
|
||||
mThread = nsnull;
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
mThreadEvent = nsnull;
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
mThreadLock = nsnull;
|
||||
|
||||
mSelectFDSet = nsnull;
|
||||
mSelectFDSetCount = 0;
|
||||
|
||||
mActiveTransportList = nsnull;
|
||||
|
||||
mThreadRunning = PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
nsSocketTransportService::~nsSocketTransportService()
|
||||
{
|
||||
//
|
||||
// It is impossible for the nsSocketTransportService to be deleted while
|
||||
// the transport thread is running because it holds a reference to the
|
||||
// nsIRunnable (ie. the nsSocketTransportService instance)...
|
||||
//
|
||||
NS_ASSERTION(!mThread && !mThreadRunning,
|
||||
"The socket transport thread is still running...");
|
||||
|
||||
if (mSelectFDSet) {
|
||||
PR_Free(mSelectFDSet);
|
||||
mSelectFDSet = nsnull;
|
||||
}
|
||||
|
||||
if (mActiveTransportList) {
|
||||
PR_Free(mActiveTransportList);
|
||||
mActiveTransportList = nsnull;
|
||||
}
|
||||
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
if (mThreadEvent) {
|
||||
PR_DestroyPollableEvent(mThreadEvent);
|
||||
mThreadEvent = nsnull;
|
||||
}
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
|
||||
if (mThreadLock) {
|
||||
PR_DestroyLock(mThreadLock);
|
||||
mThreadLock = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsSocketTransportService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsSocketTransportService* trans = new nsSocketTransportService();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(trans);
|
||||
rv = trans->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = trans->QueryInterface(aIID, aResult);
|
||||
}
|
||||
NS_RELEASE(trans);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::Init(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(!mThread, "Socket transport thread has already been created!.");
|
||||
|
||||
//
|
||||
// Create FDSET list used by PR_Poll(...)
|
||||
//
|
||||
if (!mSelectFDSet) {
|
||||
mSelectFDSet = (PRPollDesc*)PR_Malloc(sizeof(PRPollDesc)*MAX_OPEN_CONNECTIONS);
|
||||
if (mSelectFDSet) {
|
||||
memset(mSelectFDSet, 0, sizeof(PRPollDesc)*MAX_OPEN_CONNECTIONS);
|
||||
} else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Create the list of Active transport objects... This list contains the
|
||||
// nsSocketTransport corresponding to each PRFileDesc* in the mSelectFDSet
|
||||
//
|
||||
if (NS_SUCCEEDED(rv) && !mActiveTransportList) {
|
||||
mActiveTransportList = (nsSocketTransport**)PR_Malloc(sizeof(nsSocketTransport*)*MAX_OPEN_CONNECTIONS);
|
||||
if (mActiveTransportList) {
|
||||
memset(mActiveTransportList, 0, sizeof(nsSocketTransport*)*MAX_OPEN_CONNECTIONS);
|
||||
} else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
//
|
||||
// Create the pollable event used to immediately wake up the transport
|
||||
// thread when it is blocked in PR_Poll(...)
|
||||
//
|
||||
if (NS_SUCCEEDED(rv) && !mThreadEvent) {
|
||||
mThreadEvent = PR_NewPollableEvent();
|
||||
if (!mThreadEvent) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
|
||||
//
|
||||
// Create the synchronization lock for the transport thread...
|
||||
//
|
||||
if (NS_SUCCEEDED(rv) && !mThreadLock) {
|
||||
mThreadLock = PR_NewLock();
|
||||
if (!mThreadLock) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Create the transport thread...
|
||||
//
|
||||
if (NS_SUCCEEDED(rv) && !mThread) {
|
||||
mThreadRunning = PR_TRUE;
|
||||
rv = NS_NewThread(&mThread, this, 0, PR_JOINABLE_THREAD);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportService::AddToWorkQ(nsSocketTransport* aTransport)
|
||||
{
|
||||
PRStatus status = PR_SUCCESS;
|
||||
PRBool bFireEvent = PR_FALSE;
|
||||
nsresult rv = NS_OK;
|
||||
PRCList* qp;
|
||||
|
||||
{
|
||||
nsAutoLock lock(mThreadLock);
|
||||
//
|
||||
// Only add the transport if it is *not* already on the list...
|
||||
//
|
||||
qp = aTransport->GetListNode();
|
||||
if (PR_CLIST_IS_EMPTY(qp)) {
|
||||
NS_ADDREF(aTransport);
|
||||
bFireEvent = PR_CLIST_IS_EMPTY(&mWorkQ);
|
||||
PR_APPEND_LINK(qp, &mWorkQ);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Only fire an event if this is the first entry in the workQ. Otherwise,
|
||||
// the event has already been fired and the transport thread will process
|
||||
// all of the entries at once...
|
||||
//
|
||||
if (bFireEvent) {
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
status = PR_SetPollableEvent(mThreadEvent);
|
||||
#else
|
||||
//
|
||||
// Need to break the socket transport thread out of the call to PR_Poll(...)
|
||||
// since a new transport needs to be processed...
|
||||
//
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
if (PR_FAILURE == status) {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportService::ProcessWorkQ(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRCList* qp;
|
||||
|
||||
//
|
||||
// Only process pending operations while there is space available in the
|
||||
// select list...
|
||||
//
|
||||
// XXX: Need a way to restart the ProcessWorkQ(...) when space becomes
|
||||
// available in the select set...
|
||||
//
|
||||
PR_Lock(mThreadLock);
|
||||
NS_ASSERTION(MAX_OPEN_CONNECTIONS > mSelectFDSetCount, "reached max open connections");
|
||||
while (!PR_CLIST_IS_EMPTY(&mWorkQ) &&
|
||||
(MAX_OPEN_CONNECTIONS > mSelectFDSetCount)) {
|
||||
nsSocketTransport* transport;
|
||||
|
||||
// Get the next item off of the workQ...
|
||||
qp = PR_LIST_HEAD(&mWorkQ);
|
||||
|
||||
transport = nsSocketTransport::GetInstance(qp);
|
||||
PR_REMOVE_AND_INIT_LINK(qp);
|
||||
//
|
||||
// Make sure that the transport is not already on the select list.
|
||||
// It will be added (if necessary) after Process() is called...
|
||||
//
|
||||
RemoveFromSelectList(transport);
|
||||
|
||||
// Try to perform the operation...
|
||||
//
|
||||
// Do not process the transport while holding the transport service
|
||||
// lock... A deadlock could occur if another thread is holding the
|
||||
// transport lock and tries to add the transport to the service's WorkQ...
|
||||
//
|
||||
// Do not pass any select flags...
|
||||
PR_Unlock(mThreadLock);
|
||||
rv = transport->Process(0);
|
||||
PR_Lock(mThreadLock);
|
||||
//
|
||||
// If the operation would block, then add it to the select list for
|
||||
// later processing when the data arrives...
|
||||
//
|
||||
if (NS_BASE_STREAM_WOULD_BLOCK == rv) {
|
||||
rv = AddToSelectList(transport);
|
||||
}
|
||||
// Release the transport object (since it is no longer on the WorkQ).
|
||||
NS_RELEASE(transport);
|
||||
}
|
||||
PR_Unlock(mThreadLock);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsSocketTransportService::AddToSelectList(nsSocketTransport* aTransport)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(MAX_OPEN_CONNECTIONS > mSelectFDSetCount, "reached max open connections");
|
||||
if (aTransport && (MAX_OPEN_CONNECTIONS > mSelectFDSetCount) ) {
|
||||
PRPollDesc* pfd;
|
||||
int i;
|
||||
//
|
||||
// Check to see if the transport is already in the list...
|
||||
//
|
||||
// If the first FD is the Pollable Event, it will be ignored since
|
||||
// its corresponding entry in the ActiveTransportList is nsnull.
|
||||
//
|
||||
for (i=0; i<mSelectFDSetCount; i++) {
|
||||
if (mActiveTransportList[i] == aTransport) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Initialize/update the info in the entry...
|
||||
pfd = &mSelectFDSet[i];
|
||||
pfd->fd = aTransport->GetSocket();;
|
||||
pfd->in_flags = aTransport->GetSelectFlags();
|
||||
pfd->out_flags = 0;
|
||||
// Add the FileDesc to the PRPollDesc list...
|
||||
if (i == mSelectFDSetCount) {
|
||||
// Add the transport instance to the corresponding active transport list...
|
||||
NS_ADDREF(aTransport);
|
||||
mActiveTransportList[mSelectFDSetCount] = aTransport;
|
||||
mSelectFDSetCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportService::RemoveFromSelectList(nsSocketTransport* aTransport)
|
||||
{
|
||||
int i;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (!aTransport) return rv;
|
||||
|
||||
//
|
||||
// Remove the transport from SelectFDSet and ActiveTransportList...
|
||||
//
|
||||
// If the first FD is the Pollable Event, it will be ignored since
|
||||
// its corresponding entry in the ActiveTransportList is nsnull.
|
||||
//
|
||||
for (i=0; i<mSelectFDSetCount; i++) {
|
||||
if (mActiveTransportList[i] == aTransport) {
|
||||
int last = mSelectFDSetCount-1;
|
||||
|
||||
NS_RELEASE(mActiveTransportList[i]);
|
||||
|
||||
// Move the last element in the array into the new empty slot...
|
||||
if (i != last) {
|
||||
memcpy(&mSelectFDSet[i], &mSelectFDSet[last], sizeof(mSelectFDSet[0]));
|
||||
mSelectFDSet[last].fd = nsnull;
|
||||
|
||||
mActiveTransportList[i] = mActiveTransportList[last];
|
||||
mActiveTransportList[last] = nsnull;
|
||||
} else {
|
||||
mSelectFDSet[i].fd = nsnull;
|
||||
mActiveTransportList[i] = nsnull;
|
||||
}
|
||||
mSelectFDSetCount -= 1;
|
||||
rv = NS_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsISupports implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsSocketTransportService,
|
||||
nsISocketTransportService,
|
||||
nsIRunnable)
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsIRunnable implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::Run(void)
|
||||
{
|
||||
PRIntervalTime pollTimeout;
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
//
|
||||
// Initialize the FDSET used by PR_Poll(...). The first item in the FDSet
|
||||
// is *always* the pollable event (ie. mThreadEvent).
|
||||
//
|
||||
mSelectFDSet[0].fd = mThreadEvent;
|
||||
mSelectFDSet[0].in_flags = PR_POLL_READ;
|
||||
mSelectFDSetCount = 1;
|
||||
pollTimeout = PR_MillisecondsToInterval (DEFAULT_POLL_TIMEOUT_IN_MS);
|
||||
#else
|
||||
//
|
||||
// For now, rather than breaking out of the call to PR_Poll(...) just set
|
||||
// the time out small enough...
|
||||
//
|
||||
// This means that new transports will only be processed once a timeout
|
||||
// occurs...
|
||||
//
|
||||
mSelectFDSetCount = 0;
|
||||
pollTimeout = PR_MillisecondsToInterval(5);
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
|
||||
while (mThreadRunning) {
|
||||
nsresult rv;
|
||||
PRInt32 count;
|
||||
PRIntervalTime intervalNow;
|
||||
nsSocketTransport* transport;
|
||||
int i;
|
||||
|
||||
count = PR_Poll(mSelectFDSet, mSelectFDSetCount, pollTimeout);
|
||||
|
||||
if (-1 == count) {
|
||||
// XXX: PR_Poll failed... What should happen?
|
||||
}
|
||||
|
||||
intervalNow = PR_IntervalNow();
|
||||
//
|
||||
// See if any sockets have data...
|
||||
//
|
||||
// Walk the list of active transports backwards to avoid missing
|
||||
// elements when a transport is removed...
|
||||
//
|
||||
for (i=mSelectFDSetCount-1; i>=0; i--) {
|
||||
PRPollDesc* pfd;
|
||||
PRInt16 out_flags;
|
||||
|
||||
transport = mActiveTransportList[i];
|
||||
pfd = &mSelectFDSet[i];
|
||||
|
||||
/* Process any sockets with data first... */
|
||||
//
|
||||
// XXX: PR_Poll(...) has the unpleasent behavior of ONLY setting the
|
||||
// out_flags if one or more FDs are ready. So, DO NOT look at
|
||||
// the out_flags unless count > 0.
|
||||
//
|
||||
if ((count > 0) && pfd->out_flags) {
|
||||
// Clear the out_flags for next time...
|
||||
out_flags = pfd->out_flags;
|
||||
pfd->out_flags = 0;
|
||||
|
||||
if (transport) {
|
||||
rv = transport->Process(out_flags);
|
||||
if (NS_BASE_STREAM_WOULD_BLOCK == rv) {
|
||||
// Update the select flags...
|
||||
pfd->in_flags = transport->GetSelectFlags();
|
||||
}
|
||||
//
|
||||
// If the operation completed, then remove the entry from the
|
||||
// select list...
|
||||
//
|
||||
else {
|
||||
rv = RemoveFromSelectList(transport);
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
/* Process any pending operations on the mWorkQ... */
|
||||
NS_ASSERTION(0 == i, "Null transport in active list...");
|
||||
if (0 == i) {
|
||||
//
|
||||
// Clear the pollable event... This call should *never* block since
|
||||
// PR_Poll(...) said that it had been fired...
|
||||
//
|
||||
NS_ASSERTION(!(mSelectFDSet[0].out_flags & PR_POLL_EXCEPT),
|
||||
"Exception on Pollable event.");
|
||||
PR_WaitForPollableEvent(mThreadEvent);
|
||||
|
||||
rv = ProcessWorkQ();
|
||||
}
|
||||
#else
|
||||
//
|
||||
// The pollable event should be the *only* null transport
|
||||
// in the active transport list.
|
||||
//
|
||||
NS_ASSERTION(transport, "Null transport in active list...");
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
}
|
||||
//
|
||||
// Check to see if the transport has timed out...
|
||||
//
|
||||
} else {
|
||||
if (transport) {
|
||||
rv = transport->CheckForTimeout(intervalNow);
|
||||
if (NS_ERROR_NET_TIMEOUT == rv) {
|
||||
// Process the timeout...
|
||||
rv = transport->Process(0);
|
||||
//
|
||||
// The operation has completed. Remove the entry from the
|
||||
// select list///
|
||||
//
|
||||
rv = RemoveFromSelectList(transport);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end-for
|
||||
|
||||
#ifndef USE_POLLABLE_EVENT
|
||||
/* Process any pending operations on the mWorkQ... */
|
||||
rv = ProcessWorkQ();
|
||||
#endif /* !USE_POLLABLE_EVENT */
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsISocketTransportService implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::CreateTransport(const char* aHost,
|
||||
PRInt32 aPort,
|
||||
const char* aPrintHost,
|
||||
PRUint32 bufferSegmentSize,
|
||||
PRUint32 bufferMaxSize,
|
||||
nsIChannel** aResult)
|
||||
{
|
||||
return CreateTransportOfType(nsnull, aHost, aPort, aPrintHost,
|
||||
bufferSegmentSize, bufferMaxSize, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::CreateTransportOfType(const char* aSocketType,
|
||||
const char* aHost,
|
||||
PRInt32 aPort,
|
||||
const char* aPrintHost,
|
||||
PRUint32 bufferSegmentSize,
|
||||
PRUint32 bufferMaxSize,
|
||||
nsIChannel** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_WITH_SERVICE(nsIIOService, ios, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
PRBool offline;
|
||||
rv = ios->GetOffline(&offline);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (offline) return NS_ERROR_OFFLINE;
|
||||
|
||||
nsSocketTransport* transport = nsnull;
|
||||
|
||||
// Parameter validation...
|
||||
NS_ASSERTION(aResult, "aResult == nsnull.");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Create and initialize a new connection object...
|
||||
NS_NEWXPCOM(transport, nsSocketTransport);
|
||||
if (transport) {
|
||||
rv = transport->Init(this, aHost, aPort, aSocketType, aPrintHost,
|
||||
bufferSegmentSize, bufferMaxSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete transport;
|
||||
transport = nsnull;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Set the reference count to one...
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_ADDREF(transport);
|
||||
}
|
||||
*aResult = transport;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::ReuseTransport(nsIChannel* i_Transport,
|
||||
PRBool * o_Reuse)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (!i_Transport)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsSocketTransport* trans = NS_STATIC_CAST(nsSocketTransport*,
|
||||
i_Transport);
|
||||
if (!trans) return rv;
|
||||
*o_Reuse = trans->CanBeReused();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* wakeup the transport from PR_Poll ()
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::Wakeup (nsIChannel* i_Transport)
|
||||
{
|
||||
nsSocketTransport *transport = NS_STATIC_CAST (nsSocketTransport *, i_Transport);
|
||||
|
||||
if (transport == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
AddToWorkQ (transport);
|
||||
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
PR_SetPollableEvent (mThreadEvent);
|
||||
#else
|
||||
// XXX/ruslan: normally we would call PR_Interrupt (), but since it did work
|
||||
// wait till NSPR fixes it one day
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::Shutdown(void)
|
||||
{
|
||||
PRStatus status;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mThread) {
|
||||
//
|
||||
// Clear the running flag and wake up the transport thread...
|
||||
//
|
||||
mThreadRunning = PR_FALSE;
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
status = PR_SetPollableEvent(mThreadEvent);
|
||||
|
||||
// XXX: what should happen if this fails?
|
||||
NS_ASSERTION(PR_SUCCESS == status, "Unable to wake up the transport thread.");
|
||||
#else
|
||||
status = PR_SUCCESS;
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
|
||||
// Wait for the transport thread to exit nsIRunnable::Run()
|
||||
if (PR_SUCCESS == status) {
|
||||
mThread->Join();
|
||||
}
|
||||
|
||||
NS_RELEASE(mThread);
|
||||
} else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
97
mozilla/netwerk/base/src/nsSocketTransportService.h
Normal file
97
mozilla/netwerk/base/src/nsSocketTransportService.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsSocketTransportService_h___
|
||||
#define nsSocketTransportService_h___
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
#if defined(XP_PC) || defined(XP_UNIX) || defined(XP_BEOS)
|
||||
//
|
||||
// Both Windows and Unix support PR_PollableEvents which are used to break
|
||||
// the socket transport thread out of calls to PR_Poll(...) when new
|
||||
// file descriptors must be added to the poll list...
|
||||
//
|
||||
#define USE_POLLABLE_EVENT
|
||||
#endif
|
||||
|
||||
//
|
||||
// This is the Maximum number of Socket Transport instances that can be active
|
||||
// at once...
|
||||
//
|
||||
#define MAX_OPEN_CONNECTIONS 50
|
||||
#define DEFAULT_POLL_TIMEOUT_IN_MS 35*1000
|
||||
|
||||
|
||||
// Forward declarations...
|
||||
class nsSocketTransport;
|
||||
|
||||
class nsSocketTransportService : public nsISocketTransportService,
|
||||
public nsIRunnable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISOCKETTRANSPORTSERVICE
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
// nsSocketTransportService methods:
|
||||
nsSocketTransportService();
|
||||
virtual ~nsSocketTransportService();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult AddToWorkQ(nsSocketTransport* aTransport);
|
||||
|
||||
// XXX: Should these use intervals or Milliseconds?
|
||||
nsresult GetSocketTimeoutInterval(PRIntervalTime* aResult);
|
||||
nsresult SetSocketTimeoutInterval(PRIntervalTime aTime);
|
||||
|
||||
// The following methods are called by the transport thread...
|
||||
nsresult ProcessWorkQ(void);
|
||||
|
||||
nsresult AddToSelectList(nsSocketTransport* aTransport);
|
||||
nsresult RemoveFromSelectList(nsSocketTransport* aTransport);
|
||||
|
||||
protected:
|
||||
nsIThread* mThread;
|
||||
#ifdef USE_POLLABLE_EVENT
|
||||
PRFileDesc* mThreadEvent;
|
||||
#endif /* USE_POLLABLE_EVENT */
|
||||
PRLock* mThreadLock;
|
||||
PRBool mThreadRunning;
|
||||
|
||||
PRCList mWorkQ;
|
||||
|
||||
PRInt32 mSelectFDSetCount;
|
||||
PRPollDesc* mSelectFDSet;
|
||||
nsSocketTransport** mActiveTransportList;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsSocketTransportService_h___ */
|
||||
|
||||
|
||||
1051
mozilla/netwerk/base/src/nsStdURL.cpp
Normal file
1051
mozilla/netwerk/base/src/nsStdURL.cpp
Normal file
File diff suppressed because it is too large
Load Diff
218
mozilla/netwerk/base/src/nsStdURL.h
Normal file
218
mozilla/netwerk/base/src/nsStdURL.h
Normal file
@@ -0,0 +1,218 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsStdURL_h__
|
||||
#define nsStdURL_h__
|
||||
|
||||
#include "nsIURL.h"
|
||||
#include "nsIURLParser.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "nsAgg.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h" // REMOVE Later!!
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFile.h"
|
||||
|
||||
#define NS_THIS_STANDARDURL_IMPLEMENTATION_CID \
|
||||
{ /* e3939dc8-29ab-11d3-8cce-0060b0fc14a3 */ \
|
||||
0xe3939dc8, \
|
||||
0x29ab, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xce, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
class nsStdURL : public nsIFileURL
|
||||
{
|
||||
public:
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsStdURL methods:
|
||||
|
||||
nsStdURL();
|
||||
nsStdURL(const char* i_Spec, nsISupports* outer=nsnull);
|
||||
nsStdURL(const nsStdURL& i_URL);
|
||||
virtual ~nsStdURL();
|
||||
|
||||
nsStdURL& operator =(const nsStdURL& otherURL);
|
||||
PRBool operator ==(const nsStdURL& otherURL) const;
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
NS_DECL_AGGREGATED
|
||||
NS_DECL_NSIURI
|
||||
NS_DECL_NSIURL
|
||||
NS_DECL_NSIFILEURL
|
||||
|
||||
protected:
|
||||
enum Format { ESCAPED, UNESCAPED };
|
||||
nsresult Parse(const char* i_Spec);
|
||||
nsresult AppendString(nsCString& buffer, char* fromUnescapedStr,
|
||||
Format toFormat, PRInt16 mask);
|
||||
nsresult GetString(char** result, char* fromEscapedStr,
|
||||
Format toFormat);
|
||||
nsresult AppendPreHost(nsCString& buffer, char* i_Username,
|
||||
char* i_Password, Format toFormat);
|
||||
nsresult AppendFileName(nsCString& buffer, char* i_FileBaseName,
|
||||
char* i_FileExtension, Format toFormat);
|
||||
|
||||
protected:
|
||||
|
||||
char* mScheme;
|
||||
char* mUsername;
|
||||
char* mPassword;
|
||||
char* mHost;
|
||||
PRInt32 mPort;
|
||||
|
||||
char* mDirectory;
|
||||
char* mFileBaseName;
|
||||
char* mFileExtension;
|
||||
char* mParam;
|
||||
char* mQuery;
|
||||
char* mRef;
|
||||
|
||||
nsCOMPtr<nsIURLParser> mURLParser;
|
||||
|
||||
// If a file was given to SetFile, then this instance variable holds it.
|
||||
// If GetFile is called, we synthesize one and cache it here.
|
||||
nsCOMPtr<nsIFile> mFile;
|
||||
};
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetScheme(char* *o_Scheme)
|
||||
{
|
||||
return GetString(o_Scheme, mScheme, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetUsername(char* *o_Username)
|
||||
{
|
||||
return GetString(o_Username, mUsername, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetPassword(char* *o_Password)
|
||||
{
|
||||
return GetString(o_Password, mPassword, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetHost(char* *o_Host)
|
||||
{
|
||||
return GetString(o_Host, mHost, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetPort(PRInt32 *aPort)
|
||||
{
|
||||
if (aPort)
|
||||
{
|
||||
*aPort = mPort;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetFileBaseName(char* *o_FileBaseName)
|
||||
{
|
||||
return GetString(o_FileBaseName, mFileBaseName, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetFileExtension(char* *o_FileExtension)
|
||||
{
|
||||
return GetString(o_FileExtension, mFileExtension, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetParam(char **o_Param)
|
||||
{
|
||||
return GetString(o_Param, mParam, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetQuery(char* *o_Query)
|
||||
{
|
||||
return GetString(o_Query, mQuery, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetRef(char* *o_Ref)
|
||||
{
|
||||
return GetString(o_Ref, mRef, UNESCAPED);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetScheme(const char* i_Scheme)
|
||||
{
|
||||
CRTFREEIF(mScheme);
|
||||
nsresult rv = DupString(&mScheme, i_Scheme);
|
||||
ToLowerCase(mScheme);
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetUsername(const char* i_Username)
|
||||
{
|
||||
CRTFREEIF(mUsername);
|
||||
return DupString(&mUsername, i_Username);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetPassword(const char* i_Password)
|
||||
{
|
||||
CRTFREEIF(mPassword);
|
||||
return DupString(&mPassword, i_Password);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetHost(const char* i_Host)
|
||||
{
|
||||
CRTFREEIF(mHost);
|
||||
nsresult rv = DupString(&mHost, i_Host);
|
||||
ToLowerCase(mHost);
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetPort(PRInt32 aPort)
|
||||
{
|
||||
mPort = aPort;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetFileBaseName(const char* i_FileBaseName)
|
||||
{
|
||||
CRTFREEIF(mFileBaseName);
|
||||
return DupString(&mFileBaseName, i_FileBaseName);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetFileExtension(const char* i_FileExtension)
|
||||
{
|
||||
CRTFREEIF(mFileExtension);
|
||||
return DupString(&mFileExtension, i_FileExtension);
|
||||
}
|
||||
|
||||
#endif // nsStdURL_h__
|
||||
|
||||
524
mozilla/netwerk/base/src/nsStdURLParser.cpp
Normal file
524
mozilla/netwerk/base/src/nsStdURLParser.cpp
Normal file
@@ -0,0 +1,524 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Andreas Otte.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsStdURLParser.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
#include "prprf.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsStdURLParser, nsIURLParser)
|
||||
|
||||
nsStdURLParser::~nsStdURLParser()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsStdURLParser::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsStdURLParser* p = new nsStdURLParser();
|
||||
if (p == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(p);
|
||||
nsresult rv = p->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(p);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParseAtScheme(const char* i_Spec, char* *o_Scheme,
|
||||
char* *o_Username,
|
||||
char* *o_Password,
|
||||
char* *o_Host, PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_PRECONDITION( (nsnull != i_Spec), "Parse called on empty url!");
|
||||
if (!i_Spec)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
int len = PL_strlen(i_Spec);
|
||||
if (len >= 2 && *i_Spec == '/' && *(i_Spec+1) == '/') // No Scheme
|
||||
{
|
||||
rv = ParseAtPreHost(i_Spec, o_Username, o_Password, o_Host, o_Port,
|
||||
o_Path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static const char delimiters[] = "/:@?"; //this order is optimized.
|
||||
char* brk = PL_strpbrk(i_Spec, delimiters);
|
||||
|
||||
if (!brk) // everything is a host
|
||||
{
|
||||
rv = ExtractString((char*)i_Spec, o_Host, len);
|
||||
ToLowerCase(*o_Host);
|
||||
return rv;
|
||||
} else
|
||||
len = PL_strlen(brk);
|
||||
|
||||
switch (*brk)
|
||||
{
|
||||
case '/' :
|
||||
case '?' :
|
||||
// If the URL starts with a slash then everything is a path
|
||||
if (brk == i_Spec)
|
||||
{
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
}
|
||||
else // The first part is host, so its host/path
|
||||
{
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
}
|
||||
break;
|
||||
case ':' :
|
||||
if (len >= 2 && *(brk+1) == '/' && *(brk+2) == '/') {
|
||||
// Standard http://...
|
||||
rv = ExtractString((char*)i_Spec, o_Scheme, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Scheme);
|
||||
rv = ParseAtPreHost(brk+1, o_Username, o_Password, o_Host,
|
||||
o_Port, o_Path);
|
||||
if (rv == NS_ERROR_MALFORMED_URI) {
|
||||
// or not ? Try something else
|
||||
CRTFREEIF(*o_Username);
|
||||
CRTFREEIF(*o_Password);
|
||||
CRTFREEIF(*o_Host);
|
||||
*o_Port = -1;
|
||||
rv = ParseAtPath(brk+3, o_Path);
|
||||
}
|
||||
return rv;
|
||||
} else {
|
||||
if ( len >= 2 && *(brk+1) == '/' && *(brk+2) != '/') {
|
||||
// May be it is file:/....
|
||||
rv = ExtractString((char*)i_Spec, o_Scheme, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Scheme);
|
||||
rv = ParseAtPath(brk+1, o_Path);
|
||||
return rv;
|
||||
} else {
|
||||
// Could be host:port, so try conversion to number
|
||||
PRInt32 port = ExtractPortFrom(brk+1);
|
||||
if (port <= 0)
|
||||
{
|
||||
// No, try normal procedure
|
||||
rv = ExtractString((char*)i_Spec, o_Scheme,
|
||||
(brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Scheme);
|
||||
rv = ParseAtPreHost(brk+1, o_Username, o_Password, o_Host,
|
||||
o_Port, o_Path);
|
||||
if (rv == NS_ERROR_MALFORMED_URI) {
|
||||
// Try something else
|
||||
CRTFREEIF(*o_Username);
|
||||
CRTFREEIF(*o_Password);
|
||||
CRTFREEIF(*o_Host);
|
||||
*o_Port = -1;
|
||||
rv = ParseAtPath(brk+1, o_Path);
|
||||
}
|
||||
return rv;
|
||||
} else {
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPort(brk+1, o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '@' :
|
||||
rv = ParseAtPreHost(i_Spec, o_Username, o_Password, o_Host,
|
||||
o_Port, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "This just can't be!");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParseAtPreHost(const char* i_Spec, char* *o_Username,
|
||||
char* *o_Password, char* *o_Host,
|
||||
PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Skip leading two slashes
|
||||
char* fwdPtr= (char*) i_Spec;
|
||||
if (fwdPtr && (*fwdPtr != '\0') && (*fwdPtr == '/'))
|
||||
fwdPtr++;
|
||||
if (fwdPtr && (*fwdPtr != '\0') && (*fwdPtr == '/'))
|
||||
fwdPtr++;
|
||||
|
||||
static const char delimiters[] = "/:@?";
|
||||
char* brk = PL_strpbrk(fwdPtr, delimiters);
|
||||
char* brk2 = nsnull;
|
||||
|
||||
if (!brk)
|
||||
{
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
char* e_PreHost = nsnull;
|
||||
switch (*brk)
|
||||
{
|
||||
case ':' :
|
||||
// this maybe the : of host:port or username:password
|
||||
// look if the next special char is @
|
||||
brk2 = PL_strpbrk(brk+1, delimiters);
|
||||
|
||||
if (!brk2)
|
||||
{
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
switch (*brk2)
|
||||
{
|
||||
case '@' :
|
||||
rv = ExtractString(fwdPtr, &e_PreHost, (brk2 - fwdPtr));
|
||||
if (NS_FAILED(rv)) {
|
||||
CRTFREEIF(e_PreHost);
|
||||
return rv;
|
||||
}
|
||||
rv = ParsePreHost(e_PreHost,o_Username,o_Password);
|
||||
CRTFREEIF(e_PreHost);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = ParseAtHost(brk2+1, o_Host, o_Port, o_Path);
|
||||
break;
|
||||
default:
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
return rv;
|
||||
}
|
||||
break;
|
||||
case '@' :
|
||||
rv = ExtractString(fwdPtr, &e_PreHost, (brk - fwdPtr));
|
||||
if (NS_FAILED(rv)) {
|
||||
CRTFREEIF(e_PreHost);
|
||||
return rv;
|
||||
}
|
||||
rv = ParsePreHost(e_PreHost,o_Username,o_Password);
|
||||
CRTFREEIF(e_PreHost);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = ParseAtHost(brk+1, o_Host, o_Port, o_Path);
|
||||
break;
|
||||
default:
|
||||
rv = ParseAtHost(fwdPtr, o_Host, o_Port, o_Path);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParseAtHost(const char* i_Spec, char* *o_Host,
|
||||
PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
int len = PL_strlen(i_Spec);
|
||||
static const char delimiters[] = ":/?"; //this order is optimized.
|
||||
char* brk = PL_strpbrk(i_Spec, delimiters);
|
||||
if (!brk) // everything is a host
|
||||
{
|
||||
rv = ExtractString((char*)i_Spec, o_Host, len);
|
||||
ToLowerCase(*o_Host);
|
||||
return rv;
|
||||
}
|
||||
|
||||
switch (*brk)
|
||||
{
|
||||
case '/' :
|
||||
case '?' :
|
||||
// Get the Host, the rest is Path
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
case ':' :
|
||||
// Get the Host
|
||||
rv = ExtractString((char*)i_Spec, o_Host, (brk - i_Spec));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
ToLowerCase(*o_Host);
|
||||
rv = ParseAtPort(brk+1, o_Port, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "This just can't be!");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParseAtPort(const char* i_Spec, PRInt32 *o_Port, char* *o_Path)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
static const char delimiters[] = "/?"; //this order is optimized.
|
||||
char* brk = PL_strpbrk(i_Spec, delimiters);
|
||||
if (!brk) // everything is a Port
|
||||
{
|
||||
*o_Port = ExtractPortFrom(i_Spec);
|
||||
if (*o_Port <= 0)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
switch (*brk)
|
||||
{
|
||||
case '/' :
|
||||
case '?' :
|
||||
// Get the Port, the rest is Path
|
||||
*o_Port = ExtractPortFrom(i_Spec);
|
||||
if (*o_Port <= 0)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
rv = ParseAtPath(brk, o_Path);
|
||||
return rv;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(0, "This just can't be!");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParseAtPath(const char* i_Spec, char* *o_Path)
|
||||
{
|
||||
// Just write the path and check for a starting /
|
||||
nsCAutoString dir;
|
||||
if ('/' != *i_Spec)
|
||||
dir += "/";
|
||||
|
||||
dir += i_Spec;
|
||||
|
||||
*o_Path = dir.ToNewCString();
|
||||
return (*o_Path ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParseAtDirectory(const char* i_Path, char* *o_Directory,
|
||||
char* *o_FileBaseName, char* *o_FileExtension,
|
||||
char* *o_Param, char* *o_Query, char* *o_Ref)
|
||||
{
|
||||
// Cleanout
|
||||
CRTFREEIF(*o_Directory);
|
||||
CRTFREEIF(*o_FileBaseName);
|
||||
CRTFREEIF(*o_FileExtension);
|
||||
CRTFREEIF(*o_Param);
|
||||
CRTFREEIF(*o_Query);
|
||||
CRTFREEIF(*o_Ref);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Parse the Path into its components
|
||||
if (!i_Path)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
return (o_Directory ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
char* dirfile = nsnull;
|
||||
char* options = nsnull;
|
||||
|
||||
int len = PL_strlen(i_Path);
|
||||
|
||||
/* Factor out the optionpart with ;?# */
|
||||
static const char delimiters[] = ";?#"; // for param, query and ref
|
||||
char* brk = PL_strpbrk(i_Path, delimiters);
|
||||
|
||||
if (!brk) // Everything is just path and filename
|
||||
{
|
||||
DupString(&dirfile, i_Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
int dirfileLen = brk - i_Path;
|
||||
ExtractString((char*)i_Path, &dirfile, dirfileLen);
|
||||
len -= dirfileLen;
|
||||
ExtractString((char*)i_Path + dirfileLen, &options, len);
|
||||
brk = options;
|
||||
}
|
||||
|
||||
/* now that we have broken up the path treat every part differently */
|
||||
/* first dir+file */
|
||||
|
||||
char* file= nsnull;
|
||||
|
||||
int dlen = PL_strlen(dirfile);
|
||||
if (dlen == 0)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
file = dirfile;
|
||||
} else {
|
||||
CoaleseDirs(dirfile);
|
||||
// Get length again
|
||||
dlen = PL_strlen(dirfile);
|
||||
|
||||
// First find the last slash
|
||||
file = PL_strrchr(dirfile, '/');
|
||||
if (!file)
|
||||
{
|
||||
DupString(o_Directory, "/");
|
||||
file = dirfile;
|
||||
}
|
||||
|
||||
// If its not the same as the first slash then extract directory
|
||||
if (file != dirfile)
|
||||
{
|
||||
ExtractString(dirfile, o_Directory, (file - dirfile)+1);
|
||||
} else {
|
||||
DupString(o_Directory, "/");
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract FileBaseName and FileExtension */
|
||||
if (dlen > 0) {
|
||||
// Look again if there was a slash
|
||||
char* slash = PL_strrchr(dirfile, '/');
|
||||
char* e_FileName = nsnull;
|
||||
if (slash) {
|
||||
if (dirfile+dlen-1>slash)
|
||||
ExtractString(slash+1, &e_FileName, dlen-(slash-dirfile+1));
|
||||
} else {
|
||||
// Use the full String as Filename
|
||||
ExtractString(dirfile, &e_FileName, dlen);
|
||||
}
|
||||
|
||||
rv = ParseFileName(e_FileName,o_FileBaseName,o_FileExtension);
|
||||
CRTFREEIF(e_FileName);
|
||||
}
|
||||
|
||||
// Now take a look at the options. "#" has precedence over "?"
|
||||
// which has precedence over ";"
|
||||
if (options) {
|
||||
// Look for "#" first. Everything following it is in the ref
|
||||
brk = PL_strchr(options, '#');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Ref, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
|
||||
// Now look for "?"
|
||||
brk = PL_strchr(options, '?');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Query, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
|
||||
// Now look for ';'
|
||||
brk = PL_strchr(options, ';');
|
||||
if (brk) {
|
||||
int pieceLen = len - (brk + 1 - options);
|
||||
ExtractString(brk+1, o_Param, pieceLen);
|
||||
len -= pieceLen + 1;
|
||||
*brk = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
CRTFREEIF(dirfile);
|
||||
CRTFREEIF(options);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParsePreHost(const char* i_PreHost, char* *o_Username,
|
||||
char* *o_Password)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!i_PreHost) {
|
||||
*o_Username = nsnull;
|
||||
*o_Password = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Search for :
|
||||
static const char delimiters[] = ":";
|
||||
char* brk = PL_strpbrk(i_PreHost, delimiters);
|
||||
if (brk)
|
||||
{
|
||||
rv = ExtractString((char*)i_PreHost, o_Username, (brk - i_PreHost));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = ExtractString(brk+1, o_Password,
|
||||
(i_PreHost+PL_strlen(i_PreHost) - brk - 1));
|
||||
} else {
|
||||
CRTFREEIF(*o_Password);
|
||||
rv = DupString(o_Username, i_PreHost);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStdURLParser::ParseFileName(const char* i_FileName, char* *o_FileBaseName,
|
||||
char* *o_FileExtension)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!i_FileName) {
|
||||
*o_FileBaseName = nsnull;
|
||||
*o_FileExtension = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Search for FileExtension
|
||||
// Search for last .
|
||||
// Ignore . at the beginning
|
||||
|
||||
char* brk = PL_strrchr(i_FileName+1, '.');
|
||||
if (brk)
|
||||
{
|
||||
rv = ExtractString((char*)i_FileName, o_FileBaseName,
|
||||
(brk - i_FileName));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = ExtractString(brk + 1, o_FileExtension,
|
||||
(i_FileName+PL_strlen(i_FileName) - brk - 1));
|
||||
} else {
|
||||
rv = DupString(o_FileBaseName, i_FileName);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
51
mozilla/netwerk/base/src/nsStdURLParser.h
Normal file
51
mozilla/netwerk/base/src/nsStdURLParser.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsStdURLParser_h__
|
||||
#define nsStdURLParser_h__
|
||||
|
||||
#include "nsIURLParser.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsAgg.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
class nsStdURLParser : public nsIURLParser
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsStdURLParser methods:
|
||||
nsStdURLParser() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
virtual ~nsStdURLParser();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// nsIURLParser methods:
|
||||
NS_DECL_NSIURLPARSER
|
||||
|
||||
};
|
||||
|
||||
#endif // nsStdURLParser_h__
|
||||
150
mozilla/netwerk/base/src/nsStreamLoader.cpp
Normal file
150
mozilla/netwerk/base/src/nsStreamLoader.cpp
Normal file
@@ -0,0 +1,150 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsStreamLoader.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsProxiedService.h"
|
||||
|
||||
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::Init(nsIURI* aURL,
|
||||
nsIStreamLoaderObserver* observer,
|
||||
nsISupports* context,
|
||||
nsILoadGroup* aGroup,
|
||||
nsIInterfaceRequestor* notificationCallbacks,
|
||||
nsLoadFlags loadAttributes,
|
||||
PRUint32 bufferSegmentSize,
|
||||
PRUint32 bufferMaxSize)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
mObserver = observer;
|
||||
mContext = context;
|
||||
|
||||
rv = NS_OpenURI(this, nsnull, aURL, nsnull, aGroup, notificationCallbacks,
|
||||
loadAttributes, bufferSegmentSize, bufferMaxSize);
|
||||
if (NS_FAILED(rv) && mObserver) {
|
||||
// don't callback synchronously as it puts the caller
|
||||
// in a recursive situation and breaks the asynchronous
|
||||
// semantics of nsIStreamLoader
|
||||
nsresult rv2 = NS_OK;
|
||||
NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager,
|
||||
kProxyObjectManagerCID, &rv);
|
||||
if (NS_FAILED(rv2)) return rv2;
|
||||
|
||||
nsCOMPtr<nsIStreamLoaderObserver> pObserver;
|
||||
rv2 = pIProxyObjectManager->GetProxyObject(NS_CURRENT_EVENTQ,
|
||||
NS_GET_IID(nsIStreamLoaderObserver), observer,
|
||||
PROXY_ASYNC | PROXY_ALWAYS, getter_AddRefs(pObserver));
|
||||
if (NS_FAILED(rv2)) return rv2;
|
||||
|
||||
rv = pObserver->OnStreamComplete(this, mContext, rv, 0, nsnull);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsStreamLoader::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter) return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsStreamLoader* it = new nsStreamLoader();
|
||||
if (it == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(it);
|
||||
nsresult rv = it->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(it);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsStreamLoader, nsIStreamLoader,
|
||||
nsIStreamObserver, nsIStreamListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::GetNumBytesRead(PRUint32* aNumBytes)
|
||||
{
|
||||
if (!mData.IsEmpty()) {
|
||||
*aNumBytes = mData.Length();
|
||||
}
|
||||
else {
|
||||
*aNumBytes = 0;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::GetOwner(nsISupports** aOwner)
|
||||
{
|
||||
*aOwner = mOwner.get();
|
||||
NS_IF_ADDREF(*aOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||
nsresult status, const PRUnichar *errorMsg)
|
||||
{
|
||||
(void)channel->GetOwner(getter_AddRefs(mOwner));
|
||||
nsresult rv = mObserver->OnStreamComplete(this, mContext, status,
|
||||
mData.Length(),
|
||||
mData.GetBuffer());
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStreamLoader::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt,
|
||||
nsIInputStream *inStr,
|
||||
PRUint32 sourceOffset, PRUint32 count)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
char buffer[BUF_SIZE];
|
||||
PRUint32 len, lenRead;
|
||||
|
||||
rv = inStr->Available(&len);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
while (len > 0) {
|
||||
lenRead = PR_MIN(len, BUF_SIZE);
|
||||
rv = inStr->Read(buffer, lenRead, &lenRead);
|
||||
if (NS_FAILED(rv) || lenRead == 0) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mData.Append(buffer, lenRead);
|
||||
len -= lenRead;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
54
mozilla/netwerk/base/src/nsStreamLoader.h
Normal file
54
mozilla/netwerk/base/src/nsStreamLoader.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsStreamLoader_h__
|
||||
#define nsStreamLoader_h__
|
||||
|
||||
#include "nsIStreamLoader.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsStreamLoader : public nsIStreamLoader,
|
||||
public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTREAMLOADER
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
nsStreamLoader() { NS_INIT_REFCNT();} ;
|
||||
virtual ~nsStreamLoader() {};
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIStreamLoaderObserver> mObserver;
|
||||
nsCOMPtr<nsISupports> mContext; // the observer's context
|
||||
nsCString mData;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
/// nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
};
|
||||
|
||||
#endif // nsStreamLoader_h__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user