Compare commits
2060 Commits
src
...
tags/WHH-6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7686eebad | ||
|
|
8ebb857660 | ||
|
|
d9766367d5 | ||
|
|
927b24dc40 | ||
|
|
a1126bff88 | ||
|
|
f89f2a350d | ||
|
|
7883b5d2a2 | ||
|
|
9972377ad2 | ||
|
|
daf6861e60 | ||
|
|
eca7a6ae1e | ||
|
|
0016d15c84 | ||
|
|
06481dcaab | ||
|
|
4a73019098 | ||
|
|
8565f8d329 | ||
|
|
11f082290c | ||
|
|
bb00cb0945 | ||
|
|
e621136f16 | ||
|
|
ee3621104d | ||
|
|
fce56036f0 | ||
|
|
d3663c46e3 | ||
|
|
a4f314b7ff | ||
|
|
b00e37509d | ||
|
|
3243f56af3 | ||
|
|
a946fddf22 | ||
|
|
fcc87d468e | ||
|
|
a40b125986 | ||
|
|
f5545d55c1 | ||
|
|
9cc8c710fd | ||
|
|
e9da222324 | ||
|
|
3da4ad9be3 | ||
|
|
c063552f59 | ||
|
|
bf6586b554 | ||
|
|
89b2ecc807 | ||
|
|
5691564e80 | ||
|
|
8c6130f264 | ||
|
|
3c230ce015 | ||
|
|
eb2017c427 | ||
|
|
9faa9cb223 | ||
|
|
76630b14c1 | ||
|
|
1f099440ac | ||
|
|
b955f8f621 | ||
|
|
a92a6d3b89 | ||
|
|
253c1dcf34 | ||
|
|
7b33bcaa8e | ||
|
|
e3ad6958f9 | ||
|
|
2915043876 | ||
|
|
ae3e96aa5e | ||
|
|
5a4b85ed88 | ||
|
|
063677e6e9 | ||
|
|
4fc3ad4e08 | ||
|
|
57eaa41a12 | ||
|
|
f348dd8ed2 | ||
|
|
a910491319 | ||
|
|
ab08e086d4 | ||
|
|
29d756c2f5 | ||
|
|
53026171ea | ||
|
|
9d49b0ba5e | ||
|
|
fab90f1e90 | ||
|
|
0003b6a218 | ||
|
|
c44cbc1fa7 | ||
|
|
22c674eb88 | ||
|
|
487055f223 | ||
|
|
9de8beddf7 | ||
|
|
34263a8ca6 | ||
|
|
d983fb8d2e | ||
|
|
d852045e1f | ||
|
|
8fd6a9796d | ||
|
|
a84649ba07 | ||
|
|
1b33a49066 | ||
|
|
ba3ef45bce | ||
|
|
2ebf347236 | ||
|
|
00d6da8b0d | ||
|
|
50606b8e34 | ||
|
|
b798ce46a3 | ||
|
|
e413aafe07 | ||
|
|
f3fe6c6d13 | ||
|
|
8f551f726b | ||
|
|
e5616ebbdb | ||
|
|
b103483ab5 | ||
|
|
a248ada3dd | ||
|
|
fd02c25f8b | ||
|
|
18957e4484 | ||
|
|
9c2c527f01 | ||
|
|
e19ef83fb5 | ||
|
|
39691919cd | ||
|
|
34c398fd4f | ||
|
|
a59404197c | ||
|
|
9d8448f9db | ||
|
|
1bbd739131 | ||
|
|
3ec32b01ec | ||
|
|
8bc32bab29 | ||
|
|
3e326c02c9 | ||
|
|
0f43ffca1d | ||
|
|
bb778ecb1f | ||
|
|
6d043a28a5 | ||
|
|
a86f4802a3 | ||
|
|
5770b2f9a6 | ||
|
|
262c024b61 | ||
|
|
994f4f4c20 | ||
|
|
cf8d4effe1 | ||
|
|
bd7b75801d | ||
|
|
dab091fda9 | ||
|
|
ac36a93d5a | ||
|
|
1659b03f62 | ||
|
|
f278c932b4 | ||
|
|
056b8eb71d | ||
|
|
c5e85cb531 | ||
|
|
07ce5cf20b | ||
|
|
14abd86023 | ||
|
|
e4854bd257 | ||
|
|
dba13afe57 | ||
|
|
b49938cfcc | ||
|
|
34329cf783 | ||
|
|
9c97726dbc | ||
|
|
31a6da33c0 | ||
|
|
0e7aa68bd8 | ||
|
|
ed8ac7c79c | ||
|
|
545ded29f5 | ||
|
|
d908baf252 | ||
|
|
72661a376b | ||
|
|
9c842315ec | ||
|
|
3512f5a5f9 | ||
|
|
7ff45ac8f5 | ||
|
|
1ce5a1bf28 | ||
|
|
1c53aaec59 | ||
|
|
05c4a4b604 | ||
|
|
1e068fe4e0 | ||
|
|
80638fa053 | ||
|
|
5301f90f8b | ||
|
|
203c0c7631 | ||
|
|
6b475c686a | ||
|
|
ca6c1a3d36 | ||
|
|
0af1f8f6d1 | ||
|
|
43674ab48e | ||
|
|
c24a0ef0ee | ||
|
|
b670993976 | ||
|
|
6ea8276e99 | ||
|
|
e481f068c2 | ||
|
|
c4d1ac9b9b | ||
|
|
7f4b857914 | ||
|
|
fcac155fcb | ||
|
|
9314e8c0fd | ||
|
|
43e3606d63 | ||
|
|
1da755d932 | ||
|
|
4932cde3cf | ||
|
|
b0ed737d4e | ||
|
|
f839256ffb | ||
|
|
6cb3c62ff9 | ||
|
|
003486244b | ||
|
|
b3ec99f296 | ||
|
|
ff5039c9f6 | ||
|
|
1221ac1cc0 | ||
|
|
1fafa621b4 | ||
|
|
480d812687 | ||
|
|
285d776c21 | ||
|
|
bf790334ec | ||
|
|
9abea099f4 | ||
|
|
4e612f7bce | ||
|
|
9081dcee74 | ||
|
|
85e0830ca5 | ||
|
|
1a6de599ba | ||
|
|
43b859ff7b | ||
|
|
549f5a4fe6 | ||
|
|
7f1d1f85e8 | ||
|
|
725e1658f7 | ||
|
|
6b5779bcf8 | ||
|
|
6ee73b8ff9 | ||
|
|
8b1ee7529d | ||
|
|
1784850441 | ||
|
|
fb779f6f02 | ||
|
|
65ae0724c3 | ||
|
|
de04424f72 | ||
|
|
76338689e7 | ||
|
|
c94ea9d669 | ||
|
|
99e28f20cf | ||
|
|
4f9901c5fe | ||
|
|
f643d8223c | ||
|
|
12bd64e970 | ||
|
|
3c715fd75b | ||
|
|
c3b3f2fb2f | ||
|
|
488588081e | ||
|
|
1b72cfee5b | ||
|
|
cdc6027941 | ||
|
|
aface37a9e | ||
|
|
dcf90fba85 | ||
|
|
6d767e7900 | ||
|
|
9fea56b5f8 | ||
|
|
daeb84e9fe | ||
|
|
cac896e871 | ||
|
|
0143851e83 | ||
|
|
a72551e11b | ||
|
|
48590ea9b6 | ||
|
|
b01d95c15d | ||
|
|
6433e00bb3 | ||
|
|
b9c9cc95a1 | ||
|
|
d862ba14f3 | ||
|
|
e5880c8aa6 | ||
|
|
7d86f7a5e9 | ||
|
|
e5c0d34d91 | ||
|
|
b911cdf0ae | ||
|
|
bf550f5348 | ||
|
|
3a94d4f0be | ||
|
|
86b169912d | ||
|
|
f46902fa6b | ||
|
|
7f042a583d | ||
|
|
0ad5ad4b4b | ||
|
|
ff6ad9e181 | ||
|
|
111a3af6d6 | ||
|
|
8154b700e1 | ||
|
|
a9a778be57 | ||
|
|
362a835691 | ||
|
|
dd250dc838 | ||
|
|
99bc4ff232 | ||
|
|
f4ec91d3ec | ||
|
|
aba7d2a324 | ||
|
|
6889524375 | ||
|
|
1cc9deab39 | ||
|
|
955ffba2a9 | ||
|
|
cd06b36af7 | ||
|
|
f4816602ee | ||
|
|
e5fe173125 | ||
|
|
15d3d4ef10 | ||
|
|
767d4f61b3 | ||
|
|
632800454c | ||
|
|
e7840a0ada | ||
|
|
ec8fd288c2 | ||
|
|
4f64ef995b | ||
|
|
b28116e9b0 | ||
|
|
c8118dee3e | ||
|
|
936c5ca3d7 | ||
|
|
1278260f3c | ||
|
|
7fd43d6316 | ||
|
|
abd1750bd2 | ||
|
|
ad66b78a7f | ||
|
|
629185ee2a | ||
|
|
551717687a | ||
|
|
ab994e28c8 | ||
|
|
0a8ec439ba | ||
|
|
efff0ea4f1 | ||
|
|
de3211f6d6 | ||
|
|
a3de261c42 | ||
|
|
7d9456c22e | ||
|
|
1ebf77ee79 | ||
|
|
ecfb2ed35b | ||
|
|
346f6ea4e8 | ||
|
|
6d203047f2 | ||
|
|
aa13f89293 | ||
|
|
619bc2db1d | ||
|
|
8258d8059c | ||
|
|
7f2ab75e9b | ||
|
|
604c92205e | ||
|
|
b24409e014 | ||
|
|
17a3cc4628 | ||
|
|
d7d1246bf2 | ||
|
|
08a46b7c92 | ||
|
|
7c6f901d03 | ||
|
|
7db8a03581 | ||
|
|
01652fd586 | ||
|
|
3c2f155cb4 | ||
|
|
d33f176f98 | ||
|
|
5e0305dc22 | ||
|
|
487e3ebceb | ||
|
|
06b2eb17f9 | ||
|
|
ed352aa541 | ||
|
|
23025c4b77 | ||
|
|
494308738b | ||
|
|
0c7b20876a | ||
|
|
b9b1d37baa | ||
|
|
a356eafdaa | ||
|
|
229f3ae1ff | ||
|
|
b595db6509 | ||
|
|
d187228592 | ||
|
|
f27330cb72 | ||
|
|
8fe0901f17 | ||
|
|
b018cf10ce | ||
|
|
6e6f661619 | ||
|
|
c4cdce5bfc | ||
|
|
7506dbb643 | ||
|
|
98bf47bfd6 | ||
|
|
245bf1d96e | ||
|
|
80023948c4 | ||
|
|
82ed772c77 | ||
|
|
a5ae9d3197 | ||
|
|
1e5929f8fa | ||
|
|
47b1e6f67f | ||
|
|
e12a8361e4 | ||
|
|
33bd604dc3 | ||
|
|
7a16600f50 | ||
|
|
e0616d471d | ||
|
|
4070a8ae6d | ||
|
|
f6aa6e376b | ||
|
|
9e5a50f9b5 | ||
|
|
9e9f61c249 | ||
|
|
42c5df2c1b | ||
|
|
0ede68b054 | ||
|
|
fc2be00a11 | ||
|
|
ad879aac73 | ||
|
|
dbc99486c1 | ||
|
|
a2c7181b37 | ||
|
|
728f632f68 | ||
|
|
4a9ad9e17e | ||
|
|
0dec58089e | ||
|
|
da58e766e1 | ||
|
|
ea63443208 | ||
|
|
9f05c83fb9 | ||
|
|
69449663c2 | ||
|
|
24b6e72c12 | ||
|
|
0b5d36e888 | ||
|
|
61576acec0 | ||
|
|
1d7008c9a1 | ||
|
|
8450083be8 | ||
|
|
0f4f0817ff | ||
|
|
865b17ff04 | ||
|
|
023eb2dd77 | ||
|
|
dcc4eb02da | ||
|
|
42dab97dc9 | ||
|
|
c94a71dbb9 | ||
|
|
c367066727 | ||
|
|
5a2807f3a0 | ||
|
|
02fc3ead24 | ||
|
|
9ac574ec89 | ||
|
|
24dd9edced | ||
|
|
b996c1fe1b | ||
|
|
2fed9e535c | ||
|
|
5d2b212757 | ||
|
|
171e4f9689 | ||
|
|
f6e93b5e44 | ||
|
|
55f7a45355 | ||
|
|
5de58f08ab | ||
|
|
1a7d105d8d | ||
|
|
875ea9b499 | ||
|
|
f959eb5d1b | ||
|
|
31c384cdf8 | ||
|
|
88a6f93e78 | ||
|
|
4964d69d07 | ||
|
|
54664adf4e | ||
|
|
a94ba34321 | ||
|
|
82b6f8f370 | ||
|
|
802236a201 | ||
|
|
c67c7c66b8 | ||
|
|
e11f39047b | ||
|
|
be46092e74 | ||
|
|
44c9798e7c | ||
|
|
ea88e50957 | ||
|
|
babaad9c18 | ||
|
|
b29b58e27b | ||
|
|
c2b67434da | ||
|
|
fc33fc3474 | ||
|
|
ae3420fb17 | ||
|
|
7522dc5bb4 | ||
|
|
e49b19a538 | ||
|
|
2f50472c00 | ||
|
|
88283344c4 | ||
|
|
762729d03b | ||
|
|
d0fddb49f8 | ||
|
|
bfc8154d7d | ||
|
|
48791d631e | ||
|
|
78a4313ef0 | ||
|
|
5acfa76172 | ||
|
|
458004adb3 | ||
|
|
d05da63300 | ||
|
|
44dd0a04bd | ||
|
|
c3453e4f35 | ||
|
|
0b9d193a00 | ||
|
|
04e4d15221 | ||
|
|
64aa772a58 | ||
|
|
da190bcd66 | ||
|
|
82c9e7225a | ||
|
|
ba3297bfed | ||
|
|
eb90ef2c8a | ||
|
|
8b5a5bc0d9 | ||
|
|
1721617943 | ||
|
|
1e96c5e167 | ||
|
|
353309812c | ||
|
|
e340b53e30 | ||
|
|
092f276537 | ||
|
|
9bd79920cc | ||
|
|
baeb3ea890 | ||
|
|
11d23ef644 | ||
|
|
cf6795d693 | ||
|
|
593e7ef293 | ||
|
|
29e6fa110d | ||
|
|
eb7e1a1ec1 | ||
|
|
0c1ba60273 | ||
|
|
f2e6c8d4de | ||
|
|
7325d54d58 | ||
|
|
b2ed125d6e | ||
|
|
7cbe853773 | ||
|
|
0a96edf3cb | ||
|
|
64e43d4fee | ||
|
|
05116a2914 | ||
|
|
ab933eb087 | ||
|
|
7e5a37fddc | ||
|
|
da5a1f912c | ||
|
|
b2485f0c47 | ||
|
|
8ca5588a22 | ||
|
|
548a10029e | ||
|
|
f5e5ff2fe2 | ||
|
|
265453b5a7 | ||
|
|
67b4b2ccc8 | ||
|
|
0e15eff54e | ||
|
|
2f0909d91e | ||
|
|
f5f92fe30e | ||
|
|
07f8f36a84 | ||
|
|
cc65384092 | ||
|
|
7c1443cdd0 | ||
|
|
678fa54119 | ||
|
|
3008a4f872 | ||
|
|
febafd9e44 | ||
|
|
5ff037aa9e | ||
|
|
68a4a1e8e1 | ||
|
|
823e0fcb39 | ||
|
|
449c08cbfa | ||
|
|
5e982a0832 | ||
|
|
c09a0a2dd8 | ||
|
|
1f35ff9acd | ||
|
|
228c4d1aef | ||
|
|
a5d51bf47d | ||
|
|
4f17293d1a | ||
|
|
044d4d3556 | ||
|
|
6e7a02d30b | ||
|
|
b95b589d49 | ||
|
|
33f5fa6cb0 | ||
|
|
f2d254d1bd | ||
|
|
8c03177cde | ||
|
|
d35239d364 | ||
|
|
3fecdf8813 | ||
|
|
b0d6138e47 | ||
|
|
7a3806e659 | ||
|
|
e83567c0f1 | ||
|
|
167d4bc642 | ||
|
|
752bdba383 | ||
|
|
447eb03126 | ||
|
|
1b13b0f841 | ||
|
|
b98a4b3425 | ||
|
|
0fd8424124 | ||
|
|
b0f5c6fefe | ||
|
|
7bf867f8e8 | ||
|
|
5cacc78db3 | ||
|
|
c12062ec71 | ||
|
|
ee0ad1d392 | ||
|
|
7a434edbb3 | ||
|
|
1e824d81bc | ||
|
|
56837741f7 | ||
|
|
61e2cc35f8 | ||
|
|
ae46c37f43 | ||
|
|
68ed891b0f | ||
|
|
d4d748d801 | ||
|
|
fdffe24292 | ||
|
|
8583ae8b7d | ||
|
|
7d9a2e947d | ||
|
|
7ec1fd3f8b | ||
|
|
88922114e0 | ||
|
|
b91d25c962 | ||
|
|
45bd135183 | ||
|
|
0eb2d25a55 | ||
|
|
b5540991c3 | ||
|
|
26c8590a2b | ||
|
|
c16321300c | ||
|
|
a6224ff4c3 | ||
|
|
bada5688fd | ||
|
|
b7844aad20 | ||
|
|
9ff1127f25 | ||
|
|
8273c8bced | ||
|
|
26b14e1548 | ||
|
|
3c147e85aa | ||
|
|
f2395ad7bf | ||
|
|
330d5159f4 | ||
|
|
d3e870d992 | ||
|
|
5a325382c8 | ||
|
|
b720dccaeb | ||
|
|
d3e57ed0c9 | ||
|
|
2285a919a0 | ||
|
|
dd2c0b7fd4 | ||
|
|
5b1e30c2d8 | ||
|
|
83bd1d2db2 | ||
|
|
18e1eab082 | ||
|
|
75b59e64ac | ||
|
|
f8e8a60864 | ||
|
|
a48894abaf | ||
|
|
96c9d37399 | ||
|
|
57e6c8e9b2 | ||
|
|
3c20bcb00f | ||
|
|
14a2270e1c | ||
|
|
e9933eba30 | ||
|
|
fa083d6e2a | ||
|
|
479be36988 | ||
|
|
546d03c21a | ||
|
|
3b8a6cc841 | ||
|
|
9c6cbaff82 | ||
|
|
1c9d68fcb2 | ||
|
|
810c303a52 | ||
|
|
9d72b542eb | ||
|
|
d0e35f79c5 | ||
|
|
c26865436d | ||
|
|
eace9f2cd3 | ||
|
|
ff1427278d | ||
|
|
7e47cd0829 | ||
|
|
13af06acae | ||
|
|
3c9ca436f3 | ||
|
|
c74a5a88b4 | ||
|
|
f9b8092054 | ||
|
|
ab2f4d08b2 | ||
|
|
606d7774a4 | ||
|
|
8e3a860ed7 | ||
|
|
39a0ff2bde | ||
|
|
ede67127dc | ||
|
|
e0e4bffb67 | ||
|
|
2ec00ce50f | ||
|
|
2ce886b9fe | ||
|
|
e068d78c95 | ||
|
|
c2465637b3 | ||
|
|
611aedf097 | ||
|
|
257dd26c58 | ||
|
|
119c6c4a82 | ||
|
|
6bbdbf71b6 | ||
|
|
48b0222d5d | ||
|
|
df34a26f31 | ||
|
|
ec710c89b2 | ||
|
|
cfcf136257 | ||
|
|
d56278b0bd | ||
|
|
897f278d3d | ||
|
|
d1f5db2195 | ||
|
|
4a352f4269 | ||
|
|
5e4ac05bb8 | ||
|
|
45b77f8744 | ||
|
|
23594e80f4 | ||
|
|
3b9be65438 | ||
|
|
7b0e5aeeda | ||
|
|
91b047854d | ||
|
|
d320ba1de8 | ||
|
|
cb3ce29e0b | ||
|
|
0619184fed | ||
|
|
61370baba7 | ||
|
|
3c239c8b1a | ||
|
|
6bc9c37235 | ||
|
|
7a44de9e4e | ||
|
|
2ed23c55c0 | ||
|
|
31defc43b0 | ||
|
|
3035417772 | ||
|
|
9ec09955af | ||
|
|
54b85a6eeb | ||
|
|
547a56c0e5 | ||
|
|
48e3773fb4 | ||
|
|
56f053a605 | ||
|
|
2df6c9fa5c | ||
|
|
378b503e34 | ||
|
|
547167bb7c | ||
|
|
6eaeee69dd | ||
|
|
beb5583b23 | ||
|
|
1be1c85f5b | ||
|
|
061e0a72af | ||
|
|
7d58679f65 | ||
|
|
d4925d7a68 | ||
|
|
eb380feb54 | ||
|
|
c5a84d91e8 | ||
|
|
a7e8033a85 | ||
|
|
478e7c417a | ||
|
|
293ea440fe | ||
|
|
1de3516033 | ||
|
|
b68b57c213 | ||
|
|
a14c604b99 | ||
|
|
39549a02b1 | ||
|
|
8b557774b7 | ||
|
|
7151575972 | ||
|
|
6d53c488b5 | ||
|
|
10005f91eb | ||
|
|
dc57448f3a | ||
|
|
266bdeb26b | ||
|
|
7d683638d7 | ||
|
|
45f901db00 | ||
|
|
99038ad54d | ||
|
|
fec604c3ef | ||
|
|
caec41a883 | ||
|
|
2d17ff5ace | ||
|
|
b8d8e91a46 | ||
|
|
b8353f02b7 | ||
|
|
feed155138 | ||
|
|
133c9a6fb2 | ||
|
|
e6362da180 | ||
|
|
ff9f954cba | ||
|
|
be3aed93b1 | ||
|
|
e9e6473499 | ||
|
|
ded043986c | ||
|
|
ebfd198db2 | ||
|
|
e16e9c75be | ||
|
|
186eacb62f | ||
|
|
4082dcf7d6 | ||
|
|
e13c6913c1 | ||
|
|
84161663ef | ||
|
|
5fa77fef77 | ||
|
|
9a352b81fd | ||
|
|
d4db300cba | ||
|
|
aba6216161 | ||
|
|
a300a2fa69 | ||
|
|
c065ac8c9c | ||
|
|
1d15736fc8 | ||
|
|
d044bd2640 | ||
|
|
ff70cb0460 | ||
|
|
5c4a619463 | ||
|
|
c15b5f2c86 | ||
|
|
16cfc2fcf3 | ||
|
|
137476cbfb | ||
|
|
e03cefd7c7 | ||
|
|
38bb3e3ed2 | ||
|
|
5704751b88 | ||
|
|
7876dc239b | ||
|
|
47d69e47b5 | ||
|
|
62a6ee8570 | ||
|
|
71b813e43c | ||
|
|
544d8d9cef | ||
|
|
fcc1f4f5cb | ||
|
|
cf41488e53 | ||
|
|
a0bf3fbecd | ||
|
|
7d84137a79 | ||
|
|
2960acc2b6 | ||
|
|
887ac00407 | ||
|
|
2f35eadb9b | ||
|
|
078256dba8 | ||
|
|
8e7082b3aa | ||
|
|
e2c320e27d | ||
|
|
7a84203930 | ||
|
|
7ea32ee2c4 | ||
|
|
c28700cf2d | ||
|
|
ad7eb2da6d | ||
|
|
3bed02e2d0 | ||
|
|
887db136b0 | ||
|
|
0e4268630c | ||
|
|
b3fa226dff | ||
|
|
5a7cb82de1 | ||
|
|
3aa1b2e565 | ||
|
|
280ce3deb8 | ||
|
|
32033e0a82 | ||
|
|
e0745dafd7 | ||
|
|
d183933e3e | ||
|
|
e8f30d5f43 | ||
|
|
16822a2715 | ||
|
|
b0b65db96c | ||
|
|
98e80ada70 | ||
|
|
9d7270fb87 | ||
|
|
aef0c9821c | ||
|
|
16ae30744d | ||
|
|
5826a92dd7 | ||
|
|
96b698384d | ||
|
|
5d0bd2fa3d | ||
|
|
92c010d4f7 | ||
|
|
3f4d75b8c3 | ||
|
|
16b12398ad | ||
|
|
6d5a0b4004 | ||
|
|
824db2e9b4 | ||
|
|
0bae0c1a04 | ||
|
|
08109ed280 | ||
|
|
58fc1493f9 | ||
|
|
c009860f8f | ||
|
|
4ac61e25d3 | ||
|
|
55d85cf2d6 | ||
|
|
690b6ec969 | ||
|
|
b1232288a8 | ||
|
|
ece5c35801 | ||
|
|
ade032357b | ||
|
|
d80b856b2b | ||
|
|
8120857730 | ||
|
|
85a9783e7a | ||
|
|
9929a02b24 | ||
|
|
5e45b132b9 | ||
|
|
e4497eb7a4 | ||
|
|
3142059e02 | ||
|
|
8f094cf52a | ||
|
|
5149a29f46 | ||
|
|
3c5f4d4fc1 | ||
|
|
5f4e33d089 | ||
|
|
8c6ba6cf4e | ||
|
|
e897b52b25 | ||
|
|
795e08719f | ||
|
|
d90680d892 | ||
|
|
a7302a2c7b | ||
|
|
486a69592f | ||
|
|
3c05823443 | ||
|
|
13c3ea8078 | ||
|
|
3c69310de5 | ||
|
|
f32ee28abb | ||
|
|
593324ca66 | ||
|
|
8fc7522955 | ||
|
|
8c3e6bc3e6 | ||
|
|
ad4a86e123 | ||
|
|
aa8f2be5b5 | ||
|
|
1250df240e | ||
|
|
fb18842156 | ||
|
|
d4f390e372 | ||
|
|
99f911359a | ||
|
|
7b8faf0fff | ||
|
|
aab9750f21 | ||
|
|
0518e43e5b | ||
|
|
92c8d64f45 | ||
|
|
584ee3314f | ||
|
|
845376db4f | ||
|
|
a6064ea48f | ||
|
|
4dbc274d59 | ||
|
|
878bcdd7ad | ||
|
|
e3eef553a7 | ||
|
|
4d52292017 | ||
|
|
a64d14749a | ||
|
|
5c2c4b30e5 | ||
|
|
0143d6a3fa | ||
|
|
a450d1bfba | ||
|
|
cf0489fb83 | ||
|
|
b020694215 | ||
|
|
33fb4efaef | ||
|
|
762cc1d3ee | ||
|
|
edad965b29 | ||
|
|
e21e1c0c2f | ||
|
|
11dac7bbef | ||
|
|
d1e9762b93 | ||
|
|
91f2070891 | ||
|
|
803a0f175d | ||
|
|
589baef929 | ||
|
|
ad810909f0 | ||
|
|
192fe6b11a | ||
|
|
bf056c0f5d | ||
|
|
02e0f80d71 | ||
|
|
54296b02ac | ||
|
|
5b2039fa07 | ||
|
|
1c99019f97 | ||
|
|
5258e10cb1 | ||
|
|
c8e83135e1 | ||
|
|
0453db72f5 | ||
|
|
23a4d59c0a | ||
|
|
27bac3add4 | ||
|
|
f19ca56b72 | ||
|
|
d1bf76337e | ||
|
|
14554c98cd | ||
|
|
304d735c7e | ||
|
|
67cbb9dcf8 | ||
|
|
b077529bb9 | ||
|
|
5354fabe84 | ||
|
|
7c1bb8d6a8 | ||
|
|
70cb14677e | ||
|
|
fc93994c84 | ||
|
|
61c2a72e45 | ||
|
|
ed30adc2d7 | ||
|
|
9b5ccff7e3 | ||
|
|
e5b993dd76 | ||
|
|
d70a6d276b | ||
|
|
1c543f3a5e | ||
|
|
3070792cff | ||
|
|
8823a7e8df | ||
|
|
0e39838f57 | ||
|
|
3648ddb21c | ||
|
|
4b5583cc5b | ||
|
|
a0d76bf639 | ||
|
|
13a476a717 | ||
|
|
4be1360692 | ||
|
|
458f9dbaf6 | ||
|
|
a7a7b53d04 | ||
|
|
5bf3f0bc32 | ||
|
|
e95ac5d9c9 | ||
|
|
a294d9658a | ||
|
|
1e293abb2c | ||
|
|
0ba20d9f37 | ||
|
|
98c9c247be | ||
|
|
7a5e16657b | ||
|
|
09b1df7600 | ||
|
|
7d3b16d3ab | ||
|
|
fc2f70d298 | ||
|
|
b338b9c54d | ||
|
|
b49c227b08 | ||
|
|
38a217c93a | ||
|
|
8620f6315b | ||
|
|
cd5d9af34f | ||
|
|
9ee198ea26 | ||
|
|
81c648b8eb | ||
|
|
7f62283d43 | ||
|
|
6629bfcb04 | ||
|
|
9ac86c73cd | ||
|
|
bb10182347 | ||
|
|
1f4be17602 | ||
|
|
8ecacf5ff9 | ||
|
|
ba33e73da3 | ||
|
|
0643946696 | ||
|
|
f9e5e07768 | ||
|
|
650b890778 | ||
|
|
c06c83b299 | ||
|
|
e995e7bec0 | ||
|
|
79d2b5abd5 | ||
|
|
8fc8b5803f | ||
|
|
ea46aeb77e | ||
|
|
5496bbae3d | ||
|
|
1e6b7a34c2 | ||
|
|
32a9207366 | ||
|
|
347f675454 | ||
|
|
005c5554ca | ||
|
|
a16b45eba6 | ||
|
|
2bea8089b5 | ||
|
|
251d87362d | ||
|
|
fdc371a715 | ||
|
|
870349fc7b | ||
|
|
ec7719fef6 | ||
|
|
8b8115d8ad | ||
|
|
46fbcf1bc9 | ||
|
|
68d2cf91ea | ||
|
|
2a978ae6bd | ||
|
|
1e8a5e3015 | ||
|
|
ae5d2ae35e | ||
|
|
a85af68895 | ||
|
|
7d6e1fb81f | ||
|
|
644ab58052 | ||
|
|
394a4b9160 | ||
|
|
0d20ff493d | ||
|
|
ea17ec1289 | ||
|
|
a110a85aaa | ||
|
|
104e0c915d | ||
|
|
f0b60a4301 | ||
|
|
e9c8e018e2 | ||
|
|
f140537ba6 | ||
|
|
a672c8316c | ||
|
|
1746b524c7 | ||
|
|
d6b293d17b | ||
|
|
a6b72bcc45 | ||
|
|
823c780a87 | ||
|
|
4111ecea19 | ||
|
|
a1e8558bb9 | ||
|
|
4ce152489f | ||
|
|
93f1506365 | ||
|
|
90360081fd | ||
|
|
7feead6cde | ||
|
|
e572ff0c73 | ||
|
|
86fefbf8d3 | ||
|
|
5a6f8cbfab | ||
|
|
b8f0991e89 | ||
|
|
f6b302546a | ||
|
|
2072e2e55d | ||
|
|
e4e049e502 | ||
|
|
24458bb27e | ||
|
|
e3e3cf2a9f | ||
|
|
d1abca605f | ||
|
|
7bb2fa955d | ||
|
|
67d6e29690 | ||
|
|
180d65b855 | ||
|
|
7a50fe57f5 | ||
|
|
27fe865f17 | ||
|
|
373eefa5ee | ||
|
|
264904f68e | ||
|
|
878cad6586 | ||
|
|
5d767f7ccd | ||
|
|
c5a8dad98f | ||
|
|
a50a425d9b | ||
|
|
8390819f32 | ||
|
|
742180e73b | ||
|
|
154020439c | ||
|
|
95110c8caa | ||
|
|
749a0eca23 | ||
|
|
64ddb83767 | ||
|
|
17b8c6a58e | ||
|
|
e7d38e04ed | ||
|
|
c94bac5a24 | ||
|
|
15d3b09d55 | ||
|
|
aa9de216b9 | ||
|
|
29857082ee | ||
|
|
986c8c9ed0 | ||
|
|
c7ac1263c0 | ||
|
|
45988c086f | ||
|
|
4823ea99ad | ||
|
|
e96b64ef1f | ||
|
|
a14cf049ee | ||
|
|
9d28d69f9a | ||
|
|
d4ded7fcb4 | ||
|
|
09fbfa9c3e | ||
|
|
6b1fcf8009 | ||
|
|
9d7c000d4e | ||
|
|
14688fcbfe | ||
|
|
5e142c23f9 | ||
|
|
5a48a3a6d0 | ||
|
|
7e4b358a9e | ||
|
|
407e992f48 | ||
|
|
22b8cf7615 | ||
|
|
25b556e8bf | ||
|
|
ba23b98a81 | ||
|
|
8cd10323ee | ||
|
|
33ad8b3f41 | ||
|
|
6dda78bed8 | ||
|
|
faa5d08633 | ||
|
|
2323fc89fd | ||
|
|
1da36d7c08 | ||
|
|
1e71bfb687 | ||
|
|
c0d13f7322 | ||
|
|
c998cb5738 | ||
|
|
0f68404ed3 | ||
|
|
6fdf1db1ee | ||
|
|
5f5d573afc | ||
|
|
a1afa0e362 | ||
|
|
cfcf775019 | ||
|
|
1f1b934bb9 | ||
|
|
ff04a581e1 | ||
|
|
323629b0bf | ||
|
|
20f6884924 | ||
|
|
4a6d29e716 | ||
|
|
1b01001342 | ||
|
|
6ba2eff004 | ||
|
|
356bdb0d29 | ||
|
|
1982076de0 | ||
|
|
68a71d3ca6 | ||
|
|
a78c50d6cc | ||
|
|
84fb39f532 | ||
|
|
25a37673a3 | ||
|
|
acbc3f414b | ||
|
|
3eea2bc60e | ||
|
|
89d8dfb35e | ||
|
|
ead627bdd4 | ||
|
|
9b4c334efb | ||
|
|
2233633bb2 | ||
|
|
c80876db1d | ||
|
|
13507e9f98 | ||
|
|
15a24b995e | ||
|
|
b1e77dc6a3 | ||
|
|
957e7f0de9 | ||
|
|
bf060b62ab | ||
|
|
533e62e5ab | ||
|
|
ae1de07242 | ||
|
|
fa1a40c2e3 | ||
|
|
1f4eadfe4d | ||
|
|
2b1560421a | ||
|
|
87435a585d | ||
|
|
6d56b78e87 | ||
|
|
bf89c14459 | ||
|
|
35179bbb64 | ||
|
|
5fd75ab919 | ||
|
|
84c77414a8 | ||
|
|
e21d74eb6e | ||
|
|
511c24cd17 | ||
|
|
69918ef5ab | ||
|
|
5c0fb77eeb | ||
|
|
663c4a42c1 | ||
|
|
7c4a361bb0 | ||
|
|
0d0d1f8ebb | ||
|
|
acc02f0d74 | ||
|
|
71cf485ae8 | ||
|
|
27123daf77 | ||
|
|
de649aac98 | ||
|
|
44e7ebf5dd | ||
|
|
3e0f62ac95 | ||
|
|
c73c766cb1 | ||
|
|
5757dcaf2f | ||
|
|
891f537f8e | ||
|
|
c035592fb5 | ||
|
|
62bfd35b35 | ||
|
|
b3ecf00132 | ||
|
|
810a48e65e | ||
|
|
d81eea5f61 | ||
|
|
2cb4248bd9 | ||
|
|
cb059620b1 | ||
|
|
31f03e8a7a | ||
|
|
f8d28d310e | ||
|
|
6229edb430 | ||
|
|
f8eaf156e2 | ||
|
|
822b809174 | ||
|
|
af2b091f9a | ||
|
|
ee5df66612 | ||
|
|
7e5fed03fa | ||
|
|
0846133faf | ||
|
|
273643c438 | ||
|
|
24d54b41d8 | ||
|
|
9dee4dbd73 | ||
|
|
aafa0183ad | ||
|
|
acfdf93b87 | ||
|
|
c621d053c6 | ||
|
|
45ab5d5b13 | ||
|
|
f288e775fc | ||
|
|
2c4876217b | ||
|
|
8c0c378a37 | ||
|
|
2e045d8315 | ||
|
|
fd1e6f9ec2 | ||
|
|
199d4363fd | ||
|
|
3fdb13e2f4 | ||
|
|
4f7f2794c5 | ||
|
|
0b76a73962 | ||
|
|
b209dc74b5 | ||
|
|
4369ac38be | ||
|
|
45b16a8baf | ||
|
|
6bda33f40e | ||
|
|
b66e35f9d6 | ||
|
|
5d64000a40 | ||
|
|
a15bfc2588 | ||
|
|
490b197f4a | ||
|
|
4e86df49a1 | ||
|
|
c1ef30a561 | ||
|
|
0e36b2aa60 | ||
|
|
16ec1828f5 | ||
|
|
22fdffeab1 | ||
|
|
5bc13cc1cc | ||
|
|
328c9c6999 | ||
|
|
19c17d1d6a | ||
|
|
57d9268011 | ||
|
|
42ab29c131 | ||
|
|
1a4f197fa7 | ||
|
|
6905e258db | ||
|
|
fca2426bc3 | ||
|
|
e29b721cf7 | ||
|
|
d36d5053b7 | ||
|
|
64b16e4168 | ||
|
|
7b94de64b6 | ||
|
|
0cfef23aaa | ||
|
|
842f16e8a0 | ||
|
|
8997c2364f | ||
|
|
40f9b76016 | ||
|
|
68a3a5bc2f | ||
|
|
637446e2bc | ||
|
|
f1300adcbe | ||
|
|
772a460bd4 | ||
|
|
5f4bba2ae5 | ||
|
|
8e360f9516 | ||
|
|
61b4a19b82 | ||
|
|
48ebbb6439 | ||
|
|
e1f4704793 | ||
|
|
a58ff3889b | ||
|
|
8d2476ca0e | ||
|
|
185ba1e56a | ||
|
|
e30570a54f | ||
|
|
42762abad9 | ||
|
|
f8dddcae9c | ||
|
|
6ea6adbcc2 | ||
|
|
dd310396c9 | ||
|
|
6f1a3ec464 | ||
|
|
5c55f8281f | ||
|
|
154dca77cb | ||
|
|
44280723a0 | ||
|
|
2bc61c5523 | ||
|
|
1f1d370348 | ||
|
|
f01f4d4177 | ||
|
|
b3b2492e39 | ||
|
|
aa460cdfdb | ||
|
|
68e7778cb1 | ||
|
|
ea74392715 | ||
|
|
bf39d98a64 | ||
|
|
7ece6b4552 | ||
|
|
503c346630 | ||
|
|
17cd7246b8 | ||
|
|
9899611910 | ||
|
|
1eafb358d4 | ||
|
|
26bab3f988 | ||
|
|
0e1b8c7aad | ||
|
|
5db9ab231b | ||
|
|
8959bd9a9f | ||
|
|
5a9be56e76 | ||
|
|
0cdd42f7e4 | ||
|
|
fa95e6aa23 | ||
|
|
35b452e6bd | ||
|
|
c56e10044b | ||
|
|
1ca7ce2b8d | ||
|
|
2b92caea80 | ||
|
|
8069f262bb | ||
|
|
f6d643c709 | ||
|
|
0b4a10a109 | ||
|
|
eb58989f6b | ||
|
|
a9b121ca89 | ||
|
|
5db8306557 | ||
|
|
2fdd8a3e81 | ||
|
|
c876f21ef3 | ||
|
|
f8e87704a2 | ||
|
|
56c5880014 | ||
|
|
7462438cbe | ||
|
|
a3fb3e7196 | ||
|
|
144f073c62 | ||
|
|
45ed3c204e | ||
|
|
6465965ac8 | ||
|
|
2900f3eb31 | ||
|
|
89ffb93ec5 | ||
|
|
52869d557a | ||
|
|
5324b574d3 | ||
|
|
085672396d | ||
|
|
ad623a0b59 | ||
|
|
15bff55a66 | ||
|
|
21ad463edf | ||
|
|
699b88c3e1 | ||
|
|
f5f3627aff | ||
|
|
3decfd668d | ||
|
|
1d24b7f8c3 | ||
|
|
29dc256a4f | ||
|
|
d1906eec9a | ||
|
|
f1e024f67f | ||
|
|
b22bd6219d | ||
|
|
b1b4ed9c0c | ||
|
|
330ce1a68a | ||
|
|
1e231ecd86 | ||
|
|
bb05876536 | ||
|
|
b2a2c02eac | ||
|
|
a5d081eae5 | ||
|
|
2dc6f4fa0f | ||
|
|
d10cf0b444 | ||
|
|
ce27e666ad | ||
|
|
fdc23ccb1b | ||
|
|
4f0476dd20 | ||
|
|
643ea17272 | ||
|
|
a921fca398 | ||
|
|
91f72d1f82 | ||
|
|
7d34375077 | ||
|
|
8650f1059b | ||
|
|
26b26b4ab0 | ||
|
|
ca2a634d97 | ||
|
|
21a15def92 | ||
|
|
4062735a01 | ||
|
|
73afde7b71 | ||
|
|
684bb08a8d | ||
|
|
3554e0b087 | ||
|
|
976a72c833 | ||
|
|
c7ff7ab896 | ||
|
|
a1b1cb2963 | ||
|
|
11829db7ca | ||
|
|
3c226bb99f | ||
|
|
b8adaad7e3 | ||
|
|
0de862590b | ||
|
|
140dd409d2 | ||
|
|
71bfb9d7d8 | ||
|
|
e35d7746b7 | ||
|
|
aea528655a | ||
|
|
915a67d0c4 | ||
|
|
85e947383a | ||
|
|
6c7fbe0271 | ||
|
|
9ce368c9e1 | ||
|
|
a1a83a4ea7 | ||
|
|
c7f5e5d0c9 | ||
|
|
1bde299d6f | ||
|
|
50600ebfb0 | ||
|
|
de4ae79cf3 | ||
|
|
945fc61529 | ||
|
|
de84938fce | ||
|
|
29d7d10d5b | ||
|
|
db8176ecc1 | ||
|
|
87f40affc1 | ||
|
|
9dec3904ca | ||
|
|
e7eb31ad48 | ||
|
|
25d0cce0ca | ||
|
|
c7689ec171 | ||
|
|
d4bf0bf877 | ||
|
|
aa6822fa14 | ||
|
|
9c2b61909b | ||
|
|
f769e571e4 | ||
|
|
274ee6d1a2 | ||
|
|
3b73f6690e | ||
|
|
164bf71469 | ||
|
|
2a0d18cf41 | ||
|
|
b5568edd02 | ||
|
|
b0442d0ce8 | ||
|
|
2acb7fb2aa | ||
|
|
e8fe0cf3c4 | ||
|
|
9096a6f51c | ||
|
|
827f1e3b3f | ||
|
|
c7e1211fb1 | ||
|
|
76cabb03d3 | ||
|
|
8723410029 | ||
|
|
e95c0a1e71 | ||
|
|
786e0eb5ce | ||
|
|
ae16bfb2d8 | ||
|
|
29a200f6f3 | ||
|
|
510168afe3 | ||
|
|
f27ffb8efc | ||
|
|
89a37950cc | ||
|
|
65dff35e1e | ||
|
|
c2956c6b83 | ||
|
|
b32f67a8a9 | ||
|
|
0d88744fb8 | ||
|
|
177f37d06f | ||
|
|
4dbdaef4cf | ||
|
|
0b8541733b | ||
|
|
bdc1298557 | ||
|
|
f7f8d0f24e | ||
|
|
7f52ade062 | ||
|
|
df059bed47 | ||
|
|
0913b8ef91 | ||
|
|
bd8c71d3d0 | ||
|
|
4dbbd3e8c7 | ||
|
|
68d8d61fec | ||
|
|
4c99a1649d | ||
|
|
a56e7c62ac | ||
|
|
f7d2222f18 | ||
|
|
0c076004c8 | ||
|
|
bf9b5f28c1 | ||
|
|
9465779a16 | ||
|
|
8e2b932b12 | ||
|
|
6d72b15356 | ||
|
|
a9ba7b2cdd | ||
|
|
d59e2a9e54 | ||
|
|
ee41abd1a8 | ||
|
|
207c218a16 | ||
|
|
9980d10c96 | ||
|
|
e0af9c3bb9 | ||
|
|
1827bdff68 | ||
|
|
691ead1e2f | ||
|
|
f6a998a901 | ||
|
|
9c6c376512 | ||
|
|
9af17368af | ||
|
|
c3780a7ecb | ||
|
|
a583b6d8e4 | ||
|
|
61b5c92698 | ||
|
|
55c8ea8e59 | ||
|
|
16daf5e57c | ||
|
|
7b74874945 | ||
|
|
9fab568c18 | ||
|
|
7319ebd433 | ||
|
|
2394f4f4a9 | ||
|
|
30f70faf68 | ||
|
|
51ef58fbae | ||
|
|
c1080e7459 | ||
|
|
9c3d2350ea | ||
|
|
ac23eae97a | ||
|
|
900de8bfd5 | ||
|
|
aacdb6f80f | ||
|
|
bc23621d00 | ||
|
|
0260f0de34 | ||
|
|
6946d5cf8b | ||
|
|
f4ec424590 | ||
|
|
cefc7c0917 | ||
|
|
8aa7ef3e42 | ||
|
|
c3d6c39406 | ||
|
|
e3bdb359ea | ||
|
|
22ae5f4890 | ||
|
|
0d6ce1ad8c | ||
|
|
a56404d38e | ||
|
|
4e26d7b668 | ||
|
|
007a26d085 | ||
|
|
7cb420c2c1 | ||
|
|
e69948ccbb | ||
|
|
af3775cbc9 | ||
|
|
78555a50e8 | ||
|
|
0193878767 | ||
|
|
71cdad332b | ||
|
|
16260c15d6 | ||
|
|
4edfa78bd0 | ||
|
|
55fea45ed8 | ||
|
|
ec98adf0d2 | ||
|
|
c9e25b38a8 | ||
|
|
902bb9b25e | ||
|
|
753c50eb70 | ||
|
|
e6aed221a9 | ||
|
|
e8e07b6461 | ||
|
|
41100bb362 | ||
|
|
4d4340aa36 | ||
|
|
05dbc4f660 | ||
|
|
088a2c2da9 | ||
|
|
5b63d649f7 | ||
|
|
54626dd29f | ||
|
|
3bb77e930d | ||
|
|
125fa1898a | ||
|
|
544c2d7b04 | ||
|
|
02f7c40f1a | ||
|
|
f9d06510a0 | ||
|
|
b6e4528902 | ||
|
|
2cace3b020 | ||
|
|
c373864370 | ||
|
|
a516c9660b | ||
|
|
954322bbde | ||
|
|
8ebb55a444 | ||
|
|
a406af3879 | ||
|
|
7ec609c4ed | ||
|
|
a0e3953a87 | ||
|
|
d980ad10cf | ||
|
|
093f16cf4e | ||
|
|
8478385a66 | ||
|
|
533bb1d574 | ||
|
|
910d64f269 | ||
|
|
748a144747 | ||
|
|
a4901508aa | ||
|
|
29694ff3f4 | ||
|
|
cae1f83a53 | ||
|
|
24d077ce8a | ||
|
|
785ce7670b | ||
|
|
972f33b580 | ||
|
|
5c986abf57 | ||
|
|
a33b33f71f | ||
|
|
dd36038d2d | ||
|
|
a1b6551e73 | ||
|
|
e006b4b058 | ||
|
|
2988c8bcbb | ||
|
|
445df872a7 | ||
|
|
dccdd615d3 | ||
|
|
2b7f6ba4fb | ||
|
|
86de352d6a | ||
|
|
6cc072bdd8 | ||
|
|
9cba895395 | ||
|
|
a7a5e1a496 | ||
|
|
94e5aabc39 | ||
|
|
21de2e9959 | ||
|
|
35928d7fde | ||
|
|
13161996b7 | ||
|
|
1500892775 | ||
|
|
b9a5a999cb | ||
|
|
a4c96eb91a | ||
|
|
03943f1585 | ||
|
|
596814c9b4 | ||
|
|
30bbac4481 | ||
|
|
31de283bea | ||
|
|
6f521027d4 | ||
|
|
77b4440471 | ||
|
|
d13afcc15a | ||
|
|
d1f07ef339 | ||
|
|
a334563929 | ||
|
|
7dd5543dda | ||
|
|
725b2f99ce | ||
|
|
370efa8a1d | ||
|
|
cabff886d3 | ||
|
|
4ecbd9dacb | ||
|
|
771acb9497 | ||
|
|
55cfe73afc | ||
|
|
082ba71455 | ||
|
|
48c664666b | ||
|
|
58c89f189a | ||
|
|
91b099c77c | ||
|
|
ecc03beffb | ||
|
|
1c95641985 | ||
|
|
67fc1e3129 | ||
|
|
77295483a3 | ||
|
|
965b29cd14 | ||
|
|
f8346bb575 | ||
|
|
fbe83f8adc | ||
|
|
6cd3181afe | ||
|
|
32a2989a04 | ||
|
|
074e50bb58 | ||
|
|
ed61bcca4d | ||
|
|
444754f752 | ||
|
|
83a809c62a | ||
|
|
78c3d043eb | ||
|
|
82f918aa99 | ||
|
|
adb0d9b5f1 | ||
|
|
efa71cc9a7 | ||
|
|
74fbbc42b1 | ||
|
|
041dc1ae54 | ||
|
|
ad4c790544 | ||
|
|
b0df24e48c | ||
|
|
9b2e86a5c3 | ||
|
|
d0c8de6da2 | ||
|
|
3e5f66f671 | ||
|
|
9afad6ed83 | ||
|
|
b3adcfe170 | ||
|
|
1337494985 | ||
|
|
4a776d4d0b | ||
|
|
58110cdb96 | ||
|
|
08eb72105b | ||
|
|
a6da7e3cd8 | ||
|
|
4091439102 | ||
|
|
554e18d05b | ||
|
|
c3866c9e79 | ||
|
|
eb3ae6604b | ||
|
|
c36988d177 | ||
|
|
85cb484926 | ||
|
|
67b0713a62 | ||
|
|
c25770fedd | ||
|
|
bfb714e576 | ||
|
|
5b61273847 | ||
|
|
a7f06431d9 | ||
|
|
5b2065032e | ||
|
|
3e05078ed6 | ||
|
|
32b80e3a09 | ||
|
|
a7e3640191 | ||
|
|
a56f472adf | ||
|
|
75fa8d657f | ||
|
|
5632d597ba | ||
|
|
cf71c2e029 | ||
|
|
0636ecea47 | ||
|
|
de91f5ae9b | ||
|
|
a4990a8363 | ||
|
|
7cb2ba1a65 | ||
|
|
a6626ea66d | ||
|
|
0a220b88ad | ||
|
|
3817aa452b | ||
|
|
e0486d146d | ||
|
|
a056c0dfa5 | ||
|
|
9091203500 | ||
|
|
4555b39ff0 | ||
|
|
14d73e7f5b | ||
|
|
7dc5c992ea | ||
|
|
41dd2f7332 | ||
|
|
6e9718443a | ||
|
|
e179eabb97 | ||
|
|
3278bc46f4 | ||
|
|
f524f0e259 | ||
|
|
5354c5e7b5 | ||
|
|
5e3d81475b | ||
|
|
d2b1868514 | ||
|
|
c14a08ca40 | ||
|
|
74bd7637a5 | ||
|
|
44ea3bf179 | ||
|
|
06986144aa | ||
|
|
39394063cf | ||
|
|
6fdb7aa05b | ||
|
|
c19c6afa08 | ||
|
|
286f876bf7 | ||
|
|
f8488c360a | ||
|
|
f46ece1554 | ||
|
|
45befba712 | ||
|
|
298e72c3e6 | ||
|
|
bb01c623c9 | ||
|
|
0d7d3f799e | ||
|
|
75db693647 | ||
|
|
f41673bfbd | ||
|
|
5cc87fa56e | ||
|
|
9ee8cd5583 | ||
|
|
b92179cf5c | ||
|
|
7af8deae73 | ||
|
|
0f2b50816a | ||
|
|
d5e0d681e5 | ||
|
|
637c0c4cf7 | ||
|
|
ac3516569d | ||
|
|
0168c86d7a | ||
|
|
7f719b4853 | ||
|
|
c9c1296e38 | ||
|
|
b7e01cc097 | ||
|
|
302054f955 | ||
|
|
ac11dad736 | ||
|
|
284cb51917 | ||
|
|
8db344082f | ||
|
|
35e195d338 | ||
|
|
0f2b0cb13a | ||
|
|
ab433ffa4a | ||
|
|
9f4e82f302 | ||
|
|
f1782c29bd | ||
|
|
413a2af13e | ||
|
|
8585d8b4fa | ||
|
|
6f17d10149 | ||
|
|
5079f0a9d2 | ||
|
|
9167b84331 | ||
|
|
1af875416f | ||
|
|
10fa44a00a | ||
|
|
7446424a69 | ||
|
|
df063c42e1 | ||
|
|
576bea3a90 | ||
|
|
55df9d517b | ||
|
|
372a20dfd5 | ||
|
|
721983551c | ||
|
|
eb1ffa3a60 | ||
|
|
69ecff015f | ||
|
|
25463565c0 | ||
|
|
4d49aeac5e | ||
|
|
4f596d061e | ||
|
|
62c337e5d0 | ||
|
|
b340c92cd2 | ||
|
|
e78377edd1 | ||
|
|
3f952e455e | ||
|
|
d3cca3c5db | ||
|
|
17c3d0b033 | ||
|
|
bb3197f863 | ||
|
|
d14d046cc5 | ||
|
|
da45e7f10c | ||
|
|
f3ae589f0e | ||
|
|
cb3af301d3 | ||
|
|
48ce9c78b2 | ||
|
|
3992aeebeb | ||
|
|
da9bcac667 | ||
|
|
5002510d43 | ||
|
|
587bb51013 | ||
|
|
d83c36dd0f | ||
|
|
d0bcfd4327 | ||
|
|
c27bc67a4b | ||
|
|
b60353da3f | ||
|
|
7a12fa043a | ||
|
|
0a0bb4ed48 | ||
|
|
14ecefdf5e | ||
|
|
81ddf5fe49 | ||
|
|
0c64adbeaf | ||
|
|
f4b80d5fd8 | ||
|
|
aa5b1f951b | ||
|
|
423ddcdaf9 | ||
|
|
3b9fc69f44 | ||
|
|
3d04c0bad5 | ||
|
|
c14a8e16ad | ||
|
|
16a5ea4c15 | ||
|
|
bb7532935e | ||
|
|
e88ec76817 | ||
|
|
3bcdf27e45 | ||
|
|
ebc2d06273 | ||
|
|
2d45ab829d | ||
|
|
36c6cca200 | ||
|
|
992229e94a | ||
|
|
98e6c376ad | ||
|
|
bf6f829561 | ||
|
|
1d4e4f09e4 | ||
|
|
2408e32596 | ||
|
|
c4362cd5f8 | ||
|
|
b1c3f1b226 | ||
|
|
e0ac832aab | ||
|
|
087e93c985 | ||
|
|
31d6d1c9a5 | ||
|
|
eb1d5ccb9f | ||
|
|
c83f3a7da6 | ||
|
|
258538bee2 | ||
|
|
fcf49b32de | ||
|
|
832e50712e | ||
|
|
e8100f1ad2 | ||
|
|
3ada190f0c | ||
|
|
d9b1c6a72f | ||
|
|
83c191892d | ||
|
|
7037f23f47 | ||
|
|
61c06327eb | ||
|
|
2cbcddde7f | ||
|
|
0395ecfb60 | ||
|
|
9002ae199a | ||
|
|
fa8e80aa1d | ||
|
|
c710d1e279 | ||
|
|
48ab4f6525 | ||
|
|
642b2f087f | ||
|
|
7f2b1c8a75 | ||
|
|
69ec94f111 | ||
|
|
c2374d293f | ||
|
|
7afe7bd16b | ||
|
|
bf64c89334 | ||
|
|
399120094b | ||
|
|
ab9a793482 | ||
|
|
9d4154956a | ||
|
|
3c272f6406 | ||
|
|
7c86760dbe | ||
|
|
1318c22b6b | ||
|
|
9de36f5fa3 | ||
|
|
caf3065e01 | ||
|
|
90d260e83f | ||
|
|
b32e651c72 | ||
|
|
89d4fb8624 | ||
|
|
bd0cbfa235 | ||
|
|
6342442bae | ||
|
|
f6b4993bd9 | ||
|
|
f9357bc0c0 | ||
|
|
592da646d0 | ||
|
|
eee7aa5d60 | ||
|
|
b18e748574 | ||
|
|
36282c2a4a | ||
|
|
5befe20b98 | ||
|
|
406ce053f6 | ||
|
|
1395c98675 | ||
|
|
bfd3a64713 | ||
|
|
a076943e46 | ||
|
|
9393d67233 | ||
|
|
f97f887fd5 | ||
|
|
d50b9b4b58 | ||
|
|
eaeb84e88f | ||
|
|
c153a60bfd | ||
|
|
a71f6c15f1 | ||
|
|
021800d963 | ||
|
|
bb715f5868 | ||
|
|
1654607cbd | ||
|
|
7b8754c15c | ||
|
|
d35bdc33a8 | ||
|
|
3cd96278fb | ||
|
|
a4efa0d630 | ||
|
|
e9c382512e | ||
|
|
c4bfc904c9 | ||
|
|
f91fff94e2 | ||
|
|
8b2a129528 | ||
|
|
cc4b42de8e | ||
|
|
d5a49e563d | ||
|
|
35d2bfdc03 | ||
|
|
7582baa723 | ||
|
|
481b0b5652 | ||
|
|
b7149d69fd | ||
|
|
3300943c79 | ||
|
|
49c2c26e26 | ||
|
|
4bad1b96b8 | ||
|
|
d85306e46c | ||
|
|
75642372a6 | ||
|
|
7c41977b10 | ||
|
|
6875784258 | ||
|
|
2996b4f2f8 | ||
|
|
eab839e288 | ||
|
|
5ad35122f3 | ||
|
|
47f5078a7b | ||
|
|
ad3ad85b2c | ||
|
|
b55af898aa | ||
|
|
ae8cf6ee6d | ||
|
|
6c1dae9b50 | ||
|
|
5fb6d0a0bd | ||
|
|
b055b96eb2 | ||
|
|
758f231fff | ||
|
|
52eeaca3ad | ||
|
|
0ab0217597 | ||
|
|
11556f50d2 | ||
|
|
ee7a67a711 | ||
|
|
f67fa3a0e3 | ||
|
|
6250b1f442 | ||
|
|
2802b8d1f6 | ||
|
|
b735e4fe2b | ||
|
|
3f79367f64 | ||
|
|
8382ad4e78 | ||
|
|
4f4f487b50 | ||
|
|
996fb0ff93 | ||
|
|
2bd0f48f17 | ||
|
|
be4312aefa | ||
|
|
0ef8a75d53 | ||
|
|
4a1ccd2148 | ||
|
|
08e15ec90e | ||
|
|
348f792fe4 | ||
|
|
3fd19af552 | ||
|
|
2516a94415 | ||
|
|
db5735ae10 | ||
|
|
301ec72ea4 | ||
|
|
c8ba3f2ab6 | ||
|
|
377cf6aa97 | ||
|
|
66dc68d42a | ||
|
|
2c0ad92351 | ||
|
|
b0fefb46e4 | ||
|
|
5c3f886035 | ||
|
|
076c114235 | ||
|
|
723b023418 | ||
|
|
b573de271f | ||
|
|
0f0c501180 | ||
|
|
7f7953d882 | ||
|
|
89a8428f49 | ||
|
|
ee09a04094 | ||
|
|
f042904d94 | ||
|
|
c383a155a9 | ||
|
|
d0d7894082 | ||
|
|
e780123ea3 | ||
|
|
3a81fef8e2 | ||
|
|
5d17f62fe7 | ||
|
|
9388a02a0d | ||
|
|
f178c9ddac | ||
|
|
5a774d6b96 | ||
|
|
47382f98c9 | ||
|
|
80ce270063 | ||
|
|
1b96bb936c | ||
|
|
8c78a4eed4 | ||
|
|
87e04c2984 | ||
|
|
dc924d2084 | ||
|
|
bbf3618837 | ||
|
|
efb72eb889 | ||
|
|
5083ca5b7e | ||
|
|
ccf097f432 | ||
|
|
026dcd1dcf | ||
|
|
36fef04410 | ||
|
|
c3f666b33c | ||
|
|
faf27a433b | ||
|
|
08451f9027 | ||
|
|
d41b6f6748 | ||
|
|
1a3eda5744 | ||
|
|
8e024fa8f0 | ||
|
|
c52025ea91 | ||
|
|
9ab568f58d | ||
|
|
25b15817f7 | ||
|
|
57a8f8ffc6 | ||
|
|
bed46b51e0 | ||
|
|
e5731ff736 | ||
|
|
ebc1f7436a | ||
|
|
b3dd090806 | ||
|
|
00a856b938 | ||
|
|
0aee839144 | ||
|
|
a0a58671d0 | ||
|
|
b621a96d91 | ||
|
|
a42da99b5a | ||
|
|
fae7d2944e | ||
|
|
1039d688ae | ||
|
|
48f0a728ec | ||
|
|
8fd0c627d2 | ||
|
|
4db1f54f79 | ||
|
|
338852fb20 | ||
|
|
8ef931c119 | ||
|
|
b62d476704 | ||
|
|
3352821fe0 | ||
|
|
fac683ae77 | ||
|
|
ca984e0334 | ||
|
|
f9f143eadd | ||
|
|
8b0109a555 | ||
|
|
3c88fc0d90 | ||
|
|
c553b89023 | ||
|
|
2c810b0c31 | ||
|
|
0e9a5c4958 | ||
|
|
d0e25f4a05 | ||
|
|
25b7bf1a12 | ||
|
|
0e237e981a | ||
|
|
139fc10e3b | ||
|
|
5a0a55c231 | ||
|
|
55816e4184 | ||
|
|
82a9263afd | ||
|
|
c7c8ab9bed | ||
|
|
9af559ad0a | ||
|
|
2c58808b6f | ||
|
|
00efc527ff | ||
|
|
5e2e8cbcfe | ||
|
|
36896282b6 | ||
|
|
52924b32c6 | ||
|
|
d24259325f | ||
|
|
c59aca54d4 | ||
|
|
57252d3f7d | ||
|
|
b0088c7a3d | ||
|
|
e1bc1dbfa4 | ||
|
|
a28104d0d4 | ||
|
|
5f662f4e8f | ||
|
|
2f28b74565 | ||
|
|
8c3f416e7e | ||
|
|
1830a32784 | ||
|
|
442e9b2234 | ||
|
|
203780b77f | ||
|
|
174abbc2ea | ||
|
|
74e401982e | ||
|
|
4ea215fa42 | ||
|
|
b5925d2eda | ||
|
|
598be1c1e9 | ||
|
|
a8d3fccb73 | ||
|
|
8d9a0d7fd5 | ||
|
|
2a88383a43 | ||
|
|
4dde4f42d9 | ||
|
|
66b884a0c3 | ||
|
|
3db80acc76 | ||
|
|
065441374b | ||
|
|
fa7049446f | ||
|
|
549733fe01 | ||
|
|
561c4e00dd | ||
|
|
99cfd398be | ||
|
|
b2f799d4e3 | ||
|
|
0b6ab279be | ||
|
|
221379e1d0 | ||
|
|
0a3b777cb2 | ||
|
|
48188d5670 | ||
|
|
e338cd4f07 | ||
|
|
01b82f5581 | ||
|
|
cdec11bd06 | ||
|
|
7ac8a438cc | ||
|
|
d137a45808 | ||
|
|
5141b68613 | ||
|
|
cba37f6bba | ||
|
|
6a33d730fe | ||
|
|
8ab82a929a | ||
|
|
692eec7521 | ||
|
|
64346769b5 | ||
|
|
dc019f45e3 | ||
|
|
1b6168d675 | ||
|
|
4933ed2e42 | ||
|
|
a0cb0dc40c | ||
|
|
a34435a611 | ||
|
|
b8ecb4da9e | ||
|
|
b4deb35e6d | ||
|
|
9e71f526a3 | ||
|
|
85396d1183 | ||
|
|
e4b4799952 | ||
|
|
90a8e39b5a | ||
|
|
ab0dc7362f | ||
|
|
50d401de12 | ||
|
|
315bf0adb5 | ||
|
|
fff5b7216c | ||
|
|
0f1b29664f | ||
|
|
9bdfc81c1d | ||
|
|
c2731130a5 | ||
|
|
09ef6f1b44 | ||
|
|
1d5aa63016 | ||
|
|
6726babcc9 | ||
|
|
3da108641d | ||
|
|
b4cf41d822 | ||
|
|
d9ddfd9200 | ||
|
|
18edb794e7 | ||
|
|
55c23b348b | ||
|
|
3b85ba970a | ||
|
|
5a78a0e102 | ||
|
|
170ca8965c | ||
|
|
8ed10f0200 | ||
|
|
6791973ab0 | ||
|
|
f1c0e8b288 | ||
|
|
6416713fa5 | ||
|
|
996b513ca8 | ||
|
|
2431059cb7 | ||
|
|
34ce93323c | ||
|
|
d5365cd6f1 | ||
|
|
07e7d53b83 | ||
|
|
96e56379e8 | ||
|
|
241cd05c79 | ||
|
|
52bf4523cf | ||
|
|
29acda2955 | ||
|
|
0615585206 | ||
|
|
4a327f0a87 | ||
|
|
aa175cb44e | ||
|
|
4b2b40f6f2 | ||
|
|
3cb5b24a38 | ||
|
|
360e027673 | ||
|
|
f644f996e5 | ||
|
|
6189743d0d | ||
|
|
9ddc597a3d | ||
|
|
833571b3c6 | ||
|
|
7776fe2d54 | ||
|
|
68bdc82b30 | ||
|
|
7db0124e7d | ||
|
|
10951415b5 | ||
|
|
3f12948197 | ||
|
|
33104aa60c | ||
|
|
9658d499fd | ||
|
|
f93fef3797 | ||
|
|
94d9b21e8d | ||
|
|
8c6604fc1a | ||
|
|
26139a0c99 | ||
|
|
b6d15f7ee8 | ||
|
|
a125e0542a | ||
|
|
d74142409a | ||
|
|
57fcf65693 | ||
|
|
2af5b8ef57 | ||
|
|
5d563edf7e | ||
|
|
9f8b8ae388 | ||
|
|
8e5f0aee4e | ||
|
|
1764aff0b1 | ||
|
|
4e4e276425 | ||
|
|
60c0db5143 | ||
|
|
f45c9da161 | ||
|
|
6bd5d3f16d | ||
|
|
d18ddd0c4c | ||
|
|
fb3d63a2f9 | ||
|
|
62be7125a3 | ||
|
|
ffab24e841 | ||
|
|
c3839f3847 | ||
|
|
db7ba0453e | ||
|
|
cd8157d67b | ||
|
|
9ff5f77871 | ||
|
|
ddcc4ce79d | ||
|
|
4f55fb6671 | ||
|
|
9a6ec276d0 | ||
|
|
2976fa1a8a | ||
|
|
fe17fbea9b | ||
|
|
905a6365ef | ||
|
|
a534dc1ca7 | ||
|
|
9b11f8564d | ||
|
|
56211264dc | ||
|
|
6ff5280451 | ||
|
|
be10af10cd | ||
|
|
82f9a59a36 | ||
|
|
74c7b8de31 | ||
|
|
44915c991b | ||
|
|
14c7ff9828 | ||
|
|
5ba7111437 | ||
|
|
536be0e408 | ||
|
|
27dacf0681 | ||
|
|
57ed4b640d | ||
|
|
3cc0fa603c | ||
|
|
a008e57d09 | ||
|
|
60e65fa836 | ||
|
|
f2c25e8fbc | ||
|
|
b6039eca5f | ||
|
|
d82f107a0a | ||
|
|
f68bc74338 | ||
|
|
a3cf1703df | ||
|
|
085a38f62a | ||
|
|
774f31ad1f | ||
|
|
02a75e5745 | ||
|
|
4e7dffa928 | ||
|
|
dca34d2826 | ||
|
|
9286a45824 | ||
|
|
296a84a356 | ||
|
|
8c153fd636 | ||
|
|
cfb091ced5 | ||
|
|
913cb6ae97 | ||
|
|
56a212652f | ||
|
|
7089a3c79f | ||
|
|
a6a167fe1d | ||
|
|
fd140f0f1b | ||
|
|
142efa8dd0 | ||
|
|
dd12429cca | ||
|
|
9fe137ccba | ||
|
|
8d6793a838 | ||
|
|
f0f96aacf8 | ||
|
|
3672e99d0b | ||
|
|
6f28191422 | ||
|
|
b8c7706fa9 | ||
|
|
b80820c297 | ||
|
|
be8123fcba | ||
|
|
2abff017ef | ||
|
|
7c9b64c879 | ||
|
|
5c0a2d910c | ||
|
|
44e35fc660 | ||
|
|
c06b81c34c | ||
|
|
e4a43a62ca | ||
|
|
3e01b3f572 | ||
|
|
08e791c0ab | ||
|
|
0c2d25bba5 | ||
|
|
c4bf59ddf0 | ||
|
|
88ef6b4176 | ||
|
|
58a1d9b765 | ||
|
|
2f1c8ee8a8 | ||
|
|
ddb951ac5c | ||
|
|
37d334a950 | ||
|
|
cd52fe528c | ||
|
|
27d2caceab | ||
|
|
2f501d19f2 | ||
|
|
dd143d7535 | ||
|
|
ad282e98be | ||
|
|
e70243131f | ||
|
|
79a9957748 | ||
|
|
664342e8b9 | ||
|
|
93d66a384e | ||
|
|
2b31837503 | ||
|
|
399325c6d4 | ||
|
|
bb6848ffbf | ||
|
|
e6320a0ce0 | ||
|
|
12d1e297cf | ||
|
|
f33ab1ce3c | ||
|
|
f9b0e90b64 | ||
|
|
ddf982c56b | ||
|
|
562f22861f | ||
|
|
3b585d3189 | ||
|
|
045467e799 | ||
|
|
0aed962d2b | ||
|
|
2f7e9b8244 | ||
|
|
261c1b725f | ||
|
|
e41bbebd46 | ||
|
|
77d5a58afd | ||
|
|
93eec98d20 | ||
|
|
091077aa33 | ||
|
|
77057fe598 | ||
|
|
7f15155c83 | ||
|
|
c01d870021 | ||
|
|
cc15e45ad2 | ||
|
|
aa4d8a25af | ||
|
|
c43d68577a | ||
|
|
dd6777bad0 | ||
|
|
06518c4646 | ||
|
|
13df9e5f19 | ||
|
|
b9c9fafc5e | ||
|
|
7cd03fe59d | ||
|
|
68c2ea79c0 | ||
|
|
3cd7a38194 | ||
|
|
593cf1bf61 | ||
|
|
db32086b0e | ||
|
|
14ae3aa186 | ||
|
|
5d275c248d | ||
|
|
caebf3a5f8 | ||
|
|
b488eb78b9 | ||
|
|
0e075a7b80 | ||
|
|
33502fbad6 | ||
|
|
22c73ef474 | ||
|
|
c7cb6b6d2d | ||
|
|
dc508a534f | ||
|
|
cbb4a26833 | ||
|
|
ddee83a9fa | ||
|
|
a5a074461d | ||
|
|
9b06ae0c8f | ||
|
|
cfe81e44f7 | ||
|
|
be6d08ae18 | ||
|
|
bb6c60694d | ||
|
|
cd36cbdf58 | ||
|
|
d7c82da11f | ||
|
|
fbf3a2645f | ||
|
|
34ad27f047 | ||
|
|
012202f1f7 | ||
|
|
8c6de822d9 | ||
|
|
9521da857d | ||
|
|
d0557591c3 | ||
|
|
e9875f87c5 | ||
|
|
0dd33f2e12 | ||
|
|
85dfb1be6c | ||
|
|
75a4b9b2b6 | ||
|
|
4d691df9e3 | ||
|
|
c88c32646a | ||
|
|
4c3082ab0c | ||
|
|
fd434f45f9 | ||
|
|
c4a437a7ed | ||
|
|
796636692c | ||
|
|
1b73ce72f6 | ||
|
|
cd3f1c78cd | ||
|
|
8dedf9d091 | ||
|
|
394355d3c1 | ||
|
|
e44dc343f0 | ||
|
|
7723c4a70e | ||
|
|
0537dbc26b | ||
|
|
62133fdcc9 | ||
|
|
af8e101f1b | ||
|
|
eba02f27b8 | ||
|
|
9af74f6c75 | ||
|
|
05e5756172 | ||
|
|
de3348c6bb | ||
|
|
f5341151bb | ||
|
|
c76323298e | ||
|
|
b3eaf07d5d | ||
|
|
92bed36fbd | ||
|
|
6cad802029 | ||
|
|
90348e63ec | ||
|
|
7e586f42e5 | ||
|
|
a640fc495b | ||
|
|
13134b936d | ||
|
|
63a1fe6509 | ||
|
|
dbf0fe69c6 | ||
|
|
8a0fe4a93e | ||
|
|
f88f417a26 | ||
|
|
c273315286 | ||
|
|
469d382646 | ||
|
|
f7d4d11f4e | ||
|
|
91258d0bfc | ||
|
|
addb0b2f44 | ||
|
|
6bb45e8916 | ||
|
|
960871aa12 | ||
|
|
1090d221af | ||
|
|
6148db1fc6 | ||
|
|
4cfbb9765a | ||
|
|
77bcb54189 | ||
|
|
4a0f0a764b | ||
|
|
a1f6940f03 | ||
|
|
0f4e775451 | ||
|
|
b6f07cfd0a | ||
|
|
ede4d98055 | ||
|
|
0a0088d3c7 | ||
|
|
a60f667fd2 | ||
|
|
9b620ff2e6 | ||
|
|
1cbea49773 | ||
|
|
047f87a3eb | ||
|
|
bd823a6e11 | ||
|
|
add3524194 | ||
|
|
7c304e9aa0 | ||
|
|
a84c344b5c | ||
|
|
cc9525fa15 | ||
|
|
a367379062 | ||
|
|
3e111b037e | ||
|
|
a88bb70a49 | ||
|
|
c29a83c1e5 | ||
|
|
1e721e7733 | ||
|
|
65e5883cdb | ||
|
|
66068509ff | ||
|
|
722a5752e2 | ||
|
|
5824810b7d | ||
|
|
1028107c1e | ||
|
|
447a35fe7d | ||
|
|
a9b04231b5 | ||
|
|
21ed2a65fd | ||
|
|
56bdcb43e9 | ||
|
|
d65cf7e026 | ||
|
|
2b45603119 | ||
|
|
fade18bee2 | ||
|
|
0fc5625884 | ||
|
|
2e75794b0d | ||
|
|
221cc5f371 | ||
|
|
353e55b7f6 | ||
|
|
2cdbcfb265 | ||
|
|
65aeb0b85f | ||
|
|
5614b7a1e9 | ||
|
|
bc603a7cef | ||
|
|
b79a2853b6 | ||
|
|
d46753fa28 | ||
|
|
6c08acb9bd | ||
|
|
7f4ae06c9c | ||
|
|
ec88440c2d | ||
|
|
79a9b98ea5 | ||
|
|
045e73bfdc | ||
|
|
7a2bbb38ea | ||
|
|
c16e04df1f | ||
|
|
7a38066382 | ||
|
|
de69ac5bb1 | ||
|
|
26d7ecfe23 | ||
|
|
4cc391ff22 | ||
|
|
733ca6de59 | ||
|
|
7989ded99f | ||
|
|
420042a5cf | ||
|
|
5199693c7c | ||
|
|
3c4b404cd9 | ||
|
|
bb377c86aa | ||
|
|
1e9a7adaef | ||
|
|
1be69d18f3 | ||
|
|
c533144fe7 | ||
|
|
238dfa9172 | ||
|
|
91b5031be3 | ||
|
|
08d4fc7175 | ||
|
|
a13d238a19 | ||
|
|
9a082e063b | ||
|
|
a904c07dc4 | ||
|
|
b8fb6e472a | ||
|
|
c89720f69a | ||
|
|
589a2f1182 | ||
|
|
153313037a | ||
|
|
47e6d70a0b | ||
|
|
88da426e7c | ||
|
|
b46897740f | ||
|
|
80c6e96a41 | ||
|
|
453b90c2aa | ||
|
|
315a12dd58 | ||
|
|
e306530a8e |
1373
mozilla/modules/libreg/xpcom/nsRegistry.cpp
Normal file
1373
mozilla/modules/libreg/xpcom/nsRegistry.cpp
Normal file
File diff suppressed because it is too large
Load Diff
36
mozilla/netwerk/Makefile.in
Normal file
36
mozilla/netwerk/Makefile.in
Normal file
@@ -0,0 +1,36 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
base \
|
||||
dns \
|
||||
build \
|
||||
protocol \
|
||||
test \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
33
mozilla/netwerk/base/Makefile.in
Normal file
33
mozilla/netwerk/base/Makefile.in
Normal file
@@ -0,0 +1,33 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
27
mozilla/netwerk/base/makefile.win
Normal file
27
mozilla/netwerk/base/makefile.win
Normal file
@@ -0,0 +1,27 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..\..
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
61
mozilla/netwerk/base/public/Makefile.in
Normal file
61
mozilla/netwerk/base/public/Makefile.in
Normal file
@@ -0,0 +1,61 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
XPIDL_MODULE = netwerk_base
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIRequest.idl \
|
||||
nsIChannel.idl \
|
||||
nsIURI.idl \
|
||||
nsIURL.idl \
|
||||
nsIStreamObserver.idl \
|
||||
nsIStreamListener.idl \
|
||||
nsIIOService.idl \
|
||||
nsIEventSinkGetter.idl \
|
||||
nsIPrompt.idl \
|
||||
nsIProtocolHandler.idl \
|
||||
nsIProgressEventSink.idl \
|
||||
nsINetModRegEntry.idl \
|
||||
nsINetModuleMgr.idl \
|
||||
nsINetNotify.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
netCore.h \
|
||||
nsIFileTransportService.h \
|
||||
nsISocketTransportService.h \
|
||||
nsIHeader.h \
|
||||
nsIProxy.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
58
mozilla/netwerk/base/public/makefile.win
Normal file
58
mozilla/netwerk/base/public/makefile.win
Normal file
@@ -0,0 +1,58 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
EXPORTS = \
|
||||
netCore.h \
|
||||
nsIFileTransportService.h \
|
||||
nsISocketTransportService.h \
|
||||
nsIHeader.h \
|
||||
nsIProxy.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIRequest.idl \
|
||||
.\nsIChannel.idl \
|
||||
.\nsIURI.idl \
|
||||
.\nsIURL.idl \
|
||||
.\nsIStreamObserver.idl \
|
||||
.\nsIStreamListener.idl \
|
||||
.\nsIIOService.idl \
|
||||
.\nsIEventSinkGetter.idl \
|
||||
.\nsIPrompt.idl \
|
||||
.\nsIProtocolHandler.idl \
|
||||
.\nsIProgressEventSink.idl \
|
||||
.\nsINetModRegEntry.idl \
|
||||
.\nsINetModuleMgr.idl \
|
||||
.\nsINetNotify.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.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 __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, 1)
|
||||
|
||||
#define NS_ERROR_NOT_CONNECTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
|
||||
|
||||
#define NS_ERROR_CONNECTION_REFUSED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 3)
|
||||
|
||||
#define NS_ERROR_DNS_DOES_NOT_EXIST \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 4)
|
||||
|
||||
#define NS_ERROR_TCP_TIMEOUT \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 5)
|
||||
|
||||
#define NS_ERROR_IN_PROGRESS \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 6)
|
||||
|
||||
#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__
|
||||
91
mozilla/netwerk/base/public/nsIChannel.idl
Normal file
91
mozilla/netwerk/base/public/nsIChannel.idl
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- 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.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 "nsIRequest.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIInputStream;
|
||||
interface nsIOutputStream;
|
||||
interface nsIEventQueue;
|
||||
interface nsIStreamObserver;
|
||||
interface nsIStreamListener;
|
||||
|
||||
/**
|
||||
* nsIChannel is the abstract base class for transports and URLs.
|
||||
* It's abstract in that it doesn't provide a means to specify the
|
||||
* location/destination of the data being accessed.
|
||||
*/
|
||||
[scriptable, uuid(89f4afe0-1868-11d3-9337-00104ba0fd40)]
|
||||
interface nsIChannel : nsIRequest
|
||||
{
|
||||
/**
|
||||
* Returns the URL to which the channel refers.
|
||||
*/
|
||||
readonly attribute nsIURI URI;
|
||||
|
||||
/**
|
||||
* 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(in unsigned long startPosition,
|
||||
in long readCount);
|
||||
|
||||
/**
|
||||
* 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(in unsigned long startPosition);
|
||||
|
||||
/**
|
||||
* 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 unsigned long startPosition,
|
||||
in long readCount,
|
||||
in nsISupports ctxt,
|
||||
in nsIEventQueue eventQueue,
|
||||
in nsIStreamListener listener);
|
||||
|
||||
/**
|
||||
* 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 unsigned long startPosition,
|
||||
in long writeCount,
|
||||
in nsISupports ctxt,
|
||||
in nsIEventQueue eventQueue,
|
||||
in nsIStreamObserver observer);
|
||||
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
@@ -16,10 +16,11 @@
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __NS_JSWINREG_H__
|
||||
#define __NS_JSWINREG_H__
|
||||
#include "nsISupports.idl"
|
||||
|
||||
PRInt32
|
||||
InitWinRegPrototype(JSContext *jscontext, JSObject *global, JSObject **winRegPrototype);
|
||||
[scriptable, uuid(fb65fd70-1881-11d3-9337-00104ba0fd40)]
|
||||
interface nsIEventSinkGetter : nsISupports
|
||||
{
|
||||
nsISupports GetEventSink(in string verb, in nsIIDRef eventSinkIID);
|
||||
};
|
||||
|
||||
#endif
|
||||
55
mozilla/netwerk/base/public/nsIFileTransportService.h
Normal file
55
mozilla/netwerk/base/public/nsIFileTransportService.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.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 nsIFileTransportService_h___
|
||||
#define nsIFileTransportService_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIChannel;
|
||||
|
||||
#define NS_IFILETRANSPORTSERVICE_IID \
|
||||
{ /* 2355dca0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x2355dca0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
#define NS_FILETRANSPORTSERVICE_CID \
|
||||
{ /* 2bb2b250-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x2bb2b250, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIFileTransportService : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILETRANSPORTSERVICE_IID);
|
||||
|
||||
NS_IMETHOD CreateTransport(const char* path,
|
||||
nsIChannel* *result) = 0;
|
||||
|
||||
NS_IMETHOD ProcessPendingRequests(void) = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsIFileTransportService_h___ */
|
||||
75
mozilla/netwerk/base/public/nsIHeader.h
Normal file
75
mozilla/netwerk/base/public/nsIHeader.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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.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 _nsIHeader_h_
|
||||
#define _nsIHeader_h_
|
||||
|
||||
#include "nsISupports.h"
|
||||
/*
|
||||
nsIHeader. A class to encapsulate and share the header reading and
|
||||
writing on requests/responses of several protocols.
|
||||
|
||||
I am not convinced the GetHeaderMultiple is the right way to
|
||||
do multiple values, but give me a better way... TODO think.
|
||||
|
||||
- Gagan Saksena 03/08/99
|
||||
*/
|
||||
|
||||
class nsIHeader : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
/*
|
||||
SetHeader- set a particular header. The implementation is protocol
|
||||
specific. For e.g. HTTP will put a colon and space to separate
|
||||
the header with the value and then trail it will an newline.
|
||||
So SetHeader for HTTP with say ("Accept", "text/html") will
|
||||
result in a string "Accept: text/html\n" being added to the header
|
||||
set.
|
||||
*/
|
||||
NS_IMETHOD SetHeader(const char* i_Header, const char* i_Value) = 0;
|
||||
|
||||
/*
|
||||
Get the first occurence of the header and its corresponding value.
|
||||
Note that if you expect the possibility of multiple values, you
|
||||
should use GetHeaderMultiple() version.
|
||||
*/
|
||||
NS_IMETHOD GetHeader(const char* i_Header, char* *o_Value) = 0;
|
||||
|
||||
/*
|
||||
This version returns an array of values associated with this
|
||||
header. TODO think of a better way to do this...
|
||||
*/
|
||||
NS_IMETHOD GetHeaderMultiple(
|
||||
const char* i_Header,
|
||||
char** *o_ValueArray,
|
||||
int *o_Count) = 0;
|
||||
|
||||
static const nsIID& GetIID() {
|
||||
// {4CD2C720-D5CF-11d2-B013-006097BFC036}
|
||||
static const nsIID NS_IHEADER_IID =
|
||||
{ 0x4cd2c720, 0xd5cf, 0x11d2, { 0xb0, 0x13, 0x0, 0x60, 0x97, 0xbf, 0xc0, 0x36 } };
|
||||
|
||||
return NS_IHEADER_IID;
|
||||
}
|
||||
};
|
||||
|
||||
//TODO verify error offsets!
|
||||
#define NS_ERROR_NOT_FOUND NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 115);
|
||||
|
||||
#endif // _nsIHeader_h_
|
||||
145
mozilla/netwerk/base/public/nsIIOService.idl
Normal file
145
mozilla/netwerk/base/public/nsIIOService.idl
Normal file
@@ -0,0 +1,145 @@
|
||||
/* -*- 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.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 "nsISupports.idl"
|
||||
|
||||
interface nsIProtocolHandler;
|
||||
interface nsIURI;
|
||||
interface nsIEventSinkGetter;
|
||||
interface nsIChannel;
|
||||
interface nsIStreamObserver;
|
||||
interface nsIStreamListener;
|
||||
interface nsIEventQueue;
|
||||
interface nsIBufferInputStream;
|
||||
interface nsIBufferOutputStream;
|
||||
interface nsIFileChannel;
|
||||
|
||||
[scriptable, uuid(01f0a170-1881-11d3-9337-00104ba0fd40)]
|
||||
interface nsIIOService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns a protocol handler for a given URI scheme.
|
||||
*/
|
||||
nsIProtocolHandler GetProtocolHandler(in string scheme);
|
||||
|
||||
/**
|
||||
* Returns an absolute URI string from a relative specification and
|
||||
* a base URI.
|
||||
*/
|
||||
string MakeAbsolute(in string aRelativeSpec, in nsIURI aBaseURI);
|
||||
|
||||
/**
|
||||
* 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 eventSinkGetter is used to
|
||||
* obtain the appropriate callbacks for the URI's protocol from the
|
||||
* application.
|
||||
*/
|
||||
nsIChannel NewChannelFromURI(in string verb,
|
||||
in nsIURI aURI,
|
||||
in nsIEventSinkGetter eventSinkGetter);
|
||||
|
||||
/**
|
||||
* Convenience routine that first creates a URI by calling NewURI, and
|
||||
* then passes the URI to NewChannelFromURI.
|
||||
*/
|
||||
nsIChannel NewChannel(in string verb,
|
||||
in string aSpec,
|
||||
in nsIURI aBaseURI,
|
||||
in nsIEventSinkGetter eventSinkGetter);
|
||||
|
||||
/**
|
||||
* Get the application name string that will be used as part
|
||||
* of a HTTP request.
|
||||
*/
|
||||
readonly attribute wstring AppCodeName;
|
||||
|
||||
/**
|
||||
* Get the application version string that will be used as part
|
||||
* of a HTTP request.
|
||||
*/
|
||||
readonly attribute wstring AppVersion;
|
||||
|
||||
/**
|
||||
* Get the application name.
|
||||
*/
|
||||
readonly attribute wstring AppName;
|
||||
|
||||
/**
|
||||
* Get the translation of the application. The value for language
|
||||
* is usually a 2-letter code such as "en" and occasionally a
|
||||
* five-character code to indicate a language subtype, such as "zh_CN".
|
||||
*/
|
||||
readonly attribute wstring Language;
|
||||
|
||||
/**
|
||||
* Get the current platform (machine type).
|
||||
*/
|
||||
readonly attribute wstring Platform;
|
||||
|
||||
/**
|
||||
* Get the HTTP advertised user agent string.
|
||||
*/
|
||||
readonly attribute wstring UserAgent;
|
||||
|
||||
/**
|
||||
* Returns a new stream observer that marshals data from another
|
||||
* stream observer over to the thread specified by an event queue.
|
||||
*/
|
||||
nsIStreamObserver NewAsyncStreamObserver(in nsIStreamObserver receiver,
|
||||
in nsIEventQueue eventQueue);
|
||||
|
||||
/**
|
||||
* 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 data on the other thread.
|
||||
*/
|
||||
nsIStreamListener NewAsyncStreamListener(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.
|
||||
*/
|
||||
nsIStreamListener NewSyncStreamListener(out nsIBufferInputStream inStream,
|
||||
out nsIBufferOutputStream outStream);
|
||||
|
||||
/**
|
||||
* This convenience routine first looks up the file protocol handler, and
|
||||
* then uses it to construct a file channel from a native path string.
|
||||
*/
|
||||
nsIFileChannel NewChannelFromNativePath(in string nativePath);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_IOSERVICE_CID \
|
||||
{ /* 9ac9e770-18bc-11d3-9337-00104ba0fd40 */ \
|
||||
0x9ac9e770, \
|
||||
0x18bc, \
|
||||
0x11d3, \
|
||||
{0x93, 0x37, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
%}
|
||||
42
mozilla/netwerk/base/public/nsINetModRegEntry.idl
Normal file
42
mozilla/netwerk/base/public/nsINetModRegEntry.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.
|
||||
*/
|
||||
|
||||
/* This interface defines a registry entry for the networking libraries
|
||||
* external module registry. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsINetNotify.idl"
|
||||
|
||||
interface nsIEventQueue;
|
||||
interface nsINetModRegEntry;
|
||||
|
||||
%{ 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 mNotify;
|
||||
readonly attribute nsIEventQueue mEventQ;
|
||||
readonly attribute string mTopic;
|
||||
readonly attribute nsCIDPtr mCID;
|
||||
|
||||
boolean Equals(in nsINetModRegEntry aEntry);
|
||||
};
|
||||
73
mozilla/netwerk/base/public/nsINetModuleMgr.idl
Normal file
73
mozilla/netwerk/base/public/nsINetModuleMgr.idl
Normal file
@@ -0,0 +1,73 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/* 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 } }
|
||||
%}
|
||||
|
||||
[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.
|
||||
// aEventQueue: The event queue to receive the events.
|
||||
// aNotify: The external module interface methods to be called when an event is fired.
|
||||
//
|
||||
// RETURNS: nsresult
|
||||
void RegisterModule(in string aTopic, in nsIEventQueue aEventQueue, in nsINetNotify aNotify, in nsCIDPtr aCID);
|
||||
|
||||
// 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 nsIEventQueue aEventQueue, in nsINetNotify aNotify, in nsCIDPtr aCID);
|
||||
|
||||
// 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);
|
||||
};
|
||||
24
mozilla/netwerk/base/public/nsINetNotify.idl
Normal file
24
mozilla/netwerk/base/public/nsINetNotify.idl
Normal file
@@ -0,0 +1,24 @@
|
||||
/* -*- 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 "nsISupports.idl"
|
||||
|
||||
[uuid(4A3019E0-1CF3-11d3-A15B-0050041CAF44)]
|
||||
interface nsINetNotify : nsISupports {
|
||||
|
||||
};
|
||||
43
mozilla/netwerk/base/public/nsIProgressEventSink.idl
Normal file
43
mozilla/netwerk/base/public/nsIProgressEventSink.idl
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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.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 "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
|
||||
/**
|
||||
* 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 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 nsISupports ctxt, in wstring aMsg);
|
||||
|
||||
};
|
||||
34
mozilla/netwerk/base/public/nsIPrompt.idl
Normal file
34
mozilla/netwerk/base/public/nsIPrompt.idl
Normal file
@@ -0,0 +1,34 @@
|
||||
/* -*- 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.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 "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(a63f70c0-148b-11d3-9333-00104ba0fd40)]
|
||||
interface nsIPrompt : nsISupports
|
||||
{
|
||||
boolean Confirm(in nsISupports ctxt, in wstring text);
|
||||
|
||||
boolean Prompt(in nsISupports ctxt, in wstring text,
|
||||
in wstring defaultText, out wstring result);
|
||||
|
||||
boolean PromptUsernameAndPassword(in nsISupports ctxt, in wstring text,
|
||||
out wstring user, out wstring pwd);
|
||||
|
||||
boolean PromptPassword(in nsISupports ctxt, in wstring text,
|
||||
out wstring pwd);
|
||||
};
|
||||
55
mozilla/netwerk/base/public/nsIProtocolHandler.idl
Normal file
55
mozilla/netwerk/base/public/nsIProtocolHandler.idl
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.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 "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIEventSinkGetter;
|
||||
interface nsIChannel;
|
||||
interface nsIEventQueue;
|
||||
|
||||
[scriptable, uuid(8984a6f0-1893-11d3-9337-00104ba0fd40)]
|
||||
interface nsIProtocolHandler : nsISupports
|
||||
{
|
||||
readonly attribute string Scheme;
|
||||
|
||||
readonly attribute long DefaultPort;
|
||||
|
||||
string MakeAbsolute(in string aRelativeSpec, in nsIURI aBaseURI);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
nsIChannel NewChannel(in string verb,
|
||||
in nsIURI aURI,
|
||||
in nsIEventSinkGetter eventSinkGetter,
|
||||
in nsIEventQueue eventQueue);
|
||||
};
|
||||
|
||||
%{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)
|
||||
|
||||
%}
|
||||
61
mozilla/netwerk/base/public/nsIProxy.h
Normal file
61
mozilla/netwerk/base/public/nsIProxy.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- 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.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 _nsIProxy_h_
|
||||
#define _nsIProxy_h_
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
class nsIProxy : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
/*
|
||||
Get and Set the Proxy Host
|
||||
*/
|
||||
NS_IMETHOD GetProxyHost(const char* *o_ProxyHost) const = 0;
|
||||
NS_IMETHOD SetProxyHost(const char* i_ProxyHost) = 0;
|
||||
|
||||
/*
|
||||
Get and Set the Proxy Port
|
||||
-1 on Set call indicates switch to default port
|
||||
*/
|
||||
NS_IMETHOD_(PRInt32)
|
||||
GetProxyPort(void) const = 0;
|
||||
NS_IMETHOD SetProxyPort(PRInt32 i_ProxyPort) = 0;
|
||||
|
||||
|
||||
static const nsIID& GetIID() {
|
||||
// {0492D011-CD2F-11d2-B013-006097BFC036}
|
||||
static const nsIID NS_IPROXY_IID=
|
||||
{ 0x492d011, 0xcd2f, 0x11d2, { 0xb0, 0x13, 0x0, 0x60, 0x97, 0xbf, 0xc0, 0x36 } };
|
||||
return NS_IPROXY_IID;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif /* _nsIProxy_h_ */
|
||||
43
mozilla/netwerk/base/public/nsIRequest.idl
Normal file
43
mozilla/netwerk/base/public/nsIRequest.idl
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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.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 "nsISupports.idl"
|
||||
|
||||
interface nsIRequest : nsISupports
|
||||
{
|
||||
/**
|
||||
* Cancels the current request. This will close any open input or
|
||||
* output streams and terminate any async requests.
|
||||
*/
|
||||
void Cancel();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
};
|
||||
56
mozilla/netwerk/base/public/nsISocketTransportService.h
Normal file
56
mozilla/netwerk/base/public/nsISocketTransportService.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.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 nsISocketTransportService_h___
|
||||
#define nsISocketTransportService_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIChannel;
|
||||
|
||||
#define NS_ISOCKETTRANSPORTSERVICE_IID \
|
||||
{ /* 9610f120-ef12-11d2-92b6-00105a1b0d64 */ \
|
||||
0x9610f120, \
|
||||
0xef12, \
|
||||
0x11d2, \
|
||||
{0x92, 0xb6, 0x00, 0x10, 0x5a, 0x1b, 0x0d, 0x64} \
|
||||
}
|
||||
|
||||
#define NS_SOCKETTRANSPORTSERVICE_CID \
|
||||
{ /* c07e81e0-ef12-11d2-92b6-00105a1b0d64 */ \
|
||||
0xc07e81e0, \
|
||||
0xef12, \
|
||||
0x11d2, \
|
||||
{0x92, 0xb6, 0x00, 0x10, 0x5a, 0x1b, 0x0d, 0x64} \
|
||||
}
|
||||
|
||||
|
||||
class nsISocketTransportService : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISOCKETTRANSPORTSERVICE_IID);
|
||||
|
||||
NS_IMETHOD CreateTransport(const char* host, PRInt32 port,
|
||||
nsIChannel* *result) = 0;
|
||||
|
||||
NS_IMETHOD Shutdown(void) = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsISocketTransportService_h___ */
|
||||
51
mozilla/netwerk/base/public/nsIStreamListener.idl
Normal file
51
mozilla/netwerk/base/public/nsIStreamListener.idl
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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.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 "nsIStreamObserver.idl"
|
||||
|
||||
interface nsIBufferInputStream;
|
||||
interface nsIBufferOutputStream;
|
||||
interface nsIEventQueue;
|
||||
|
||||
[scriptable, uuid(1a637020-1482-11d3-9333-00104ba0fd40)]
|
||||
interface nsIStreamListener : nsIStreamObserver
|
||||
{
|
||||
void OnDataAvailable(in nsISupports ctxt,
|
||||
in nsIBufferInputStream inStr,
|
||||
in unsigned long sourceOffset,
|
||||
in unsigned long count);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// 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 data on the other thread.
|
||||
extern NS_NET nsresult
|
||||
NS_NewAsyncStreamListener(nsIStreamListener* *result,
|
||||
nsIEventQueue* eventQueue,
|
||||
nsIStreamListener* receiver);
|
||||
|
||||
// A synchronous stream listener pushes data through a pipe that ends up
|
||||
// in an input stream to be read by another thread.
|
||||
extern NS_NET nsresult
|
||||
NS_NewSyncStreamListener(nsIBufferInputStream **inStream,
|
||||
nsIBufferOutputStream **outStream,
|
||||
nsIStreamListener **listener);
|
||||
|
||||
%}
|
||||
59
mozilla/netwerk/base/public/nsIStreamObserver.idl
Normal file
59
mozilla/netwerk/base/public/nsIStreamObserver.idl
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- 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.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 "nsISupports.idl"
|
||||
|
||||
interface nsIEventQueue;
|
||||
|
||||
[scriptable, uuid(fd91e2e0-1481-11d3-9333-00104ba0fd40)]
|
||||
interface nsIStreamObserver : nsISupports
|
||||
{
|
||||
void OnStartBinding(in nsISupports ctxt);
|
||||
|
||||
void OnStopBinding(in nsISupports ctxt,
|
||||
in nsresult status,
|
||||
in wstring errorMsg);
|
||||
|
||||
/**
|
||||
* Called after the stream is opened for reading or writing.
|
||||
* The content type or headers may be accessed after this method
|
||||
* is called.
|
||||
*/
|
||||
void OnStartRequest(in nsISupports ctxt);
|
||||
|
||||
void OnStopRequest(in nsISupports ctxt,
|
||||
in nsresult status,
|
||||
in wstring errorMsg);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// 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.
|
||||
extern NS_NET nsresult
|
||||
NS_NewAsyncStreamObserver(nsIStreamObserver* *result,
|
||||
nsIEventQueue* eventQueue,
|
||||
nsIStreamObserver* receiver);
|
||||
|
||||
// Generic status codes for OnStopBinding:
|
||||
#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)
|
||||
|
||||
%}
|
||||
122
mozilla/netwerk/base/public/nsIURI.idl
Normal file
122
mozilla/netwerk/base/public/nsIURI.idl
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- 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.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 "nsISupports.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.
|
||||
*/
|
||||
|
||||
[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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Returns a new URI string that merges the relative part with defaults
|
||||
* from the current URI's location. If the relative part actually
|
||||
* specifies an absolute URI, the string is returned as is.
|
||||
*/
|
||||
string MakeAbsolute(in string relativePart);
|
||||
};
|
||||
|
||||
83
mozilla/netwerk/base/public/nsIURL.idl
Normal file
83
mozilla/netwerk/base/public/nsIURL.idl
Normal file
@@ -0,0 +1,83 @@
|
||||
/* -*- 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.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"
|
||||
|
||||
interface nsIChannel;
|
||||
interface nsIEventSinkGetter;
|
||||
|
||||
[scriptable, uuid(78406350-0ce5-11d3-9331-00104ba0fd40)]
|
||||
interface nsIURL : nsIURI
|
||||
{
|
||||
// The following 4 attributes breakdown the Path attribute
|
||||
// into its constituents...
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
attribute string FileName;
|
||||
|
||||
/**
|
||||
* Returns the query portion (the part after the "?") of the URL.
|
||||
* If there isn't one, the empty string is returned.
|
||||
*/
|
||||
attribute string Query;
|
||||
|
||||
/**
|
||||
* Returns the reference portion (the part after the "#") of the URL.
|
||||
* If there isn't one, the empty string is returned.
|
||||
*/
|
||||
attribute string Ref;
|
||||
|
||||
};
|
||||
|
||||
%{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 \
|
||||
{ /* 46fc2a26-ff66-11d2-8ccb-0060b0fc14a3 */ \
|
||||
0x46fc2a26, \
|
||||
0xff66, \
|
||||
0x11d2, \
|
||||
{0x8c, 0xcb, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
%}
|
||||
54
mozilla/netwerk/base/src/Makefile.in
Normal file
54
mozilla/netwerk/base/src/Makefile.in
Normal file
@@ -0,0 +1,54 @@
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
LIBRARY_NAME = netwerkbase_s
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
CPPSRCS = \
|
||||
nsAsyncStreamListener.cpp \
|
||||
nsSyncStreamListener.cpp \
|
||||
nsIOService.cpp \
|
||||
nsSocketTransport.cpp \
|
||||
nsSocketTransportStreams.cpp \
|
||||
nsSocketTransportService.cpp \
|
||||
nsStandardUrl.cpp \
|
||||
nsNetModuleMgr.cpp \
|
||||
nsNetModRegEntry.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
MKSHLIB :=
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static l\ib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
52
mozilla/netwerk/base/src/makefile.win
Normal file
52
mozilla/netwerk/base/src/makefile.win
Normal file
@@ -0,0 +1,52 @@
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
LCFLAGS = -DWIN32_LEAN_AND_MEAN -D_IMPL_NS_NET
|
||||
|
||||
LIBRARY_NAME=netwerkbase_s
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsAsyncStreamListener.obj \
|
||||
.\$(OBJDIR)\nsSyncStreamListener.obj \
|
||||
.\$(OBJDIR)\nsIOService.obj \
|
||||
.\$(OBJDIR)\nsSocketTransport.obj \
|
||||
.\$(OBJDIR)\nsSocketTransportStreams.obj \
|
||||
.\$(OBJDIR)\nsSocketTransportService.obj \
|
||||
.\$(OBJDIR)\nsStandardUrl.obj \
|
||||
.\$(OBJDIR)\nsNetModuleMgr.obj \
|
||||
.\$(OBJDIR)\nsNetModRegEntry.obj \
|
||||
$(NULL)
|
||||
|
||||
INCS = $(INCS) \
|
||||
-I$(DEPTH)\dist\include \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
540
mozilla/netwerk/base/src/nsAsyncStreamListener.cpp
Normal file
540
mozilla/netwerk/base/src/nsAsyncStreamListener.cpp
Normal file
@@ -0,0 +1,540 @@
|
||||
/* -*- 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.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 "nsIStreamObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
class nsAsyncStreamObserver : public nsIStreamObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStreamObserver methods:
|
||||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
NS_IMETHOD OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg);
|
||||
NS_IMETHOD OnStartRequest(nsISupports* context);
|
||||
NS_IMETHOD OnStopRequest(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg);
|
||||
|
||||
// nsAsyncStreamObserver methods:
|
||||
nsAsyncStreamObserver(nsIEventQueue* aEventQ)
|
||||
: mReceiver(nsnull), mStatus(NS_OK)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mEventQueue = aEventQ;
|
||||
NS_IF_ADDREF(mEventQueue);
|
||||
}
|
||||
|
||||
virtual ~nsAsyncStreamObserver();
|
||||
|
||||
void Init(nsIStreamObserver* aListener) {
|
||||
mReceiver = aListener;
|
||||
NS_ADDREF(mReceiver);
|
||||
}
|
||||
|
||||
nsISupports* GetReceiver() { return mReceiver; }
|
||||
nsresult GetStatus() { return mStatus; }
|
||||
void SetStatus(nsresult value) { mStatus = value; }
|
||||
|
||||
protected:
|
||||
nsIEventQueue* mEventQueue;
|
||||
nsIStreamObserver* mReceiver;
|
||||
nsresult mStatus;
|
||||
};
|
||||
|
||||
|
||||
class nsAsyncStreamListener : public nsAsyncStreamObserver,
|
||||
public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnStartBinding(nsISupports* context)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStartBinding(context);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStopBinding(context, aStatus, aMsg);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStartRequest(nsISupports* context)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStartRequest(context);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStopRequest(context, aStatus, aMsg);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
// nsAsyncStreamListener methods:
|
||||
nsAsyncStreamListener(nsIEventQueue* aEventQ)
|
||||
: nsAsyncStreamObserver(aEventQ) {}
|
||||
|
||||
void Init(nsIStreamListener* aListener) {
|
||||
mReceiver = aListener;
|
||||
NS_ADDREF(mReceiver);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsStreamListenerEvent : public PLEvent
|
||||
{
|
||||
public:
|
||||
nsStreamListenerEvent(nsAsyncStreamObserver* listener,
|
||||
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;
|
||||
nsISupports* mContext;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsStreamListenerEvent::nsStreamListenerEvent(nsAsyncStreamObserver* listener,
|
||||
nsISupports* context)
|
||||
: mListener(listener), mContext(context)
|
||||
{
|
||||
NS_ADDREF(mListener);
|
||||
NS_IF_ADDREF(mContext);
|
||||
}
|
||||
|
||||
nsStreamListenerEvent::~nsStreamListenerEvent()
|
||||
{
|
||||
NS_RELEASE(mListener);
|
||||
NS_IF_RELEASE(mContext);
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsStreamListenerEvent::HandlePLEvent(PLEvent* aEvent)
|
||||
{
|
||||
// WARNING: This is a dangerous cast since it must adjust the pointer
|
||||
// to compensate for the vtable...
|
||||
nsStreamListenerEvent *ev = (nsStreamListenerEvent*)aEvent;
|
||||
|
||||
nsresult rv = ev->HandleEvent();
|
||||
ev->mListener->SetStatus(rv);
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsStreamListenerEvent::DestroyPLEvent(PLEvent* aEvent)
|
||||
{
|
||||
// WARNING: This is a dangerous cast since it must adjust the pointer
|
||||
// to compensate for the vtable...
|
||||
nsStreamListenerEvent *ev = (nsStreamListenerEvent*)aEvent;
|
||||
|
||||
delete ev;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStreamListenerEvent::Fire(nsIEventQueue* aEventQueue)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aEventQueue, "nsIEventQueue for thread is null");
|
||||
|
||||
PL_InitEvent(this, nsnull,
|
||||
(PLHandleEventProc) nsStreamListenerEvent::HandlePLEvent,
|
||||
(PLDestroyEventProc) nsStreamListenerEvent::DestroyPLEvent);
|
||||
|
||||
PRStatus status = aEventQueue->PostEvent(this);
|
||||
return status == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsAsyncStreamObserver::~nsAsyncStreamObserver()
|
||||
{
|
||||
NS_RELEASE(mReceiver);
|
||||
NS_IF_RELEASE(mEventQueue);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAsyncStreamObserver, nsIStreamObserver::GetIID());
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsAsyncStreamListener,
|
||||
nsAsyncStreamObserver,
|
||||
nsIStreamListener);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnStartBinding...
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnStartBindingEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnStartBindingEvent(nsAsyncStreamObserver* listener,
|
||||
nsISupports* context)
|
||||
: nsStreamListenerEvent(listener, context), mContentType(nsnull) {}
|
||||
virtual ~nsOnStartBindingEvent();
|
||||
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
char* mContentType;
|
||||
};
|
||||
|
||||
nsOnStartBindingEvent::~nsOnStartBindingEvent()
|
||||
{
|
||||
if (mContentType)
|
||||
delete[] mContentType;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnStartBindingEvent::HandleEvent()
|
||||
{
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
|
||||
return receiver->OnStartBinding(mContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::OnStartBinding(nsISupports* context)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStartBindingEvent* event =
|
||||
new nsOnStartBindingEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnStopBinding
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnStopBindingEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnStopBindingEvent(nsAsyncStreamObserver* listener,
|
||||
nsISupports* context)
|
||||
: nsStreamListenerEvent(listener, context),
|
||||
mStatus(NS_OK), mMessage(nsnull) {}
|
||||
virtual ~nsOnStopBindingEvent();
|
||||
|
||||
nsresult Init(nsresult status, const PRUnichar* aMsg);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsresult mStatus;
|
||||
PRUnichar* mMessage;
|
||||
};
|
||||
|
||||
nsOnStopBindingEvent::~nsOnStopBindingEvent()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnStopBindingEvent::Init(nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
mStatus = status;
|
||||
mMessage = (PRUnichar*)aMsg;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnStopBindingEvent::HandleEvent()
|
||||
{
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
|
||||
return receiver->OnStopBinding(mContext, mStatus, mMessage);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStopBindingEvent* event =
|
||||
new nsOnStopBindingEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aStatus, aMsg);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnStartRequest...
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsOnStartRequestEvent : public nsStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsOnStartRequestEvent(nsAsyncStreamObserver* listener,
|
||||
nsISupports* context)
|
||||
: nsStreamListenerEvent(listener, context), mContentType(nsnull) {}
|
||||
virtual ~nsOnStartRequestEvent();
|
||||
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
char* mContentType;
|
||||
};
|
||||
|
||||
nsOnStartRequestEvent::~nsOnStartRequestEvent()
|
||||
{
|
||||
if (mContentType)
|
||||
delete[] mContentType;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnStartRequestEvent::HandleEvent()
|
||||
{
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
|
||||
return receiver->OnStartRequest(mContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::OnStartRequest(nsISupports* context)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStartRequestEvent* event =
|
||||
new nsOnStartRequestEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
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)
|
||||
: nsStreamListenerEvent(listener, 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()
|
||||
{
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener->GetReceiver();
|
||||
return receiver->OnStopRequest(mContext, mStatus, mMessage);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamObserver::OnStopRequest(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStopRequestEvent* event =
|
||||
new nsOnStopRequestEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aStatus, aMsg);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
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,
|
||||
nsISupports* context)
|
||||
: nsStreamListenerEvent(listener, context),
|
||||
mIStream(nsnull), mLength(0) {}
|
||||
virtual ~nsOnDataAvailableEvent();
|
||||
|
||||
nsresult Init(nsIBufferInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsIBufferInputStream* mIStream;
|
||||
PRUint32 mSourceOffset;
|
||||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
nsOnDataAvailableEvent::~nsOnDataAvailableEvent()
|
||||
{
|
||||
NS_RELEASE(mIStream);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnDataAvailableEvent::Init(nsIBufferInputStream* aIStream, PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
mSourceOffset = aSourceOffset;
|
||||
mLength = aLength;
|
||||
mIStream = aIStream;
|
||||
NS_ADDREF(mIStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOnDataAvailableEvent::HandleEvent()
|
||||
{
|
||||
nsIStreamListener* receiver = (nsIStreamListener*)mListener->GetReceiver();
|
||||
return receiver->OnDataAvailable(mContext, mIStream, mSourceOffset, mLength);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAsyncStreamListener::OnDataAvailable(nsISupports* context,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnDataAvailableEvent* event =
|
||||
new nsOnDataAvailableEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aIStream, aSourceOffset, aLength);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_NET nsresult
|
||||
NS_NewAsyncStreamObserver(nsIStreamObserver* *result,
|
||||
nsIEventQueue* eventQueue,
|
||||
nsIStreamObserver* receiver)
|
||||
{
|
||||
nsAsyncStreamObserver* l =
|
||||
new nsAsyncStreamObserver(eventQueue);
|
||||
if (l == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
l->Init(receiver);
|
||||
NS_ADDREF(l);
|
||||
*result = l;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_NET nsresult
|
||||
NS_NewAsyncStreamListener(nsIStreamListener* *result,
|
||||
nsIEventQueue* eventQueue,
|
||||
nsIStreamListener* receiver)
|
||||
{
|
||||
nsAsyncStreamListener* l =
|
||||
new nsAsyncStreamListener(eventQueue);
|
||||
if (l == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
l->Init(receiver);
|
||||
NS_ADDREF(l);
|
||||
*result = l;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
368
mozilla/netwerk/base/src/nsFileTransport.cpp
Normal file
368
mozilla/netwerk/base/src/nsFileTransport.cpp
Normal file
@@ -0,0 +1,368 @@
|
||||
/* -*- 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.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 "nsFileTransport.h"
|
||||
#include "nsFileTransportService.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFileTransport methods:
|
||||
|
||||
nsFileTransport::nsFileTransport()
|
||||
: mPath(nsnull), mContext(nsnull), mListener(nsnull), mState(ENDED),
|
||||
mSuspended(PR_FALSE), mFileStream(nsnull), mBuffer(nsnull),
|
||||
mBufferStream(nsnull), mStatus(NS_OK), mService(nsnull), mSourceOffset(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mMonitor = PR_NewMonitor();
|
||||
}
|
||||
|
||||
nsFileTransport::~nsFileTransport()
|
||||
{
|
||||
if (mPath) nsCRT::free(mPath);
|
||||
PR_DestroyMonitor(mMonitor);
|
||||
NS_IF_RELEASE(mListener);
|
||||
NS_IF_RELEASE(mContext);
|
||||
NS_IF_RELEASE(mService);
|
||||
NS_IF_RELEASE(mFileStream);
|
||||
NS_IF_RELEASE(mBuffer);
|
||||
NS_IF_RELEASE(mBufferStream);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransport::Init(const char* path,
|
||||
nsFileTransportService* service)
|
||||
{
|
||||
mPath = nsCRT::strdup(path);
|
||||
if (mPath == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mService = service;
|
||||
NS_ADDREF(mService);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransport::Init(nsISupports* context,
|
||||
nsIStreamListener* listener,
|
||||
State state, PRUint32 startPosition, PRInt32 count)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!mMonitor)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
PR_EnterMonitor(mMonitor);
|
||||
|
||||
if (mState != ENDED)
|
||||
rv = NS_ERROR_FAILURE;
|
||||
else {
|
||||
mContext = context;
|
||||
NS_IF_ADDREF(mContext);
|
||||
|
||||
mListener = listener;
|
||||
NS_ADDREF(mListener);
|
||||
|
||||
mState = state;
|
||||
mSourceOffset = startPosition;
|
||||
mAmount = count;
|
||||
}
|
||||
PR_ExitMonitor(mMonitor);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsFileTransport);
|
||||
NS_IMPL_RELEASE(nsFileTransport);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::QueryInterface(const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsIChannel::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIChannel*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsIRunnable::GetIID())) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIRunnable*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::Cancel(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!mMonitor)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
PR_EnterMonitor(mMonitor);
|
||||
mStatus = NS_BINDING_ABORTED;
|
||||
if (mSuspended) {
|
||||
Resume();
|
||||
}
|
||||
mState = ENDING;
|
||||
PR_ExitMonitor(mMonitor);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::Suspend(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!mMonitor)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
PR_EnterMonitor(mMonitor);
|
||||
if (!mSuspended) {
|
||||
// XXX close the stream here?
|
||||
mStatus = mService->Suspend(this);
|
||||
mSuspended = PR_TRUE;
|
||||
}
|
||||
PR_ExitMonitor(mMonitor);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::Resume(void)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!mMonitor)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
PR_EnterMonitor(mMonitor);
|
||||
if (!mSuspended) {
|
||||
// XXX re-open the stream and seek here?
|
||||
mStatus = mService->Resume(this);
|
||||
mSuspended = PR_FALSE;
|
||||
}
|
||||
PR_ExitMonitor(mMonitor);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::GetURI(nsIURI* *aURL)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamListener *listener)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsIStreamListener* asyncListener;
|
||||
rv = NS_NewAsyncStreamListener(&asyncListener, eventQueue, listener);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = Init(ctxt, asyncListener, START_READ, startPosition, readCount);
|
||||
NS_RELEASE(asyncListener);
|
||||
|
||||
rv = mService->DispatchRequest(this);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::AsyncWrite(nsIInputStream* fromStream,
|
||||
PRUint32 startPosition,
|
||||
PRInt32 writeCount,
|
||||
nsISupports* context,
|
||||
nsIEventQueue* appEventQueue,
|
||||
nsIStreamObserver* observer)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::OpenInputStream(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsIInputStream* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ASSERTION(startPosition == 0, "fix me");
|
||||
|
||||
nsIStreamListener* syncListener;
|
||||
nsIBufferInputStream* inStr;
|
||||
rv = NS_NewSyncStreamListener(&syncListener, &inStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = Init(nsnull, syncListener, START_READ, 0, -1);
|
||||
NS_RELEASE(syncListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(inStr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mService->DispatchRequest(this);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(inStr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = inStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::OpenOutputStream(PRUint32 startPosition, nsIOutputStream* *result)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
nsFileTransport::Process(void)
|
||||
{
|
||||
if (!mMonitor) {
|
||||
mState = ENDING;
|
||||
return;
|
||||
}
|
||||
PR_EnterMonitor(mMonitor);
|
||||
switch (mState) {
|
||||
case START_READ: {
|
||||
nsISupports* fs;
|
||||
nsFileSpec spec(mPath);
|
||||
|
||||
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = NS_NewTypicalInputFileStream(&fs, spec);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = fs->QueryInterface(nsIInputStream::GetIID(), (void**)&mFileStream);
|
||||
NS_RELEASE(fs);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = NS_NewBuffer(&mBuffer, NS_FILE_TRANSPORT_BUFFER_SIZE,
|
||||
NS_FILE_TRANSPORT_BUFFER_SIZE);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = NS_NewBufferInputStream(&mBufferStream, mBuffer, PR_FALSE);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mState = READING;
|
||||
break;
|
||||
}
|
||||
case READING: {
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
PRUint32 amt;
|
||||
nsIInputStream* inStr = NS_STATIC_CAST(nsIInputStream*, mFileStream);
|
||||
PRUint32 inLen;
|
||||
mStatus = inStr->GetLength(&inLen);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = mBuffer->WriteFrom(inStr, inLen, &amt);
|
||||
if (mStatus == NS_BASE_STREAM_EOF) goto error;
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
// and feed the buffer to the application via the byte buffer stream:
|
||||
// XXX maybe amt should be mBufferStream->GetLength():
|
||||
mStatus = mListener->OnDataAvailable(mContext, mBufferStream, mSourceOffset, amt);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mSourceOffset += amt;
|
||||
|
||||
// stay in the READING state
|
||||
break;
|
||||
}
|
||||
case START_WRITE: {
|
||||
nsISupports* fs;
|
||||
nsFileSpec spec(mPath);
|
||||
|
||||
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = NS_NewTypicalOutputFileStream(&fs, spec);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = fs->QueryInterface(nsIOutputStream::GetIID(), (void**)&mFileStream);
|
||||
NS_RELEASE(fs);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = NS_NewBuffer(&mBuffer, NS_FILE_TRANSPORT_BUFFER_SIZE,
|
||||
NS_FILE_TRANSPORT_BUFFER_SIZE);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = NS_NewBufferInputStream(&mBufferStream, mBuffer, PR_FALSE);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mState = WRITING;
|
||||
break;
|
||||
}
|
||||
case WRITING: {
|
||||
break;
|
||||
}
|
||||
case ENDING: {
|
||||
NS_IF_RELEASE(mBufferStream);
|
||||
mBufferStream = nsnull;
|
||||
NS_IF_RELEASE(mFileStream);
|
||||
mFileStream = nsnull;
|
||||
|
||||
// XXX where do we get the error message?
|
||||
(void)mListener->OnStopBinding(mContext, mStatus, nsnull);
|
||||
|
||||
mState = ENDED;
|
||||
break;
|
||||
}
|
||||
case ENDED: {
|
||||
NS_NOTREACHED("trying to continue an ended file transfer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
PR_ExitMonitor(mMonitor);
|
||||
return;
|
||||
|
||||
error:
|
||||
mState = ENDING;
|
||||
PR_ExitMonitor(mMonitor);
|
||||
return;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::Run(void)
|
||||
{
|
||||
while (mState != ENDED && !mSuspended) {
|
||||
Process();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
102
mozilla/netwerk/base/src/nsFileTransport.h
Normal file
102
mozilla/netwerk/base/src/nsFileTransport.h
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.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 nsFileTransport_h___
|
||||
#define nsFileTransport_h___
|
||||
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "prmon.h"
|
||||
|
||||
class nsFileTransportService;
|
||||
class nsIBaseStream;
|
||||
class nsIString;
|
||||
class nsIBuffer;
|
||||
class nsIBufferInputStream;
|
||||
|
||||
class nsFileTransport : public nsIChannel, public nsIRunnable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRequest methods:
|
||||
NS_IMETHOD Cancel(void);
|
||||
NS_IMETHOD Suspend(void);
|
||||
NS_IMETHOD Resume(void);
|
||||
|
||||
// nsIChannel methods:
|
||||
NS_IMETHOD GetURI(nsIURI * *aURL);
|
||||
NS_IMETHOD OpenInputStream(PRUint32 startPosition, PRInt32 readCount, nsIInputStream **_retval);
|
||||
NS_IMETHOD OpenOutputStream(PRUint32 startPosition, nsIOutputStream **_retval);
|
||||
NS_IMETHOD AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamListener *listener);
|
||||
NS_IMETHOD AsyncWrite(nsIInputStream *fromStream,
|
||||
PRUint32 startPosition, PRInt32 writeCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamObserver *observer);
|
||||
|
||||
// nsIRunnable methods:
|
||||
NS_IMETHOD Run(void);
|
||||
|
||||
// nsFileTransport methods:
|
||||
nsFileTransport();
|
||||
virtual ~nsFileTransport();
|
||||
|
||||
enum State {
|
||||
START_READ,
|
||||
READING,
|
||||
START_WRITE,
|
||||
WRITING,
|
||||
ENDING,
|
||||
ENDED
|
||||
};
|
||||
|
||||
nsresult Init(const char* path,
|
||||
nsFileTransportService* service);
|
||||
nsresult Init(nsISupports* context,
|
||||
nsIStreamListener* listener,
|
||||
State state, PRUint32 startPosition, PRInt32 count);
|
||||
void Process(void);
|
||||
|
||||
protected:
|
||||
char* mPath;
|
||||
nsISupports* mContext;
|
||||
nsIStreamListener* mListener;
|
||||
nsFileTransportService* mService;
|
||||
State mState;
|
||||
PRBool mSuspended;
|
||||
|
||||
// state variables:
|
||||
nsIBaseStream* mFileStream; // cast to nsIInputStream/nsIOutputStream for reading/writing
|
||||
nsIBuffer* mBuffer;
|
||||
nsIBufferInputStream* mBufferStream;
|
||||
nsresult mStatus;
|
||||
PRUint32 mSourceOffset;
|
||||
PRInt32 mAmount;
|
||||
|
||||
private:
|
||||
PRMonitor* mMonitor;
|
||||
};
|
||||
|
||||
#define NS_FILE_TRANSPORT_BUFFER_SIZE (4*1024)
|
||||
|
||||
#endif /* nsFileTransport_h___ */
|
||||
132
mozilla/netwerk/base/src/nsFileTransportService.cpp
Normal file
132
mozilla/netwerk/base/src/nsFileTransportService.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
/* -*- 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.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 "nsFileTransportService.h"
|
||||
#include "nsFileTransport.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsIFileStream.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFileTransportService methods:
|
||||
|
||||
nsFileTransportService::nsFileTransportService()
|
||||
: mPool(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = NS_NewThreadPool(&mPool, NS_FILE_TRANSPORT_WORKER_COUNT,
|
||||
NS_FILE_TRANSPORT_WORKER_COUNT, 8*1024);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsFileTransportService::~nsFileTransportService()
|
||||
{
|
||||
// this will wait for all outstanding requests to be processed, then
|
||||
// join with the worker threads, and finally free the pool:
|
||||
NS_IF_RELEASE(mPool);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsFileTransportService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsFileTransportService* trans = new nsFileTransportService();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(trans);
|
||||
nsresult rv = trans->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = trans->QueryInterface(aIID, aResult);
|
||||
}
|
||||
NS_RELEASE(trans);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsFileTransportService, nsIFileTransportService::GetIID());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransportService::CreateTransport(const char* path,
|
||||
nsIChannel* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsFileTransport* trans = new nsFileTransport();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = trans->Init(path, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete trans;
|
||||
return rv;
|
||||
}
|
||||
NS_ADDREF(trans);
|
||||
*result = trans;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransportService::ProcessPendingRequests(void)
|
||||
{
|
||||
return mPool->ProcessPendingRequests();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::DispatchRequest(nsIRunnable* runnable)
|
||||
{
|
||||
return mPool->DispatchRequest(runnable);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::Suspend(nsFileTransport* request)
|
||||
{
|
||||
nsresult rv;
|
||||
if (mSuspended == nsnull) {
|
||||
rv = NS_NewISupportsArray(&mSuspended);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mSuspended->AppendElement(NS_STATIC_CAST(nsIChannel*, request));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransportService::Resume(nsFileTransport* request)
|
||||
{
|
||||
nsresult rv;
|
||||
if (mSuspended == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
// XXX RemoveElement returns a bool instead of nsresult!
|
||||
PRBool removed = mSuspended->RemoveElement(NS_STATIC_CAST(nsIChannel*, request));
|
||||
rv = removed ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// restart the request
|
||||
rv = mPool->DispatchRequest(NS_STATIC_CAST(nsIRunnable*, request));
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
64
mozilla/netwerk/base/src/nsFileTransportService.h
Normal file
64
mozilla/netwerk/base/src/nsFileTransportService.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- 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.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 nsFileTransportService_h___
|
||||
#define nsFileTransportService_h___
|
||||
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
class nsFileTransport;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_FILE_TRANSPORT_WORKER_COUNT 4
|
||||
|
||||
class nsFileTransportService : public nsIFileTransportService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFileTransportService methods:
|
||||
NS_IMETHOD CreateTransport(const char* path,
|
||||
nsIChannel* *result);
|
||||
NS_IMETHOD ProcessPendingRequests(void);
|
||||
|
||||
// nsFileTransportService methods:
|
||||
nsFileTransportService();
|
||||
virtual ~nsFileTransportService();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
nsresult DispatchRequest(nsIRunnable* runnable);
|
||||
nsresult Suspend(nsFileTransport* request);
|
||||
nsresult Resume(nsFileTransport* request);
|
||||
|
||||
protected:
|
||||
nsIThreadPool* mPool;
|
||||
nsISupportsArray* mSuspended;
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsFileTransportService_h___ */
|
||||
359
mozilla/netwerk/base/src/nsIOService.cpp
Normal file
359
mozilla/netwerk/base/src/nsIOService.cpp
Normal file
@@ -0,0 +1,359 @@
|
||||
/* -*- 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.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 "nsIOService.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nscore.h"
|
||||
#include "nsString2.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "prprf.h"
|
||||
#include "prmem.h" // for PR_Malloc
|
||||
#include <ctype.h> // for isalpha
|
||||
#include "nsIFileProtocolHandler.h" // for NewChannelFromNativePath
|
||||
|
||||
static NS_DEFINE_CID(kFileTransportService, NS_FILETRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsIOService::nsIOService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsIOService::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIOService::~nsIOService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsIOService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsIOService* ios = new nsIOService();
|
||||
if (ios == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(ios);
|
||||
nsresult rv = ios->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(ios);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsIOService, nsIIOService::GetIID());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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];
|
||||
nsAutoString2 progID(NS_NETWORK_PROTOCOL_PROGID_PREFIX);
|
||||
progID += scheme;
|
||||
progID.ToCString(buf, MAX_NET_PROGID_LENGTH);
|
||||
|
||||
nsIProtocolHandler* handler;
|
||||
rv = nsServiceManager::GetService(buf, nsIProtocolHandler::GetIID(),
|
||||
(nsISupports**)&handler);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = handler;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
GetScheme(const char* inURI, char* *scheme)
|
||||
{
|
||||
// search for something up to a colon, and call it the scheme
|
||||
char c;
|
||||
const char* URI = inURI;
|
||||
PRUint32 i = 0;
|
||||
PRUint32 length = 0;
|
||||
while ((c = *URI++) != '\0') {
|
||||
if (c == ':') {
|
||||
char* newScheme = (char *)PR_Malloc(length+1);
|
||||
if (newScheme == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCRT::memcpy(newScheme, inURI, length);
|
||||
newScheme[length] = '\0';
|
||||
*scheme = newScheme;
|
||||
return NS_OK;
|
||||
}
|
||||
else if (isalpha(c)) {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE; // no colon
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewURI(const char* aSpec, nsIURI* aBaseURI,
|
||||
nsIURI* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
char* scheme;
|
||||
rv = GetScheme(aSpec, &scheme);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (aBaseURI)
|
||||
rv = aBaseURI->GetScheme(&scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = GetProtocolHandler(scheme, getter_AddRefs(handler));
|
||||
nsCRT::free(scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = handler->NewURI(aSpec, aBaseURI, result);
|
||||
//NS_RELEASE(handler);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannelFromURI(const char* verb, nsIURI *aURI,
|
||||
nsIEventSinkGetter *eventSinkGetter,
|
||||
nsIChannel **result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
char* scheme;
|
||||
rv = aURI->GetScheme(&scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = GetProtocolHandler(scheme, getter_AddRefs(handler));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIEventQueue> eventQ;
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueService, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(),
|
||||
getter_AddRefs(eventQ));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIChannel* channel;
|
||||
rv = handler->NewChannel(verb, aURI, eventSinkGetter, eventQ,
|
||||
&channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = channel;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannel(const char* verb, const char *aSpec,
|
||||
nsIURI *aBaseURI,
|
||||
nsIEventSinkGetter *eventSinkGetter,
|
||||
nsIChannel **result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIURI* uri;
|
||||
rv = NewURI(aSpec, aBaseURI, &uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = NewChannelFromURI(verb, uri, eventSinkGetter, result);
|
||||
NS_RELEASE(uri);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::MakeAbsolute(const char *aSpec,
|
||||
nsIURI *aBaseURI,
|
||||
char **result)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ASSERTION(aBaseURI, "It doesn't make sense to not supply a base URI");
|
||||
|
||||
char* scheme;
|
||||
rv = GetScheme(aSpec, &scheme);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// if aSpec has a scheme, then it's already absolute
|
||||
*result = nsCRT::strdup(aSpec);
|
||||
if (*result == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// else ask the protocol handler for the base URI to deal with it
|
||||
rv = aBaseURI->GetScheme(&scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIProtocolHandler> handler;
|
||||
rv = GetProtocolHandler(scheme, getter_AddRefs(handler));
|
||||
nsCRT::free(scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = handler->MakeAbsolute(aSpec, aBaseURI, result);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetAppCodeName(PRUnichar* *aAppCodeName)
|
||||
{
|
||||
*aAppCodeName = mAppCodeName.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetAppVersion(PRUnichar* *aAppVersion)
|
||||
{
|
||||
*aAppVersion = mAppVersion.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetAppName(PRUnichar* *aAppName)
|
||||
{
|
||||
*aAppName = mAppName.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetLanguage(PRUnichar* *aLanguage)
|
||||
{
|
||||
*aLanguage = mAppLanguage.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetPlatform(PRUnichar* *aPlatform)
|
||||
{
|
||||
*aPlatform = mAppPlatform.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetUserAgent(PRUnichar* *aUserAgent)
|
||||
{
|
||||
// XXX this should load the http module and ask for the user agent string from it.
|
||||
char buf[200];
|
||||
PR_snprintf(buf, 200, "%.100s/%.90s", mAppCodeName.GetBuffer(), mAppVersion.GetBuffer());
|
||||
nsAutoString2 aUA(buf);
|
||||
*aUserAgent = aUA.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewAsyncStreamObserver(nsIStreamObserver *receiver, nsIEventQueue *eventQueue,
|
||||
nsIStreamObserver **result)
|
||||
{
|
||||
return NS_NewAsyncStreamObserver(result, eventQueue, receiver);
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewAsyncStreamListener(nsIStreamListener *receiver, nsIEventQueue *eventQueue,
|
||||
nsIStreamListener **result)
|
||||
{
|
||||
return NS_NewAsyncStreamListener(result, eventQueue, receiver);
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewSyncStreamListener(nsIBufferInputStream **inStream,
|
||||
nsIBufferOutputStream **outStream,
|
||||
nsIStreamListener **listener)
|
||||
{
|
||||
return NS_NewSyncStreamListener(inStream, outStream, listener);
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannelFromNativePath(const char *nativePath, nsIFileChannel **result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIProtocolHandler* handler;
|
||||
rv = GetProtocolHandler("file", &handler);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIFileProtocolHandler* fileHandler = nsnull;
|
||||
rv = handler->QueryInterface(nsIFileProtocolHandler::GetIID(),
|
||||
(void**)&fileHandler);
|
||||
NS_RELEASE(handler);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIFileChannel* channel;
|
||||
rv = fileHandler->NewChannelFromNativePath(nativePath, &channel);
|
||||
NS_RELEASE(fileHandler);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = channel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// HELPER ROUTINES
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if 0
|
||||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
|
||||
|
||||
nsresult NS_NewURI(nsIURI** aInstancePtrResult,
|
||||
const char *aSpec,
|
||||
nsIURI* aBaseURI)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsINetService *inet = nsnull;
|
||||
nsresult rv = nsServiceManager::GetService(kNetServiceCID,
|
||||
kINetServiceIID,
|
||||
(nsISupports **)&inet);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = inet->NewURI(aSpec, aInstancePtrResult, aBaseURI);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsServiceManager::ReleaseService(kNetServiceCID, inet);
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
73
mozilla/netwerk/base/src/nsIOService.h
Normal file
73
mozilla/netwerk/base/src/nsIOService.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* -*- 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.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 nsIOService_h__
|
||||
#define nsIOService_h__
|
||||
|
||||
#include "nsIIOService.h"
|
||||
#include "nsString2.h"
|
||||
|
||||
class nsIOService : public nsIIOService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIIOService methods:
|
||||
NS_IMETHOD GetProtocolHandler(const char *scheme,
|
||||
nsIProtocolHandler **_retval);
|
||||
NS_IMETHOD MakeAbsolute(const char *aRelativeSpec,
|
||||
nsIURI *aBaseURI,
|
||||
char **_retval);
|
||||
NS_IMETHOD NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **_retval);
|
||||
NS_IMETHOD NewChannelFromURI(const char* verb, nsIURI *aURI,
|
||||
nsIEventSinkGetter *eventSinkGetter,
|
||||
nsIChannel **_retval);
|
||||
NS_IMETHOD NewChannel(const char* verb, const char *aSpec,
|
||||
nsIURI *aBaseURI,
|
||||
nsIEventSinkGetter *eventSinkGetter,
|
||||
nsIChannel **_retval);
|
||||
NS_IMETHOD GetAppCodeName(PRUnichar* *aAppCodeName);
|
||||
NS_IMETHOD GetAppVersion(PRUnichar* *aAppVersion);
|
||||
NS_IMETHOD GetAppName(PRUnichar* *aAppName);
|
||||
NS_IMETHOD GetLanguage(PRUnichar* *aLanguage);
|
||||
NS_IMETHOD GetPlatform(PRUnichar* *aPlatform);
|
||||
NS_IMETHOD GetUserAgent(PRUnichar* *aUserAgent);
|
||||
NS_IMETHOD NewAsyncStreamObserver(nsIStreamObserver *receiver, nsIEventQueue *eventQueue, nsIStreamObserver **_retval);
|
||||
NS_IMETHOD NewAsyncStreamListener(nsIStreamListener *receiver, nsIEventQueue *eventQueue, nsIStreamListener **_retval);
|
||||
NS_IMETHOD NewSyncStreamListener(nsIBufferInputStream **inStream, nsIBufferOutputStream **outStream, nsIStreamListener **_retval);
|
||||
NS_IMETHOD NewChannelFromNativePath(const char *nativePath, nsIFileChannel **_retval);
|
||||
|
||||
// nsIOService methods:
|
||||
nsIOService();
|
||||
virtual ~nsIOService();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
nsString2 mAppName;
|
||||
nsString2 mAppCodeName;
|
||||
nsString2 mAppVersion;
|
||||
nsString2 mAppLanguage;
|
||||
nsString2 mAppPlatform;
|
||||
};
|
||||
|
||||
#endif // nsIOService_h__
|
||||
140
mozilla/netwerk/base/src/nsNetModRegEntry.cpp
Normal file
140
mozilla/netwerk/base/src/nsNetModRegEntry.cpp
Normal file
@@ -0,0 +1,140 @@
|
||||
/* -*- 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.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 "nsNetModRegEntry.h"
|
||||
#include "plstr.h"
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsISupports
|
||||
//////////////////////////////
|
||||
NS_IMPL_ISUPPORTS(nsNetModRegEntry, nsINetModRegEntry::GetIID());
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsINetModRegEntry
|
||||
//////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetMNotify(nsINetNotify **aNotify) {
|
||||
*aNotify = mNotify;
|
||||
NS_ADDREF(*aNotify);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetMEventQ(nsIEventQueue **aEventQ) {
|
||||
*aEventQ = mEventQ;
|
||||
NS_ADDREF(*aEventQ);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetMTopic(char **aTopic) {
|
||||
*aTopic = new char [PL_strlen(mTopic) + 1];
|
||||
if (!*aTopic) return NS_ERROR_OUT_OF_MEMORY;
|
||||
PL_strcpy(*aTopic, mTopic);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetMCID(nsCID **aMCID) {
|
||||
*aMCID = &mCID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::Equals(nsINetModRegEntry* aEntry, PRBool *_retVal) {
|
||||
nsresult rv = NS_OK;
|
||||
PRBool retVal = PR_TRUE;
|
||||
|
||||
NS_ADDREF(aEntry);
|
||||
|
||||
char * topic = 0;
|
||||
nsINetNotify* notify = 0;
|
||||
nsIEventQueue* eventQ = 0;
|
||||
nsCID *cid = 0;
|
||||
|
||||
rv = aEntry->GetMTopic(&topic);
|
||||
if (NS_FAILED(rv)) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
if (PL_strcmp(topic, mTopic)) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
rv = aEntry->GetMNotify(¬ify);
|
||||
if (NS_FAILED(rv)) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
if (notify != mNotify) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
rv = aEntry->GetMEventQ(&eventQ);
|
||||
if (NS_FAILED(rv)) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
if (eventQ != mEventQ) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
rv = aEntry->GetMCID(&cid);
|
||||
if (NS_FAILED(rv)) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
if (!mCID.Equals(*cid)) {
|
||||
retVal = PR_FALSE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
NS_IF_RELEASE(notify);
|
||||
NS_IF_RELEASE(eventQ);
|
||||
*_retVal = retVal;
|
||||
NS_RELEASE(aEntry);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsNetModRegEntry
|
||||
//////////////////////////////
|
||||
|
||||
nsNetModRegEntry::nsNetModRegEntry(const char *aTopic, nsIEventQueue *aEventQ, nsINetNotify *aNotify, nsCID aCID)
|
||||
: mEventQ(aEventQ), mNotify(aNotify) {
|
||||
NS_INIT_REFCNT();
|
||||
mTopic = new char [PL_strlen(aTopic) + 1];
|
||||
PL_strcpy(mTopic, aTopic);
|
||||
NS_ADDREF(mEventQ);
|
||||
NS_ADDREF(mNotify);
|
||||
mCID = aCID;
|
||||
}
|
||||
|
||||
nsNetModRegEntry::~nsNetModRegEntry() {
|
||||
delete [] mTopic;
|
||||
NS_RELEASE(mEventQ);
|
||||
NS_RELEASE(mNotify);
|
||||
}
|
||||
48
mozilla/netwerk/base/src/nsNetModRegEntry.h
Normal file
48
mozilla/netwerk/base/src/nsNetModRegEntry.h
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.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 ___nsNetModRegEntry_h___
|
||||
#define ___nsNetModRegEntry_h___
|
||||
|
||||
#include "nsINetModRegEntry.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
class nsNetModRegEntry : nsINetModRegEntry {
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetModRegEntry
|
||||
NS_IMETHOD GetMNotify(nsINetNotify **aNotify);
|
||||
NS_IMETHOD GetMEventQ(nsIEventQueue **aEventQ);
|
||||
NS_IMETHOD GetMTopic(char **aTopic);
|
||||
NS_IMETHOD GetMCID(nsCID **aCID);
|
||||
|
||||
NS_IMETHOD Equals(nsINetModRegEntry* aEntry, PRBool *_retVal);
|
||||
|
||||
// nsNetModRegEntry
|
||||
nsNetModRegEntry(const char *aTopic, nsIEventQueue *aEventQ, nsINetNotify *aNotify, nsCID aCID);
|
||||
~nsNetModRegEntry();
|
||||
|
||||
char *mTopic;
|
||||
nsIEventQueue *mEventQ;
|
||||
nsINetNotify *mNotify;
|
||||
nsCID mCID;
|
||||
};
|
||||
|
||||
#endif //___nsNetModRegEntry_h___
|
||||
226
mozilla/netwerk/base/src/nsNetModuleMgr.cpp
Normal file
226
mozilla/netwerk/base/src/nsNetModuleMgr.cpp
Normal file
@@ -0,0 +1,226 @@
|
||||
/* -*- 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 "nsNetModuleMgr.h"
|
||||
#include "nsNetModRegEntry.h"
|
||||
#include "nsEnumeratorUtils.h" // for nsArrayEnumerator
|
||||
#include "nsString2.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
// Entry routines.
|
||||
static PRBool DeleteEntry(nsISupports *aElement, void *aData) {
|
||||
NS_ASSERTION(aElement, "null pointer");
|
||||
NS_RELEASE(aElement);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsISupports
|
||||
///////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsNetModuleMgr, nsINetModuleMgr::GetIID());
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsINetModuleMgr
|
||||
///////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::RegisterModule(const char *aTopic, nsIEventQueue *aEventQueue, nsINetNotify *aNotify, const nsCID * aCID) {
|
||||
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.
|
||||
|
||||
PR_Lock(mLock);
|
||||
nsINetModRegEntry* newEntryI = nsnull;
|
||||
nsNetModRegEntry *newEntry =
|
||||
new nsNetModRegEntry(aTopic, aEventQueue, aNotify, *aCID);
|
||||
if (!newEntry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = newEntry->QueryInterface(nsINetModRegEntry::GetIID(), (void**)&newEntryI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Check for a previous registration
|
||||
mEntries->Count(&cnt);
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsINetModRegEntry* curEntry = NS_STATIC_CAST(nsINetModRegEntry*, mEntries->ElementAt(i));
|
||||
PRBool same = PR_FALSE;
|
||||
rv = newEntryI->Equals(curEntry, &same);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_Unlock(mLock);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// if we've already got this one registered, yank it, and replace it with the new one
|
||||
if (same) {
|
||||
NS_RELEASE(curEntry);
|
||||
mEntries->DeleteElementAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mEntries->AppendElement(NS_STATIC_CAST(nsISupports*, newEntryI));
|
||||
PR_Unlock(mLock);
|
||||
NS_RELEASE(newEntryI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::UnregisterModule(const char *aTopic, nsIEventQueue *aEventQueue, nsINetNotify *aNotify, const nsCID * aCID) {
|
||||
|
||||
PR_Lock(mLock);
|
||||
nsresult rv;
|
||||
PRUint32 cnt;
|
||||
|
||||
nsINetModRegEntry* tmpEntryI = nsnull;
|
||||
nsNetModRegEntry *tmpEntry =
|
||||
new nsNetModRegEntry(aTopic, aEventQueue, aNotify, *aCID);
|
||||
if (!tmpEntry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = tmpEntry->QueryInterface(nsINetModRegEntry::GetIID(), (void**)&tmpEntryI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mEntries->Count(&cnt);
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsINetModRegEntry* curEntry = NS_STATIC_CAST(nsINetModRegEntry*, mEntries->ElementAt(i));
|
||||
NS_ADDREF(curEntry); // get our ref to it
|
||||
PRBool same = PR_FALSE;
|
||||
rv = tmpEntryI->Equals(curEntry, &same);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_Unlock(mLock);
|
||||
return rv;
|
||||
}
|
||||
if (same) {
|
||||
NS_RELEASE(curEntry);
|
||||
mEntries->DeleteElementAt(i);
|
||||
break;
|
||||
}
|
||||
NS_RELEASE(curEntry); // ditch our ref to it
|
||||
}
|
||||
PR_Unlock(mLock);
|
||||
NS_RELEASE(tmpEntryI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::EnumerateModules(const char *aTopic, nsISimpleEnumerator **aEnumerator) {
|
||||
|
||||
nsresult rv;
|
||||
PRUint32 cnt;
|
||||
char *topic = nsnull;
|
||||
|
||||
// get all the entries for this topic
|
||||
|
||||
PR_Lock(mLock);
|
||||
rv = mEntries->Count(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// create the new array
|
||||
nsISupportsArray *topicEntries = nsnull;
|
||||
rv = NS_NewISupportsArray(&topicEntries);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// run through the main entry array looking for topic matches.
|
||||
for (PRUint32 i = 0; i < cnt; i++) {
|
||||
nsINetModRegEntry *entry = NS_STATIC_CAST(nsINetModRegEntry*, mEntries->ElementAt(i));
|
||||
|
||||
rv = entry->GetMTopic(&topic);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(topicEntries);
|
||||
NS_RELEASE(entry);
|
||||
PR_Unlock(mLock);
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!PL_strcmp(aTopic, topic)) {
|
||||
delete [] topic;
|
||||
topic = nsnull;
|
||||
// found a match, add it to the list
|
||||
rv = topicEntries->AppendElement(NS_STATIC_CAST(nsISupports*, entry));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(topicEntries);
|
||||
NS_RELEASE(entry);
|
||||
PR_Unlock(mLock);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
delete [] topic;
|
||||
topic = nsnull;
|
||||
NS_RELEASE(entry);
|
||||
}
|
||||
|
||||
nsISimpleEnumerator *outEnum = nsnull;
|
||||
nsArrayEnumerator *arrEnum = new nsArrayEnumerator(topicEntries);
|
||||
NS_RELEASE(topicEntries);
|
||||
|
||||
if (!arrEnum) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = arrEnum->QueryInterface(nsISimpleEnumerator::GetIID(), (void**)&outEnum);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete arrEnum;
|
||||
return rv;
|
||||
}
|
||||
*aEnumerator = outEnum;
|
||||
PR_Unlock(mLock);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsNetModuleMgr
|
||||
///////////////////////////////////
|
||||
|
||||
nsNetModuleMgr::nsNetModuleMgr() {
|
||||
NS_INIT_REFCNT();
|
||||
NS_NewISupportsArray(&mEntries);
|
||||
mLock = PR_NewLock();
|
||||
}
|
||||
|
||||
nsNetModuleMgr::~nsNetModuleMgr() {
|
||||
if (mEntries) {
|
||||
mEntries->EnumerateForwards(DeleteEntry, nsnull);
|
||||
NS_RELEASE(mEntries);
|
||||
}
|
||||
PR_DestroyLock(mLock);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsNetModuleMgr::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
static nsNetModuleMgr* mgr = nsnull;
|
||||
if (!mgr) mgr = new nsNetModuleMgr();
|
||||
if (!mgr) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mgr);
|
||||
nsresult rv = mgr->QueryInterface(aIID, aResult);
|
||||
|
||||
// don't release our ref as this is a singleton service.
|
||||
//NS_RELEASE(mgr);
|
||||
return rv;
|
||||
}
|
||||
50
mozilla/netwerk/base/src/nsNetModuleMgr.h
Normal file
50
mozilla/netwerk/base/src/nsNetModuleMgr.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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.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 ___nsNetModuleMgr_h__
|
||||
#define ___nsNetModuleMgr_h__
|
||||
|
||||
#include "nsINetModuleMgr.h"
|
||||
#include "prlock.h"
|
||||
#include "nspr.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
class nsNetModuleMgr : public nsINetModuleMgr {
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetModuleMgr
|
||||
NS_IMETHOD RegisterModule(const char *aTopic, nsIEventQueue *aEventQueue, nsINetNotify *aNotify, const nsCID * aCID);
|
||||
NS_IMETHOD UnregisterModule(const char *aTopic, nsIEventQueue *aEventQueue, nsINetNotify *aNotify, const nsCID * aCID);
|
||||
NS_IMETHOD EnumerateModules(const char *aTopic, nsISimpleEnumerator **aEnumerator);
|
||||
|
||||
// nsNetModuleMgr
|
||||
nsNetModuleMgr();
|
||||
~nsNetModuleMgr();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
|
||||
nsISupportsArray *mEntries;
|
||||
PRLock *mLock;
|
||||
};
|
||||
|
||||
|
||||
#endif // ___nsNetModuleMgr_h__
|
||||
1153
mozilla/netwerk/base/src/nsSocketTransport.cpp
Normal file
1153
mozilla/netwerk/base/src/nsSocketTransport.cpp
Normal file
File diff suppressed because it is too large
Load Diff
148
mozilla/netwerk/base/src/nsSocketTransport.h
Normal file
148
mozilla/netwerk/base/src/nsSocketTransport.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* -*- 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.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 nsSocketTransport_h___
|
||||
#define nsSocketTransport_h___
|
||||
|
||||
#include "prclist.h"
|
||||
#include "prio.h"
|
||||
#include "prnetdb.h"
|
||||
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
|
||||
//
|
||||
// This is the size of the global buffer used by all nsSocketTransport
|
||||
// instances when reading from or writing to the network.
|
||||
//
|
||||
#define MAX_IO_BUFFER_SIZE 8192
|
||||
|
||||
//
|
||||
// This is the maximum amount of data that will be read into a stream before
|
||||
// another transport is processed...
|
||||
//
|
||||
#define MAX_IO_TRANSFER_SIZE 32768
|
||||
|
||||
enum nsSocketState {
|
||||
eSocketState_Created = 0,
|
||||
eSocketState_WaitDNS = 1,
|
||||
eSocketState_Closed = 2,
|
||||
eSocketState_WaitConnect = 3,
|
||||
eSocketState_Connected = 4,
|
||||
eSocketState_WaitReadWrite = 5,
|
||||
eSocketState_DoneRead = 6,
|
||||
eSocketState_DoneWrite = 7,
|
||||
eSocketState_Done = 8,
|
||||
eSocketState_Timeout = 9,
|
||||
eSocketState_Error = 10,
|
||||
eSocketState_Max = 11
|
||||
};
|
||||
|
||||
enum nsSocketOperation {
|
||||
eSocketOperation_None = 0,
|
||||
eSocketOperation_Connect = 1,
|
||||
eSocketOperation_ReadWrite = 2,
|
||||
eSocketOperation_Max = 3
|
||||
};
|
||||
|
||||
|
||||
// Forward declarations...
|
||||
class nsSocketTransportService;
|
||||
class nsSocketTransportStream;
|
||||
|
||||
class nsSocketTransport : public nsIChannel
|
||||
{
|
||||
public:
|
||||
// nsISupports methods:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRequest methods:
|
||||
NS_IMETHOD Cancel(void);
|
||||
NS_IMETHOD Suspend(void);
|
||||
NS_IMETHOD Resume(void);
|
||||
|
||||
// nsIChannel methods:
|
||||
NS_IMETHOD GetURI(nsIURI * *aURL);
|
||||
NS_IMETHOD OpenInputStream(PRUint32 startPosition, PRInt32 readCount, nsIInputStream **_retval);
|
||||
NS_IMETHOD OpenOutputStream(PRUint32 startPosition, nsIOutputStream **_retval);
|
||||
NS_IMETHOD AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamListener *listener);
|
||||
NS_IMETHOD AsyncWrite(nsIInputStream *fromStream,
|
||||
PRUint32 startPosition, PRInt32 writeCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamObserver *observer);
|
||||
|
||||
// nsSocketTransport methods:
|
||||
nsSocketTransport();
|
||||
virtual ~nsSocketTransport();
|
||||
|
||||
nsresult Init(nsSocketTransportService* aService,
|
||||
const char* aHost,
|
||||
PRInt32 aPort);
|
||||
nsresult Process(PRInt16 aSelectFlags);
|
||||
|
||||
nsresult CloseConnection(void);
|
||||
|
||||
// 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)); }
|
||||
|
||||
protected:
|
||||
nsresult doConnection(PRInt16 aSelectFlags);
|
||||
nsresult doResolveHost(void);
|
||||
nsresult doRead(PRInt16 aSelectFlags);
|
||||
nsresult doWrite(PRInt16 aSelectFlags);
|
||||
|
||||
protected:
|
||||
PRCList mListLink;
|
||||
|
||||
PRLock* mLock;
|
||||
nsSocketState mCurrentState;
|
||||
nsSocketOperation mOperation;
|
||||
|
||||
PRInt32 mSuspendCount;
|
||||
|
||||
PRFileDesc* mSocketFD;
|
||||
PRNetAddr mNetAddress;
|
||||
PRInt16 mSelectFlags;
|
||||
|
||||
char* mHostName;
|
||||
PRInt32 mPort;
|
||||
|
||||
nsISupports* mReadContext;
|
||||
nsIStreamListener* mReadListener;
|
||||
nsSocketTransportStream* mReadStream;
|
||||
|
||||
nsISupports* mWriteContext;
|
||||
nsIStreamObserver* mWriteObserver;
|
||||
nsIBufferInputStream* mWriteStream;
|
||||
|
||||
PRUint32 mSourceOffset;
|
||||
|
||||
nsSocketTransportService* mService;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsSocketTransport_h___ */
|
||||
492
mozilla/netwerk/base/src/nsSocketTransportService.cpp
Normal file
492
mozilla/netwerk/base/src/nsSocketTransportService.cpp
Normal file
@@ -0,0 +1,492 @@
|
||||
/* -*- 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.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 "nsSocketTransportService.h"
|
||||
#include "nsSocketTransport.h"
|
||||
#include "nsAutoLock.h"
|
||||
|
||||
#define MAX_OPEN_CONNECTIONS 50
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
|
||||
nsSocketTransportService::nsSocketTransportService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
PR_INIT_CLIST(&mWorkQ);
|
||||
|
||||
mThread = nsnull;
|
||||
mThreadEvent = nsnull;
|
||||
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;
|
||||
}
|
||||
|
||||
if (mThreadEvent) {
|
||||
PR_DestroyPollableEvent(mThreadEvent);
|
||||
mThreadEvent = nsnull;
|
||||
}
|
||||
|
||||
if (mThreadLock) {
|
||||
PR_DestroyLock(mThreadLock);
|
||||
mThreadLock = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsSocketTransportService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsSocketTransportService* trans = new nsSocketTransportService();
|
||||
if (trans == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(trans);
|
||||
nsresult rv = trans->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = trans->QueryInterface(aIID, aResult);
|
||||
}
|
||||
NS_RELEASE(trans);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult 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;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportService::AddToWorkQ(nsSocketTransport* aTransport)
|
||||
{
|
||||
PRStatus status;
|
||||
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) {
|
||||
status = PR_SetPollableEvent(mThreadEvent);
|
||||
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);
|
||||
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);
|
||||
|
||||
// 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;
|
||||
|
||||
if (aTransport && (MAX_OPEN_CONNECTIONS > mSelectFDSetCount) ) {
|
||||
PRPollDesc* pfd;
|
||||
int i;
|
||||
|
||||
// Check to see if the transport is already in the list...
|
||||
for (i=1; i<mSelectFDSetCount; i++) {
|
||||
if (mActiveTransportList[i] == aTransport) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Add the FileDesc to the PRPollDesc list...
|
||||
if (i == mSelectFDSetCount) {
|
||||
pfd = &mSelectFDSet[mSelectFDSetCount];
|
||||
pfd->fd = aTransport->GetSocket();;
|
||||
pfd->in_flags = aTransport->GetSelectFlags();
|
||||
pfd->out_flags = 0;
|
||||
// Add the transport instance to the corresponding active transport list...
|
||||
NS_ADDREF(aTransport);
|
||||
mActiveTransportList[mSelectFDSetCount] = aTransport;
|
||||
mSelectFDSetCount += 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportService::RemoveFromSelectList(nsSocketTransport* aTransport)
|
||||
{
|
||||
int i;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
for (i=1; 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_ADDREF(nsSocketTransportService);
|
||||
NS_IMPL_RELEASE(nsSocketTransportService);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::QueryInterface(const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(nsISocketTransportService::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISocketTransportService*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsIRunnable::GetIID())) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIRunnable*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsIRunnable implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::Run(void)
|
||||
{
|
||||
//
|
||||
// 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;
|
||||
|
||||
while (mThreadRunning) {
|
||||
PRInt32 count;
|
||||
nsSocketTransport* transport;
|
||||
|
||||
// XXX: PR_Poll(...) needs a timeout value...
|
||||
count = PR_Poll(mSelectFDSet, mSelectFDSetCount, PR_INTERVAL_NO_TIMEOUT);
|
||||
|
||||
/* One or more sockets has data... */
|
||||
if (count > 0) {
|
||||
nsresult rv;
|
||||
int i;
|
||||
|
||||
/* Process any sockets with data first... */
|
||||
for (i=mSelectFDSetCount-1; i>=1; i--) {
|
||||
PRPollDesc* pfd;
|
||||
PRInt16 out_flags;
|
||||
|
||||
pfd = &mSelectFDSet[i];
|
||||
if (pfd->out_flags) {
|
||||
// Clear the out_flags for next time...
|
||||
out_flags = pfd->out_flags;
|
||||
pfd->out_flags = 0;
|
||||
|
||||
transport = mActiveTransportList[i];
|
||||
NS_ASSERTION(transport, "Null transport in active list...");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Process any pending operations on the mWorkQ... */
|
||||
if (mSelectFDSet[0].out_flags) {
|
||||
//
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
/* PR_Poll(...) timeout... */
|
||||
else if (count == 0) {
|
||||
}
|
||||
/* PR_Poll(...) error.. */
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsISocketTransportService implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportService::CreateTransport(const char* aHost,
|
||||
PRInt32 aPort,
|
||||
nsIChannel** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
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);
|
||||
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::Shutdown(void)
|
||||
{
|
||||
PRStatus status;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mThread) {
|
||||
//
|
||||
// Clear the running flag and wake up the transport thread...
|
||||
//
|
||||
mThreadRunning = PR_FALSE;
|
||||
status = PR_SetPollableEvent(mThreadEvent);
|
||||
|
||||
// XXX: what should happen if this fails?
|
||||
NS_ASSERTION(PR_SUCCESS == status, "Unable to wake up the transport thread.");
|
||||
|
||||
// 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;
|
||||
}
|
||||
79
mozilla/netwerk/base/src/nsSocketTransportService.h
Normal file
79
mozilla/netwerk/base/src/nsSocketTransportService.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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.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 nsSocketTransportService_h___
|
||||
#define nsSocketTransportService_h___
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
// Forward declarations...
|
||||
class nsSocketTransport;
|
||||
|
||||
class nsSocketTransportService : public nsISocketTransportService,
|
||||
public nsIRunnable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISocketTransportService methods:
|
||||
NS_IMETHOD CreateTransport(const char* aHost,
|
||||
PRInt32 aPort,
|
||||
nsIChannel** aResult);
|
||||
|
||||
NS_IMETHOD Shutdown(void);
|
||||
|
||||
// nsIRunnable methods:
|
||||
NS_IMETHOD Run(void);
|
||||
|
||||
// nsSocketTransportService methods:
|
||||
nsSocketTransportService();
|
||||
virtual ~nsSocketTransportService();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init(void);
|
||||
|
||||
nsresult AddToWorkQ(nsSocketTransport* aTransport);
|
||||
|
||||
// The following methods are called by the transport thread...
|
||||
nsresult ProcessWorkQ(void);
|
||||
|
||||
nsresult AddToSelectList(nsSocketTransport* aTransport);
|
||||
nsresult RemoveFromSelectList(nsSocketTransport* aTransport);
|
||||
|
||||
protected:
|
||||
nsIThread* mThread;
|
||||
PRFileDesc* mThreadEvent;
|
||||
PRLock* mThreadLock;
|
||||
PRBool mThreadRunning;
|
||||
|
||||
PRCList mWorkQ;
|
||||
|
||||
PRInt32 mSelectFDSetCount;
|
||||
PRPollDesc* mSelectFDSet;
|
||||
nsSocketTransport** mActiveTransportList;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsSocketTransportService_h___ */
|
||||
|
||||
|
||||
309
mozilla/netwerk/base/src/nsSocketTransportStreams.cpp
Normal file
309
mozilla/netwerk/base/src/nsSocketTransportStreams.cpp
Normal file
@@ -0,0 +1,309 @@
|
||||
/* -*- 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.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 "nsIBuffer.h"
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// Private implementation of a nsIBufferInputStream used by the
|
||||
// nsSocketTransport implementation
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
#if defined(XP_PC)
|
||||
#include <windows.h> // Interlocked increment...
|
||||
#endif
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nscore.h"
|
||||
#include "nsSocketTransportStreams.h"
|
||||
#include "nsSocketTransport.h"
|
||||
|
||||
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
// Log module for SocketTransport logging...
|
||||
//
|
||||
// To enable logging (see prlog.h for full details):
|
||||
//
|
||||
// set NSPR_LOG_MODULES=nsSocketTransport:5
|
||||
// set NSPR_LOG_FILE=nspr.log
|
||||
//
|
||||
// this enables PR_LOG_DEBUG level information and places all output in
|
||||
// the file nspr.log
|
||||
//
|
||||
// gSocketLog is defined in nsSocketTransport.cpp
|
||||
//
|
||||
extern PRLogModuleInfo* gSocketLog;
|
||||
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
|
||||
|
||||
nsSocketTransportStream::nsSocketTransportStream()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mIsStreamBlocking = PR_FALSE;
|
||||
mIsTransportSuspended = PR_FALSE;
|
||||
|
||||
mMonitor = nsnull;
|
||||
mTransport = nsnull;
|
||||
mBuffer = nsnull;
|
||||
mStream = nsnull;
|
||||
}
|
||||
|
||||
|
||||
nsSocketTransportStream::~nsSocketTransportStream()
|
||||
{
|
||||
NS_IF_RELEASE(mTransport);
|
||||
NS_IF_RELEASE(mStream);
|
||||
NS_IF_RELEASE(mBuffer);
|
||||
|
||||
if (mMonitor) {
|
||||
PR_DestroyMonitor(mMonitor);
|
||||
mMonitor = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportStream::Init(nsSocketTransport* aTransport,
|
||||
PRBool aBlockingFlag)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(aTransport, "Null transport supplied.");
|
||||
|
||||
mIsStreamBlocking = aBlockingFlag;
|
||||
|
||||
mMonitor = PR_NewMonitor();
|
||||
if (!mMonitor) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && aTransport) {
|
||||
mTransport = aTransport;
|
||||
NS_ADDREF(mTransport);
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_NewBuffer(&mBuffer, MAX_IO_BUFFER_SIZE/2, 2*MAX_IO_BUFFER_SIZE, nsnull);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_NewBufferInputStream(&mStream, mBuffer);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportStream::BlockTransport(void)
|
||||
{
|
||||
Lock();
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("nsSocketTransportStream::BlockTransport() [this=%x].\n", this));
|
||||
|
||||
//
|
||||
// XXX: It would be nice to call mTransport->Suspend() here...
|
||||
// Unfortunately, BlockTransport() is called within the transport lock.
|
||||
// So, since NSPR locks are not re-enterent we must rely on the caller
|
||||
// (ie. the transport) to suspend itself...
|
||||
//
|
||||
mIsTransportSuspended = PR_TRUE;
|
||||
|
||||
Unlock();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsSocketTransportStream::FillStream(nsReadSegmentFun reader,
|
||||
void* closure,
|
||||
PRUint32 count,
|
||||
PRUint32 *writeCount)
|
||||
{
|
||||
return mBuffer->WriteSegments(reader, closure, count, writeCount);
|
||||
}
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsISupports implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsSocketTransportStream,
|
||||
nsIBufferInputStream::GetIID());
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsIBaseStream implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::Close()
|
||||
{
|
||||
return mStream->Close();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsIInputStream implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::GetLength(PRUint32 *aResult)
|
||||
{
|
||||
return mStream->GetLength(aResult);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::Read(char * aBuf, PRUint32 aCount,
|
||||
PRUint32 *aReadCount)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Enter the stream lock...
|
||||
Lock();
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransportStream::Read() [this=%x].\t"
|
||||
"aCount=%d\n",
|
||||
this, aCount));
|
||||
|
||||
do {
|
||||
rv = mStream->Read(aBuf, aCount, aReadCount);
|
||||
|
||||
if (mIsStreamBlocking && (NS_BASE_STREAM_WOULD_BLOCK == rv)) {
|
||||
Wait();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
//
|
||||
// If the transport is blocked waiting for room in the input stream, then
|
||||
// resume it...
|
||||
//
|
||||
if (mIsTransportSuspended && (*aReadCount) ) {
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("nsSocketTransportStream::Read() [this=%x]. "
|
||||
"Resuming transport [%x].\n",
|
||||
this, mTransport));
|
||||
|
||||
mTransport->Resume();
|
||||
mIsTransportSuspended = PR_FALSE;
|
||||
}
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("--- Leaving nsSocketTransportStream::Read() [this=%x].\t"
|
||||
"rv = %x. aReadCount=%d\n",
|
||||
this, rv, *aReadCount));
|
||||
|
||||
// Leave the stream lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsIBufferInputStream implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::GetBuffer(nsIBuffer* *result)
|
||||
{
|
||||
return mStream->GetBuffer(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::FillFrom(nsIInputStream* aStream,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aWriteCount)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Enter the stream lock...
|
||||
Lock();
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransportStream::Fill() [this=%x].\t"
|
||||
"aCount=%d\n",
|
||||
this, aCount));
|
||||
|
||||
rv = mStream->FillFrom(aStream, aCount, aWriteCount);
|
||||
|
||||
if (mIsStreamBlocking && (NS_BASE_STREAM_WOULD_BLOCK != rv)) {
|
||||
Notify();
|
||||
}
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("--- Leaving nsSocketTransportStream::Fill() [this=%x].\t"
|
||||
"rv = %x. aWriteCount=%d\n",
|
||||
this, rv, *aWriteCount));
|
||||
|
||||
// Leave the stream lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransportStream::Fill(const char* aBuf,
|
||||
PRUint32 aCount,
|
||||
PRUint32 *aWriteCount)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Enter the stream lock...
|
||||
Lock();
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("+++ Entering nsSocketTransportStream::Fill() [this=%x].\t"
|
||||
"aCount=%d\n",
|
||||
this, aCount));
|
||||
|
||||
|
||||
rv = mStream->Fill(aBuf, aCount, aWriteCount);
|
||||
|
||||
if (mIsStreamBlocking && (NS_BASE_STREAM_WOULD_BLOCK != rv)) {
|
||||
Notify();
|
||||
}
|
||||
|
||||
PR_LOG(gSocketLog, PR_LOG_DEBUG,
|
||||
("--- Leaving nsSocketTransportStream::Fill() [this=%x].\t"
|
||||
"rv = %x. aWriteCount=%d\n",
|
||||
this, rv, *aWriteCount));
|
||||
|
||||
// Leave the stream lock...
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
79
mozilla/netwerk/base/src/nsSocketTransportStreams.h
Normal file
79
mozilla/netwerk/base/src/nsSocketTransportStreams.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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.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 nsSocketTransportStreams_h___
|
||||
#define nsSocketTransportStreams_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBuffer.h"
|
||||
|
||||
// Forward declarations...
|
||||
class nsSocketTransport;
|
||||
|
||||
|
||||
class nsSocketTransportStream : public nsIBufferInputStream
|
||||
{
|
||||
public:
|
||||
nsSocketTransportStream();
|
||||
|
||||
// nsISupports methods:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIBaseStream methods:
|
||||
NS_IMETHOD Close();
|
||||
|
||||
// nsIInputStream methods:
|
||||
NS_IMETHOD GetLength(PRUint32 *aResult);
|
||||
NS_IMETHOD Read(char * aBuf, PRUint32 aCount, PRUint32 *aReadCount);
|
||||
|
||||
// nsIBufferInputStream methods:
|
||||
NS_IMETHOD GetBuffer(nsIBuffer* *result);
|
||||
NS_IMETHOD Fill(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
|
||||
NS_IMETHOD FillFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval);
|
||||
|
||||
// nsSocketTransportStream methods:
|
||||
nsresult Init(nsSocketTransport* aTransport, PRBool aBlockingFlag);
|
||||
nsresult BlockTransport(void);
|
||||
|
||||
nsresult FillStream(nsReadSegmentFun reader, void* closure, PRUint32 count,
|
||||
PRUint32 *writeCount);
|
||||
|
||||
void Lock(void) { NS_ASSERTION(mMonitor, "Monitor null."); PR_EnterMonitor(mMonitor); }
|
||||
void Notify(void) { NS_ASSERTION(mMonitor, "Monitor null."); PR_Notify(mMonitor); }
|
||||
void Wait(void) { NS_ASSERTION(mMonitor, "Monitor null."); PR_Wait(mMonitor, PR_INTERVAL_NO_TIMEOUT); }
|
||||
void Unlock(void) { NS_ASSERTION(mMonitor, "Monitor null."); PR_ExitMonitor(mMonitor); }
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~nsSocketTransportStream();
|
||||
|
||||
private:
|
||||
PRBool mIsTransportSuspended;
|
||||
PRBool mIsStreamBlocking;
|
||||
|
||||
PRMonitor* mMonitor;
|
||||
nsIBuffer* mBuffer;
|
||||
nsIBufferInputStream* mStream;
|
||||
nsSocketTransport* mTransport;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsSocketTransportStreams_h___ */
|
||||
|
||||
663
mozilla/netwerk/base/src/nsStandardUrl.cpp
Normal file
663
mozilla/netwerk/base/src/nsStandardUrl.cpp
Normal file
@@ -0,0 +1,663 @@
|
||||
/* -*- 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.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 "nsStandardUrl.h"
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
static NS_DEFINE_CID(kThisStandardUrlImplementationCID,
|
||||
NS_THIS_STANDARDURL_IMPLEMENTATION_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsStandardURL methods:
|
||||
|
||||
nsStandardURL::nsStandardURL(nsISupports* outer)
|
||||
: mScheme(nsnull),
|
||||
mPreHost(nsnull),
|
||||
mHost(nsnull),
|
||||
mPort(-1),
|
||||
mPath(nsnull),
|
||||
mRef(nsnull),
|
||||
mQuery(nsnull),
|
||||
mSpec(nsnull)
|
||||
{
|
||||
NS_INIT_AGGREGATED(outer);
|
||||
}
|
||||
|
||||
nsStandardURL::~nsStandardURL()
|
||||
{
|
||||
if (mScheme) delete[] mScheme;
|
||||
if (mPreHost) delete[] mPreHost;
|
||||
if (mHost) delete[] mHost;
|
||||
if (mRef) delete[] mRef;
|
||||
if (mQuery) delete[] mQuery;
|
||||
if (mSpec) delete[] mSpec;
|
||||
}
|
||||
|
||||
NS_IMPL_AGGREGATED(nsStandardURL);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ASSERTION(aInstancePtr, "no instance pointer");
|
||||
if (aIID.Equals(kThisStandardUrlImplementationCID) || // used by Equals
|
||||
aIID.Equals(nsIURL::GetIID()) ||
|
||||
aIID.Equals(nsIURI::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIURI*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURI methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetSpec(char* *result)
|
||||
{
|
||||
nsAutoString string;
|
||||
// NS_LOCK_INSTANCE();
|
||||
|
||||
// XXX Special-case javascript: URLs for the moment.
|
||||
// This code will go away when we actually start doing
|
||||
// protocol-specific parsing.
|
||||
if (PL_strcmp(mScheme, "javascript") == 0) {
|
||||
string.SetString(mSpec);
|
||||
} else if (PL_strcmp(mScheme, "about") == 0) {
|
||||
string.SetString(mScheme);
|
||||
string.Append(':');
|
||||
string.Append(mPath);
|
||||
} else {
|
||||
string.SetLength(0);
|
||||
string.Append(mScheme);
|
||||
string.Append("://");
|
||||
if (nsnull != mHost) {
|
||||
string.Append(mHost);
|
||||
if (0 < mPort) {
|
||||
string.Append(':');
|
||||
string.Append(mPort, 10);
|
||||
}
|
||||
}
|
||||
string.Append(mPath);
|
||||
if (nsnull != mRef) {
|
||||
string.Append('#');
|
||||
string.Append(mRef);
|
||||
}
|
||||
if (nsnull != mQuery) {
|
||||
string.Append('?');
|
||||
string.Append(mQuery);
|
||||
}
|
||||
}
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
*result = string.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetSpec(char* aSpec)
|
||||
{
|
||||
return Parse(aSpec, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetScheme(char* *result)
|
||||
{
|
||||
*result = mScheme;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetScheme(char* scheme)
|
||||
{
|
||||
mScheme = nsCRT::strdup(scheme);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetPreHost(char* *result)
|
||||
{
|
||||
*result = mPreHost;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetPreHost(char* preHost)
|
||||
{
|
||||
mPreHost = nsCRT::strdup(preHost);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetHost(char* *result)
|
||||
{
|
||||
*result = mHost;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetHost(char* host)
|
||||
{
|
||||
mHost = nsCRT::strdup(host);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetPort(PRInt32 *result)
|
||||
{
|
||||
*result = mPort;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetPort(PRInt32 port)
|
||||
{
|
||||
mPort = port;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetPath(char* *result)
|
||||
{
|
||||
*result = mPath;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetPath(char* path)
|
||||
{
|
||||
mPath = nsCRT::strdup(path);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::Equals(nsIURI* other, PRBool *result)
|
||||
{
|
||||
PRBool eq = PR_FALSE;
|
||||
if (other) {
|
||||
// NS_LOCK_INSTANCE();
|
||||
nsStandardURL* otherUrl;
|
||||
nsresult rv =
|
||||
other->QueryInterface(kThisStandardUrlImplementationCID,
|
||||
(void**)&otherUrl);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
eq = PRBool((0 == PL_strcmp(mScheme, otherUrl->mScheme)) &&
|
||||
(0 == PL_strcasecmp(mHost, otherUrl->mHost)) &&
|
||||
(mPort == otherUrl->mPort) &&
|
||||
(0 == PL_strcmp(mPath, otherUrl->mPath)));
|
||||
NS_RELEASE(otherUrl);
|
||||
}
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
}
|
||||
*result = eq;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::Clone(nsIURI* *result)
|
||||
{
|
||||
nsStandardURL* url = new nsStandardURL(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->mPreHost = nsCRT::strdup(mPreHost);
|
||||
if (url->mPreHost == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->mHost = nsCRT::strdup(mHost);
|
||||
if (url->mHost == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->mPort = mPort;
|
||||
url->mPath = nsCRT::strdup(mPath);
|
||||
if (url->mPath == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->mRef = nsCRT::strdup(mRef);
|
||||
if (url->mRef == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->mQuery = nsCRT::strdup(mQuery);
|
||||
if (url->mQuery == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
url->mSpec = nsCRT::strdup(mSpec);
|
||||
if (url->mSpec == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*result = url;
|
||||
NS_ADDREF(url);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::MakeAbsolute(const char *relativePart, char **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// XXX recode to use nsString api's
|
||||
// XXX don't bother with port numbers
|
||||
// XXX don't bother with ref's
|
||||
// XXX null pointer checks are incomplete
|
||||
nsresult
|
||||
nsStandardURL::Parse(const char* spec, nsIURI* aBaseUrl)
|
||||
{
|
||||
// XXX hack!
|
||||
nsString specStr(spec);
|
||||
|
||||
char* uProtocol = nsnull;
|
||||
char* uHost = nsnull;
|
||||
char* uFile = nsnull;
|
||||
PRInt32 uPort;
|
||||
if (nsnull != aBaseUrl) {
|
||||
nsresult rslt = aBaseUrl->GetScheme(&uProtocol);
|
||||
if (rslt != NS_OK) return rslt;
|
||||
rslt = aBaseUrl->GetHost(&uHost);
|
||||
if (rslt != NS_OK) return rslt;
|
||||
rslt = aBaseUrl->GetPath(&uFile);
|
||||
if (rslt != NS_OK) return rslt;
|
||||
rslt = aBaseUrl->GetPort(&uPort);
|
||||
if (rslt != NS_OK) return rslt;
|
||||
}
|
||||
|
||||
// NS_LOCK_INSTANCE();
|
||||
|
||||
PR_FREEIF(mScheme);
|
||||
PR_FREEIF(mHost);
|
||||
PR_FREEIF(mPath);
|
||||
PR_FREEIF(mRef);
|
||||
PR_FREEIF(mQuery);
|
||||
mPort = -1;
|
||||
|
||||
if (nsnull == spec) {
|
||||
if (nsnull == aBaseUrl) {
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
mScheme = (nsnull != uProtocol) ? nsCRT::strdup(uProtocol) : nsnull;
|
||||
mHost = (nsnull != uHost) ? nsCRT::strdup(uHost) : nsnull;
|
||||
mPort = uPort;
|
||||
mPath = (nsnull != uFile) ? nsCRT::strdup(uFile) : nsnull;
|
||||
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Strip out reference and search info
|
||||
char* ref = strpbrk(spec, "#?");
|
||||
if (nsnull != ref) {
|
||||
char* search = nsnull;
|
||||
if ('#' == *ref) {
|
||||
search = PL_strchr(ref + 1, '?');
|
||||
if (nsnull != search) {
|
||||
*search++ = '\0';
|
||||
}
|
||||
|
||||
PRIntn hashLen = nsCRT::strlen(ref + 1);
|
||||
if (0 != hashLen) {
|
||||
mRef = (char*) PR_Malloc(hashLen + 1);
|
||||
PL_strcpy(mRef, ref + 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
search = ref + 1;
|
||||
}
|
||||
|
||||
if (nsnull != search) {
|
||||
// The rest is the search
|
||||
PRIntn searchLen = nsCRT::strlen(search);
|
||||
if (0 != searchLen) {
|
||||
mQuery = (char*) PR_Malloc(searchLen + 1);
|
||||
PL_strcpy(mQuery, search);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Terminate string at start of reference or search
|
||||
*ref = '\0';
|
||||
}
|
||||
|
||||
// The URL is considered absolute if and only if it begins with a
|
||||
// protocol spec. A protocol spec is an alphanumeric string of 1 or
|
||||
// more characters that is terminated with a colon.
|
||||
PRBool isAbsolute = PR_FALSE;
|
||||
const char* cp;
|
||||
const char* ap = spec;
|
||||
char ch;
|
||||
while (0 != (ch = *ap)) {
|
||||
if (((ch >= 'a') && (ch <= 'z')) ||
|
||||
((ch >= 'A') && (ch <= 'Z')) ||
|
||||
((ch >= '0') && (ch <= '9'))) {
|
||||
ap++;
|
||||
continue;
|
||||
}
|
||||
if ((ch == ':') && (ap - spec >= 2)) {
|
||||
isAbsolute = PR_TRUE;
|
||||
cp = ap;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isAbsolute) {
|
||||
// relative spec
|
||||
if (nsnull == aBaseUrl) {
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
// keep protocol and host
|
||||
mScheme = (nsnull != uProtocol) ? nsCRT::strdup(uProtocol) : nsnull;
|
||||
mHost = (nsnull != uHost) ? nsCRT::strdup(uHost) : nsnull;
|
||||
mPort = uPort;
|
||||
|
||||
// figure out file name
|
||||
PRInt32 len = nsCRT::strlen(spec) + 1;
|
||||
if ((len > 1) && (spec[0] == '/')) {
|
||||
// Relative spec is absolute to the server
|
||||
mPath = nsCRT::strdup(spec);
|
||||
} else {
|
||||
if (spec[0] != '\0') {
|
||||
// Strip out old tail component and put in the new one
|
||||
char* dp = PL_strrchr(uFile, '/');
|
||||
if (!dp) {
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
PRInt32 dirlen = (dp + 1) - uFile;
|
||||
mPath = (char*) PR_Malloc(dirlen + len);
|
||||
PL_strncpy(mPath, uFile, dirlen);
|
||||
PL_strcpy(mPath + dirlen, spec);
|
||||
}
|
||||
else {
|
||||
mPath = nsCRT::strdup(uFile);
|
||||
}
|
||||
}
|
||||
|
||||
/* Stolen from netlib's mkparse.c.
|
||||
*
|
||||
* modifies a url of the form /foo/../foo1 -> /foo1
|
||||
* and /foo/./foo1 -> /foo/foo1
|
||||
*/
|
||||
char *fwdPtr = mPath;
|
||||
char *urlPtr = mPath;
|
||||
|
||||
for(; *fwdPtr != '\0'; fwdPtr++)
|
||||
{
|
||||
|
||||
if(*fwdPtr == '/' && *(fwdPtr+1) == '.' && *(fwdPtr+2) == '/')
|
||||
{
|
||||
/* remove ./
|
||||
*/
|
||||
fwdPtr += 1;
|
||||
}
|
||||
else if(*fwdPtr == '/' && *(fwdPtr+1) == '.' && *(fwdPtr+2) == '.' &&
|
||||
(*(fwdPtr+3) == '/' || *(fwdPtr+3) == '\0'))
|
||||
{
|
||||
/* remove foo/..
|
||||
*/
|
||||
/* reverse the urlPtr to the previous slash
|
||||
*/
|
||||
if(urlPtr != mPath)
|
||||
urlPtr--; /* we must be going back at least one */
|
||||
for(;*urlPtr != '/' && urlPtr != mPath; urlPtr--)
|
||||
; /* null body */
|
||||
|
||||
/* forward the fwd_prt past the ../
|
||||
*/
|
||||
fwdPtr += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* copy the url incrementaly
|
||||
*/
|
||||
*urlPtr++ = *fwdPtr;
|
||||
}
|
||||
}
|
||||
|
||||
*urlPtr = '\0'; /* terminate the url */
|
||||
|
||||
// Now that we've resolved the relative URL, we need to reconstruct
|
||||
// a URL spec from the components.
|
||||
ReconstructSpec();
|
||||
} else {
|
||||
// absolute spec
|
||||
|
||||
PR_FREEIF(mSpec);
|
||||
PRInt32 slen = specStr.Length();
|
||||
mSpec = (char *) PR_Malloc(slen + 1);
|
||||
specStr.ToCString(mSpec, slen+1);
|
||||
|
||||
// get protocol first
|
||||
PRInt32 plen = cp - spec;
|
||||
mScheme = (char*) PR_Malloc(plen + 1);
|
||||
PL_strncpy(mScheme, spec, plen);
|
||||
mScheme[plen] = 0;
|
||||
cp++; // eat : in protocol
|
||||
|
||||
// skip over one, two or three slashes if it isn't about:
|
||||
if (nsCRT::strcmp(mScheme, "about") != 0) {
|
||||
if (*cp == '/') {
|
||||
cp++;
|
||||
if (*cp == '/') {
|
||||
cp++;
|
||||
if (*cp == '/') {
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(XP_UNIX) || defined (XP_MAC)
|
||||
// Always leave the top level slash for absolute file paths under Mac and UNIX.
|
||||
// The code above sometimes results in stripping all of slashes
|
||||
// off. This only happens when a previously stripped url is asked to be
|
||||
// parsed again. Under Win32 this is not a problem since file urls begin
|
||||
// with a drive letter not a slash. This problem show's itself when
|
||||
// nested documents such as iframes within iframes are parsed.
|
||||
|
||||
if (nsCRT::strcmp(mScheme, "file") == 0) {
|
||||
if (*cp != '/') {
|
||||
cp--;
|
||||
}
|
||||
}
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
const char* cp0 = cp;
|
||||
if ((nsCRT::strcmp(mScheme, "resource") == 0) ||
|
||||
(nsCRT::strcmp(mScheme, "file") == 0) ||
|
||||
(nsCRT::strcmp(mScheme, "about") == 0)) {
|
||||
// resource/file url's do not have host names.
|
||||
// The remainder of the string is the file name
|
||||
PRInt32 flen = nsCRT::strlen(cp);
|
||||
mPath = (char*) PR_Malloc(flen + 1);
|
||||
PL_strcpy(mPath, cp);
|
||||
|
||||
#ifdef NS_WIN32
|
||||
if (nsCRT::strcmp(mScheme, "file") == 0) {
|
||||
// If the filename starts with a "x|" where is an single
|
||||
// character then we assume it's a drive name and change the
|
||||
// vertical bar back to a ":"
|
||||
if ((flen >= 2) && (mPath[1] == '|')) {
|
||||
mPath[1] = ':';
|
||||
}
|
||||
}
|
||||
#endif /* NS_WIN32 */
|
||||
} else {
|
||||
// Host name follows protocol for http style urls
|
||||
cp = PL_strpbrk(cp, "/:");
|
||||
|
||||
if (nsnull == cp) {
|
||||
// There is only a host name
|
||||
PRInt32 hlen = nsCRT::strlen(cp0);
|
||||
mHost = (char*) PR_Malloc(hlen + 1);
|
||||
PL_strcpy(mHost, cp0);
|
||||
}
|
||||
else {
|
||||
PRInt32 hlen = cp - cp0;
|
||||
mHost = (char*) PR_Malloc(hlen + 1);
|
||||
PL_strncpy(mHost, cp0, hlen);
|
||||
mHost[hlen] = 0;
|
||||
|
||||
if (':' == *cp) {
|
||||
// We have a port number
|
||||
cp0 = cp+1;
|
||||
cp = PL_strchr(cp, '/');
|
||||
mPort = strtol(cp0, (char **)nsnull, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull == cp) {
|
||||
// There is no file name
|
||||
// Set filename to "/"
|
||||
mPath = (char*) PR_Malloc(2);
|
||||
mPath[0] = '/';
|
||||
mPath[1] = 0;
|
||||
}
|
||||
else {
|
||||
// The rest is the file name
|
||||
PRInt32 flen = nsCRT::strlen(cp);
|
||||
mPath = (char*) PR_Malloc(flen + 1);
|
||||
PL_strcpy(mPath, cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// printf("protocol='%s' host='%s' file='%s'\n", mScheme, mHost, mPath);
|
||||
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsStandardURL::ReconstructSpec()
|
||||
{
|
||||
PR_FREEIF(mSpec);
|
||||
|
||||
char portBuffer[10];
|
||||
if (-1 != mPort) {
|
||||
PR_snprintf(portBuffer, 10, ":%d", mPort);
|
||||
}
|
||||
else {
|
||||
portBuffer[0] = '\0';
|
||||
}
|
||||
|
||||
PRInt32 plen = PL_strlen(mScheme) + PL_strlen(mHost) +
|
||||
PL_strlen(portBuffer) + PL_strlen(mPath) + 4;
|
||||
if (mRef) {
|
||||
plen += 1 + PL_strlen(mRef);
|
||||
}
|
||||
if (mQuery) {
|
||||
plen += 1 + PL_strlen(mQuery);
|
||||
}
|
||||
|
||||
mSpec = (char *) PR_Malloc(plen + 1);
|
||||
if (PL_strcmp(mScheme, "about") == 0) {
|
||||
PR_snprintf(mSpec, plen, "%s:%s", mScheme, mPath);
|
||||
} else {
|
||||
PR_snprintf(mSpec, plen, "%s://%s%s%s",
|
||||
mScheme, ((nsnull != mHost) ? mHost : ""), portBuffer,
|
||||
mPath);
|
||||
}
|
||||
|
||||
if (mRef) {
|
||||
PL_strcat(mSpec, "#");
|
||||
PL_strcat(mSpec, mRef);
|
||||
}
|
||||
if (mQuery) {
|
||||
PL_strcat(mSpec, "?");
|
||||
PL_strcat(mSpec, mQuery);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURI methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetDirectory(char * *aDirectory)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetDirectory(char * aDirectory)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetFileName(char * *aFileName)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetFileName(char * aFileName)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetQuery(char * *aQuery)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetQuery(char * aQuery)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetRef(char * *aRef)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetRef(char * aRef)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_METHOD
|
||||
nsStandardURL::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsStandardURL* url = new nsStandardURL(aOuter);
|
||||
if (url == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(url);
|
||||
nsresult rv = url->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
118
mozilla/netwerk/base/src/nsStandardUrl.h
Normal file
118
mozilla/netwerk/base/src/nsStandardUrl.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/* -*- 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.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 nsStandardUrl_h__
|
||||
#define nsStandardUrl_h__
|
||||
|
||||
#include "nsIURL.h"
|
||||
#include "nsAgg.h"
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_THIS_STANDARDURL_IMPLEMENTATION_CID \
|
||||
{ /* 905ed480-f11f-11d2-9322-000000000000 */ \
|
||||
0x905ed480, \
|
||||
0xf11f, \
|
||||
0x11d2, \
|
||||
{0x93, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} \
|
||||
}
|
||||
|
||||
class nsStandardURL : public nsIURI
|
||||
{
|
||||
public:
|
||||
NS_DECL_AGGREGATED
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURI methods:
|
||||
|
||||
/* attribute string Spec; */
|
||||
NS_IMETHOD GetSpec(char * *aSpec);
|
||||
NS_IMETHOD SetSpec(char * aSpec);
|
||||
|
||||
/* attribute string Scheme; */
|
||||
NS_IMETHOD GetScheme(char * *aScheme);
|
||||
NS_IMETHOD SetScheme(char * aScheme);
|
||||
|
||||
/* attribute string PreHost; */
|
||||
NS_IMETHOD GetPreHost(char * *aPreHost);
|
||||
NS_IMETHOD SetPreHost(char * aPreHost);
|
||||
|
||||
/* attribute string Host; */
|
||||
NS_IMETHOD GetHost(char * *aHost);
|
||||
NS_IMETHOD SetHost(char * aHost);
|
||||
|
||||
/* attribute long Port; */
|
||||
NS_IMETHOD GetPort(PRInt32 *aPort);
|
||||
NS_IMETHOD SetPort(PRInt32 aPort);
|
||||
|
||||
/* attribute string Path; */
|
||||
NS_IMETHOD GetPath(char * *aPath);
|
||||
NS_IMETHOD SetPath(char * aPath);
|
||||
|
||||
/* boolean Equals (in nsIURI other); */
|
||||
NS_IMETHOD Equals(nsIURI *other, PRBool *_retval);
|
||||
|
||||
/* nsIURI Clone (); */
|
||||
NS_IMETHOD Clone(nsIURI **_retval);
|
||||
|
||||
/* string MakeAbsolute (in string relativePart); */
|
||||
NS_IMETHOD MakeAbsolute(const char *relativePart, char **_retval);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURI methods:
|
||||
|
||||
/* attribute string Directory; */
|
||||
NS_IMETHOD GetDirectory(char * *aDirectory);
|
||||
NS_IMETHOD SetDirectory(char * aDirectory);
|
||||
|
||||
/* attribute string FileName; */
|
||||
NS_IMETHOD GetFileName(char * *aFileName);
|
||||
NS_IMETHOD SetFileName(char * aFileName);
|
||||
|
||||
/* attribute string Query; */
|
||||
NS_IMETHOD GetQuery(char * *aQuery);
|
||||
NS_IMETHOD SetQuery(char * aQuery);
|
||||
|
||||
/* attribute string Ref; */
|
||||
NS_IMETHOD GetRef(char * *aRef);
|
||||
NS_IMETHOD SetRef(char * aRef);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsStandardURL methods:
|
||||
|
||||
nsStandardURL(nsISupports* outer);
|
||||
virtual ~nsStandardURL();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
nsresult Parse(const char* spec, nsIURI* aBaseUrl);
|
||||
void ReconstructSpec();
|
||||
|
||||
protected:
|
||||
char* mScheme;
|
||||
char* mPreHost;
|
||||
char* mHost;
|
||||
PRInt32 mPort;
|
||||
char* mPath;
|
||||
char* mRef;
|
||||
char* mQuery;
|
||||
char* mSpec; // XXX go away
|
||||
};
|
||||
|
||||
#endif // nsStandardUrl_h__
|
||||
174
mozilla/netwerk/base/src/nsSyncStreamListener.cpp
Normal file
174
mozilla/netwerk/base/src/nsSyncStreamListener.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
/* -*- 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.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 "nsIStreamListener.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsIBuffer.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsSyncStreamListener : public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStreamObserver methods:
|
||||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
NS_IMETHOD OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg);
|
||||
NS_IMETHOD OnStartRequest(nsISupports* context);
|
||||
NS_IMETHOD OnStopRequest(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg);
|
||||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
// nsSyncStreamListener methods:
|
||||
nsSyncStreamListener()
|
||||
: mOutputStream(nsnull) {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
virtual ~nsSyncStreamListener();
|
||||
|
||||
nsresult Init(nsIBufferInputStream* *result);
|
||||
|
||||
nsIBufferOutputStream* GetOutputStream() { return mOutputStream; }
|
||||
|
||||
protected:
|
||||
nsIBufferOutputStream* mOutputStream;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_SYNC_STREAM_LISTENER_SEGMENT_SIZE (4 * 1024)
|
||||
#define NS_SYNC_STREAM_LISTENER_BUFFER_SIZE (32 * 1024)
|
||||
|
||||
nsresult
|
||||
nsSyncStreamListener::Init(nsIBufferInputStream* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIBufferInputStream* in;
|
||||
|
||||
rv = NS_NewPipe(&in, &mOutputStream, NS_SYNC_STREAM_LISTENER_SEGMENT_SIZE,
|
||||
NS_SYNC_STREAM_LISTENER_BUFFER_SIZE, PR_TRUE, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = in;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSyncStreamListener::~nsSyncStreamListener()
|
||||
{
|
||||
NS_IF_RELEASE(mOutputStream);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsSyncStreamListener);
|
||||
NS_IMPL_RELEASE(nsSyncStreamListener);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ASSERTION(aInstancePtr, "no instance pointer");
|
||||
if (aIID.Equals(nsIStreamListener::GetIID()) ||
|
||||
aIID.Equals(nsIStreamObserver::GetIID()) ||
|
||||
aIID.Equals(nsISupports::GetIID())) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIStreamListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::OnStartBinding(nsISupports* context)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
// XXX what do we do with the status and error message?
|
||||
return mOutputStream->Close();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::OnStartRequest(nsISupports* context)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::OnStopRequest(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
// XXX what do we do with the status and error message?
|
||||
return mOutputStream->Close();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncStreamListener::OnDataAvailable(nsISupports* context,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 amt;
|
||||
PRInt32 count = (PRInt32)aLength;
|
||||
while (count > 0) { // this should only go around once since the output stream is blocking
|
||||
rv = mOutputStream->WriteFrom(aIStream, count, &amt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
count -= amt;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_NET nsresult
|
||||
NS_NewSyncStreamListener(nsIBufferInputStream **inStream,
|
||||
nsIBufferOutputStream **outStream,
|
||||
nsIStreamListener **listener)
|
||||
{
|
||||
nsSyncStreamListener* l = new nsSyncStreamListener();
|
||||
if (l == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = l->Init(inStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete l;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(l);
|
||||
*listener = l;
|
||||
*outStream = l->GetOutputStream();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
59
mozilla/netwerk/base/tests/makefile.win
Normal file
59
mozilla/netwerk/base/tests/makefile.win
Normal file
@@ -0,0 +1,59 @@
|
||||
# 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.
|
||||
|
||||
NODEPEND=1
|
||||
IGNORE_MANIFEST = 1
|
||||
|
||||
MODULE = urltest
|
||||
|
||||
DEPTH= ..\..\..
|
||||
|
||||
MAKE_OBJ_TYPE=EXE
|
||||
|
||||
EXENAME=urltest
|
||||
PDBFILE=nunettest.pdb
|
||||
MAPFILE=nunettest.map
|
||||
|
||||
OBJS= \
|
||||
.\$(OBJDIR)\urltest.obj \
|
||||
$(NULL)
|
||||
|
||||
PROGRAM=.\$(OBJDIR)\$(EXENAME).EXE
|
||||
|
||||
LCFLAGS=-DNETSCAPE
|
||||
LLIBS=$(LLIBS) \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\nunet.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(DIST)\lib\plc3.lib
|
||||
|
||||
LINCS=$(LINCS) -I. \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\netlib \
|
||||
-I$(PUBLIC)\nunet \
|
||||
-I$(PUBLIC)\pref \
|
||||
-I$(PUBLIC)\xpcom
|
||||
|
||||
# clobber and clobber_all will remove the following garbage:
|
||||
GARBAGE = $(GARBAGE) _gen
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
install:: $(PROGRAM)
|
||||
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\$(EXENAME).exe
|
||||
2
mozilla/netwerk/base/tests/readme.txt
Normal file
2
mozilla/netwerk/base/tests/readme.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
These tests need to be cleaned up a lot. There is still left over
|
||||
stuff from previous test. TODO -Gagan Saksena
|
||||
316
mozilla/netwerk/base/tests/urltest.cpp
Normal file
316
mozilla/netwerk/base/tests/urltest.cpp
Normal file
@@ -0,0 +1,316 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
TODO- big cleanup! -Gagan Saksena 03/25/99
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "plstr.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsINetService.h"
|
||||
#include "nsRepository.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIURL.h"
|
||||
#include "nsINetService.h"
|
||||
|
||||
#ifdef XP_PC
|
||||
#define NETLIB_DLL "netlib.dll"
|
||||
#define XPCOM_DLL "xpcom32.dll"
|
||||
#else
|
||||
#ifdef XP_MAC
|
||||
#include "nsMacRepository.h"
|
||||
#else
|
||||
#define NETLIB_DLL "libnetlib.so"
|
||||
#define XPCOM_DLL "libxpcom.so"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Define CIDs...
|
||||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
// Define IIDs...
|
||||
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
//NS_DEFINE_IID(kIPostToServerIID, NS_IPOSTTOSERVER_IID);
|
||||
|
||||
#ifdef XP_UNIX
|
||||
extern "C" char *fe_GetConfigDir(void) {
|
||||
printf("XXX: return /tmp for fe_GetConfigDir\n");
|
||||
return strdup("/tmp");
|
||||
}
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
#if 0 // Enable after the stream listener interface is cleared up.
|
||||
class TestConsumer : public nsIStreamListener
|
||||
{
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
TestConsumer();
|
||||
|
||||
NS_IMETHOD GetBindInfo(nsIURL* aURL, nsStreamBindingInfo* info);
|
||||
NS_IMETHOD OnProgress(nsIURL* aURL, PRUint32 Progress, PRUint32 ProgressMax);
|
||||
NS_IMETHOD OnStatus(nsIURL* aURL, const PRUnichar* aMsg);
|
||||
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
|
||||
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRUint32 length);
|
||||
NS_IMETHOD OnStopBinding(nsIURL* aURL, nsresult status, const PRUnichar* aMsg);
|
||||
|
||||
protected:
|
||||
~TestConsumer();
|
||||
};
|
||||
|
||||
|
||||
TestConsumer::TestConsumer()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID);
|
||||
NS_IMPL_ISUPPORTS(TestConsumer,kIStreamListenerIID);
|
||||
|
||||
|
||||
TestConsumer::~TestConsumer()
|
||||
{
|
||||
if (bTraceEnabled) {
|
||||
printf("\n+++ TestConsumer is being deleted...\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP TestConsumer::GetBindInfo(nsIURL* aURL, nsStreamBindingInfo* info)
|
||||
{
|
||||
if (bTraceEnabled) {
|
||||
printf("\n+++ TestConsumer::GetBindInfo: URL: %p\n", aURL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TestConsumer::OnProgress(nsIURL* aURL, PRUint32 Progress,
|
||||
PRUint32 ProgressMax)
|
||||
{
|
||||
if (bTraceEnabled) {
|
||||
printf("\n+++ TestConsumer::OnProgress: URL: %p - %d of total %d\n", aURL, Progress, ProgressMax);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TestConsumer::OnStatus(nsIURL* aURL, const PRUnichar* aMsg)
|
||||
{
|
||||
if (bTraceEnabled) {
|
||||
printf("\n+++ TestConsumer::OnStatus: ");
|
||||
nsAutoString str(aMsg);
|
||||
char* c = str.ToNewCString();
|
||||
fputs(c, stdout);
|
||||
free(c);
|
||||
fputs("\n", stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TestConsumer::OnStartBinding(nsIURL* aURL, const char *aContentType)
|
||||
{
|
||||
if (bTraceEnabled) {
|
||||
printf("\n+++ TestConsumer::OnStartBinding: URL: %p, Content type: %s\n", aURL, aContentType);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRUint32 length)
|
||||
{
|
||||
PRUint32 len;
|
||||
|
||||
if (bTraceEnabled) {
|
||||
printf("\n+++ TestConsumer::OnDataAvailable: URL: %p, %d bytes available...\n", aURL, length);
|
||||
}
|
||||
|
||||
do {
|
||||
nsresult err;
|
||||
char buffer[80];
|
||||
PRUint32 i;
|
||||
|
||||
err = pIStream->Read(buffer, 0, 80, &len);
|
||||
if (err == NS_OK) {
|
||||
for (i=0; i<len; i++) {
|
||||
putchar(buffer[i]);
|
||||
}
|
||||
}
|
||||
} while (len > 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP TestConsumer::OnStopBinding(nsIURL* aURL, nsresult status, const PRUnichar* aMsg)
|
||||
{
|
||||
if (bTraceEnabled) {
|
||||
printf("\n+++ TestConsumer::OnStopBinding... URL: %p status: %d\n", aURL, status);
|
||||
}
|
||||
|
||||
if (NS_FAILED(status)) {
|
||||
const char* url;
|
||||
aURL->GetSpec(&url);
|
||||
|
||||
printf("Unable to load URL %s\n", url);
|
||||
}
|
||||
/* The document has been loaded, so drop out of the message pump... */
|
||||
urlLoaded = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // 0 - enabled after streamlistener is fixed.
|
||||
|
||||
nsresult ReadStreamSynchronously(nsIInputStream* aIn)
|
||||
{
|
||||
nsresult rv;
|
||||
char buffer[1024];
|
||||
|
||||
if (nsnull != aIn) {
|
||||
PRUint32 len;
|
||||
|
||||
do {
|
||||
PRUint32 i;
|
||||
|
||||
rv = aIn->Read(buffer, sizeof(buffer), &len);
|
||||
for (i=0; i<len; i++) {
|
||||
putchar(buffer[i]);
|
||||
}
|
||||
} while (len > 0);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int testURL(const char* pURL=0);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
nsAutoString url_address;
|
||||
// char buf[256];
|
||||
// nsIStreamListener *pConsumer;
|
||||
nsIEventQueueService* pEventQService;
|
||||
// nsIURL *pURL;
|
||||
nsresult result;
|
||||
int i;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("urltest: <URL> \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_InitXPCOM(nsnull);
|
||||
nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, "./components");
|
||||
|
||||
testURL(argv[1]);
|
||||
return 0;
|
||||
#if 0
|
||||
nsRepository::RegisterComponent(
|
||||
kEventQueueServiceCID, NULL, NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterComponent(
|
||||
kNetServiceCID, NULL, NULL, NETLIB_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
// Create the Event Queue for this thread...
|
||||
pEventQService = nsnull;
|
||||
result = nsServiceManager::GetService(kEventQueueServiceCID,
|
||||
kIEventQueueServiceIID,
|
||||
(nsISupports **)&pEventQService);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// XXX: What if this fails?
|
||||
result = pEventQService->CreateThreadEventQueue();
|
||||
}
|
||||
|
||||
for (i=1; i < argc; i++) {
|
||||
if (PL_strcasecmp(argv[i], "-all") == 0) {
|
||||
testURL(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
testURL(argv[i]);
|
||||
}
|
||||
|
||||
if (nsnull != pEventQService) {
|
||||
pEventQService->DestroyThreadEventQueue();
|
||||
nsServiceManager::ReleaseService(kEventQueueServiceCID, pEventQService);
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int testURL(const char* i_pURL)
|
||||
{
|
||||
const char* temp;
|
||||
if (i_pURL)
|
||||
{
|
||||
nsIURL* pURL = CreateURL(i_pURL);
|
||||
pURL->DebugString(&temp);
|
||||
cout << temp <<endl;
|
||||
|
||||
nsIInputStream* is = 0;
|
||||
if (NS_OK == pURL->GetStream(&is))
|
||||
{
|
||||
ReadStreamSynchronously(is);
|
||||
}
|
||||
|
||||
pURL->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int tests = 8;
|
||||
const char* url[tests] =
|
||||
{
|
||||
"http://username:password@hostname.com:80/pathname/./more/stuff/../path",
|
||||
"username@host:8080/path",
|
||||
"http://gagan/",
|
||||
"host:port/netlib", //port should now be 0
|
||||
"", //empty string
|
||||
"mailbox:///foo", // No host specified path should be /foo
|
||||
"user:pass@hostname.edu:80/pathname", //this is always user:pass and not http:user
|
||||
"username:password@hostname:80/pathname"
|
||||
};
|
||||
|
||||
for (int i = 0; i< tests; ++i)
|
||||
{
|
||||
nsIURL* pURL = CreateURL(url[i]);
|
||||
pURL->DebugString(&temp);
|
||||
cout << temp << endl;
|
||||
pURL->Release();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
74
mozilla/netwerk/build/Makefile.in
Normal file
74
mozilla/netwerk/build/Makefile.in
Normal file
@@ -0,0 +1,74 @@
|
||||
# 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.
|
||||
|
||||
DEPTH = ../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
LIBRARY_NAME = netwerk
|
||||
IS_COMPONENT = 1
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
CPPSRCS = \
|
||||
nsNetFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/libnetwerkbase_s.a \
|
||||
$(DIST)/lib/libnetwerkdns_s.a \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../base/src \
|
||||
-I$(srcdir)/../dns/src \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),HP-UX)
|
||||
EXTRA_DSO_LDOPTS = -c objs/objslist
|
||||
else
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MKSHLIB_FORCE_ALL) \
|
||||
$(SHARED_LIBRARY_LIBS) \
|
||||
$(MKSHLIB_UNFORCE_ALL) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
ifeq ($(OS_ARCH),HP-UX)
|
||||
shared_library_objs: $(SHARED_LIBRARY_LIBS)
|
||||
rm -rf objs
|
||||
mkdir objs
|
||||
(cd objs; for lib in $(SHARED_LIBRARY_LIBS); do ar xv ../$$lib; done) \
|
||||
| awk '{ print "objs/"$$3 }' > objs/objslist
|
||||
|
||||
$(LIBRARY) $(SHARED_LIBRARY): shared_library_objs Makefile
|
||||
else
|
||||
$(LIBRARY) $(SHARED_LIBRARY): $(SHARED_LIBRARY_LIBS) Makefile
|
||||
endif
|
||||
55
mozilla/netwerk/build/makefile.win
Normal file
55
mozilla/netwerk/build/makefile.win
Normal file
@@ -0,0 +1,55 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=netwerk
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=netwerk
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsNetFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\netwerkbase_s.lib \
|
||||
$(DIST)\lib\netwerkdns_s.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\plc3.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
MISCDEP=$(LLIBS)
|
||||
|
||||
INCS = $(INCS) \
|
||||
-I$(DEPTH)\dist\include \
|
||||
-I$(DEPTH)\netwerk\base\src \
|
||||
-I$(DEPTH)\netwerk\dns\src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
144
mozilla/netwerk/build/nsNetFactory.cpp
Normal file
144
mozilla/netwerk/build/nsNetFactory.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
/* -*- 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 "nsIGenericFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIOService.h"
|
||||
#include "nsNetModuleMgr.h"
|
||||
//#include "nsFileTransportService.h"
|
||||
#include "nsSocketTransportService.h"
|
||||
#include "nscore.h"
|
||||
#include "nsStandardUrl.h"
|
||||
#include "nsDnsService.h"
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
//static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
|
||||
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kExternalModuleManagerCID, NS_NETMODULEMGR_CID);
|
||||
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aFactory == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIGenericFactory* fact;
|
||||
if (aClass.Equals(kIOServiceCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsIOService::Create);
|
||||
}
|
||||
#if 0
|
||||
else if (aClass.Equals(kFileTransportServiceCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsFileTransportService::Create);
|
||||
}
|
||||
#endif
|
||||
else if (aClass.Equals(kSocketTransportServiceCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsSocketTransportService::Create);
|
||||
}
|
||||
else if (aClass.Equals(kStandardURLCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsStandardURL::Create);
|
||||
}
|
||||
else if (aClass.Equals(kExternalModuleManagerCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsNetModuleMgr::Create);
|
||||
}
|
||||
else if (aClass.Equals(kDNSServiceCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsDNSService::Create);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*aFactory = fact;
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kIOServiceCID,
|
||||
"Network Service",
|
||||
"component://netscape/network/net-service",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
#if 0
|
||||
rv = compMgr->RegisterComponent(kFileTransportServiceCID,
|
||||
"File Transport Service",
|
||||
"component://netscape/network/file-transport-service",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
#endif
|
||||
rv = compMgr->RegisterComponent(kSocketTransportServiceCID,
|
||||
"Socket Transport Service",
|
||||
"component://netscape/network/socket-transport-service",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kStandardURLCID,
|
||||
"Standard URL Implementation",
|
||||
"component://netscape/network/standard-url",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kExternalModuleManagerCID,
|
||||
"External Module Manager",
|
||||
"component://netscape/network/net-extern-mod",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kIOServiceCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
#if 0
|
||||
rv = compMgr->UnregisterComponent(kFileTransportServiceCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
#endif
|
||||
rv = compMgr->UnregisterComponent(kSocketTransportServiceCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kStandardURLCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kExternalModuleManagerCID, aPath);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
33
mozilla/netwerk/dns/Makefile.in
Normal file
33
mozilla/netwerk/dns/Makefile.in
Normal file
@@ -0,0 +1,33 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
27
mozilla/netwerk/dns/makefile.win
Normal file
27
mozilla/netwerk/dns/makefile.win
Normal file
@@ -0,0 +1,27 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..\..
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
42
mozilla/netwerk/dns/public/Makefile.in
Normal file
42
mozilla/netwerk/dns/public/Makefile.in
Normal file
@@ -0,0 +1,42 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
XPIDL_MODULE = netwerk_dns
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIDNSListener.idl \
|
||||
nsIDNSService.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
35
mozilla/netwerk/dns/public/makefile.win
Normal file
35
mozilla/netwerk/dns/public/makefile.win
Normal file
@@ -0,0 +1,35 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
XPIDL_MODULE = netwerk_dns
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIDNSListener.idl \
|
||||
.\nsIDNSService.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
52
mozilla/netwerk/dns/public/nsIDNSListener.idl
Normal file
52
mozilla/netwerk/dns/public/nsIDNSListener.idl
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.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) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
#include "prnetdb.h"
|
||||
|
||||
typedef struct nsHostEnt
|
||||
{
|
||||
PRHostEnt hostEnt;
|
||||
char buffer[PR_NETDB_BUF_SIZE];
|
||||
} nsHostEnt;
|
||||
%}
|
||||
|
||||
[ptr] native nsHostEntStar(nsHostEnt);
|
||||
|
||||
[scriptable, uuid(7686cef0-206e-11d3-9348-00104ba0fd40)]
|
||||
interface nsIDNSListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notify the listener that we are about to lookup the requested hostname.
|
||||
*/
|
||||
void OnStartLookup(in nsISupports ctxt, in string hostname);
|
||||
|
||||
/**
|
||||
* Notify the listener that we have found one or more addresses for the hostname.
|
||||
*/
|
||||
void OnFound(in nsISupports ctxt, in string hostname,
|
||||
in nsHostEntStar entry);
|
||||
|
||||
/**
|
||||
* Notify the listener that we the lookup has completed.
|
||||
*/
|
||||
void OnStopLookup(in nsISupports ctxt, in string hostname);
|
||||
};
|
||||
|
||||
42
mozilla/netwerk/dns/public/nsIDNSService.idl
Normal file
42
mozilla/netwerk/dns/public/nsIDNSService.idl
Normal file
@@ -0,0 +1,42 @@
|
||||
/* -*- 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.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) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_DNSSERVICE_CID \
|
||||
{ /* 718e7c81-f8b8-11d2-b951-c80918051d3c */ \
|
||||
0x718e7c81, \
|
||||
0xf8b8, \
|
||||
0x11d2, \
|
||||
{ 0xb9, 0x51, 0xc8, 0x09, 0x18, 0x05, 0x1d, 0x3c } \
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
interface nsIRequest;
|
||||
interface nsIDNSListener;
|
||||
|
||||
[scriptable, uuid(598f2f80-206f-11d3-9348-00104ba0fd40)]
|
||||
interface nsIDNSService : nsISupports
|
||||
{
|
||||
nsIRequest Lookup(in nsISupports ctxt, in string hostname,
|
||||
in nsIDNSListener listener);
|
||||
};
|
||||
|
||||
53
mozilla/netwerk/dns/src/Makefile.in
Normal file
53
mozilla/netwerk/dns/src/Makefile.in
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
LIBRARY_NAME = netwerkdns_s
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
CPPSRCS = \
|
||||
nsDnsService.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
MKSHLIB :=
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static l\ib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
|
||||
44
mozilla/netwerk/dns/src/makefile.win
Normal file
44
mozilla/netwerk/dns/src/makefile.win
Normal file
@@ -0,0 +1,44 @@
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
LCFLAGS = -DWIN32_LEAN_AND_MEAN -D_IMPL_NS_NET
|
||||
|
||||
LIBRARY_NAME=netwerkdns_s
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsDnsService.obj \
|
||||
$(NULL)
|
||||
|
||||
INCS = $(INCS) \
|
||||
-I$(DEPTH)\dist\include \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
159
mozilla/netwerk/dns/src/nsDnsService.cpp
Normal file
159
mozilla/netwerk/dns/src/nsDnsService.cpp
Normal file
@@ -0,0 +1,159 @@
|
||||
/* -*- 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.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) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsDnsService.h"
|
||||
#include "nsIDNSListener.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "prnetdb.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsDNSRequest;
|
||||
|
||||
class nsDNSLookup
|
||||
{
|
||||
public:
|
||||
nsresult AddDNSRequest(nsDNSRequest* request);
|
||||
|
||||
const char* mHostName;
|
||||
PRHostEnt mHostEntry; // NSPR or platform specific hostent?
|
||||
PRIntn mCount;
|
||||
PRBool mComplete;
|
||||
PRIntn mIndex; // XXX - for round robin
|
||||
void * mListenerQueue; // XXX - maintain a list of nsDNSRequests.
|
||||
};
|
||||
|
||||
|
||||
class nsDNSRequest : public nsIRequest
|
||||
{
|
||||
nsIDNSListener* mListener;
|
||||
nsDNSLookup* mHostNameLookup;
|
||||
|
||||
// nsIRequest methods:
|
||||
NS_IMETHOD Cancel(void);
|
||||
NS_IMETHOD Suspend(void);
|
||||
NS_IMETHOD Resume(void);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsDNSService methods:
|
||||
|
||||
nsDNSService::nsDNSService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDNSService::Init()
|
||||
{
|
||||
// initialize DNS cache (persistent?)
|
||||
#if defined(XP_MAC)
|
||||
// create Open Transport Service Provider for DNS Lookups
|
||||
#elif defined(_WIN)
|
||||
// create DNS EventHandler Window
|
||||
#elif defined(XP_UNIX)
|
||||
// XXXX - ?
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsDNSService::~nsDNSService()
|
||||
{
|
||||
// deallocate cache
|
||||
#if defined(XP_MAC)
|
||||
// deallocate Open Transport Service Provider
|
||||
#elif defined(_WIN)
|
||||
// dispose DNS EventHandler Window
|
||||
#elif defined(XP_UNIX)
|
||||
// XXXX - ?
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsDNSService, nsIDNSService::GetIID());
|
||||
|
||||
NS_METHOD
|
||||
nsDNSService::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
|
||||
{
|
||||
nsDNSService* ph = new nsDNSService();
|
||||
if (ph == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(ph);
|
||||
nsresult rv = ph->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(ph);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIDNSService methods:
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSService::Lookup(nsISupports* ctxt,
|
||||
const char* hostname,
|
||||
nsIDNSListener* listener,
|
||||
nsIRequest* *DNSRequest)
|
||||
{
|
||||
nsresult rv;
|
||||
PRStatus status;
|
||||
nsHostEnt* hostentry;
|
||||
/*
|
||||
check cache for existing nsDNSLookup with matching hostname
|
||||
call OnStartLookup
|
||||
if (nsDNSLookup doesn't exist) {
|
||||
create nsDNSLookup for this hostname
|
||||
kick off DNS Lookup
|
||||
}
|
||||
|
||||
if (nsDNSLookup already has at least one address) {
|
||||
call OnFound
|
||||
}
|
||||
|
||||
if (nsDNSLookup is already complete) {
|
||||
call OnStopLookup
|
||||
return null
|
||||
}
|
||||
|
||||
create nsDNSRequest
|
||||
queue nsDNSRequest on nsDNSLookup // XXXX - potential race condition here
|
||||
return nsDNSRequest
|
||||
*/
|
||||
|
||||
// temporary SYNC version
|
||||
hostentry = new nsHostEnt;
|
||||
if (!hostentry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = listener->OnStartLookup(ctxt, hostname);
|
||||
|
||||
|
||||
status = PR_GetHostByName(hostname, hostentry->buffer, PR_NETDB_BUF_SIZE, &hostentry->hostEnt);
|
||||
|
||||
if (PR_SUCCESS == status)
|
||||
rv = listener->OnFound(ctxt, hostname, hostentry); // turn ownership of hostentry over to listener?
|
||||
else
|
||||
delete hostentry;
|
||||
|
||||
rv = listener->OnStopLookup(ctxt, hostname);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
67
mozilla/netwerk/dns/src/nsDnsService.h
Normal file
67
mozilla/netwerk/dns/src/nsDnsService.h
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.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) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsDNSService_h__
|
||||
#define nsDNSService_h__
|
||||
|
||||
#include "nsIDNSService.h"
|
||||
#ifdef XP_PC
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
class nsIDNSListener;
|
||||
class nsICancelable;
|
||||
|
||||
class nsDNSService : public nsIDNSService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsDNSService methods:
|
||||
nsDNSService();
|
||||
virtual ~nsDNSService();
|
||||
nsresult Init();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
|
||||
// nsIDNSService methods:
|
||||
NS_IMETHOD Lookup(nsISupports *ctxt,
|
||||
const char *hostname,
|
||||
nsIDNSListener *listener,
|
||||
nsIRequest **result);
|
||||
|
||||
protected:
|
||||
// nsDNSLookup cache? - list of nsDNSLookups
|
||||
|
||||
#if defined(XP_MAC)
|
||||
InetSvcRef mServiceRef;
|
||||
|
||||
#elif defined(XP_UNIX)
|
||||
//XXX - to be defined
|
||||
|
||||
#elif defined(_WIN32)
|
||||
WNDCLASS wc;
|
||||
HWND DNSWindow;
|
||||
UINT msgAsyncSelect;
|
||||
UINT msgFoundDNS;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsDNSService_h__ */
|
||||
37
mozilla/netwerk/gen-makefile.sh
Executable file
37
mozilla/netwerk/gen-makefile.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Relative location of |makefiles|
|
||||
MODULE_DIR="mozilla/netwerk"
|
||||
|
||||
# Name of module
|
||||
MODULE=`basename $MODULE_DIR`
|
||||
|
||||
# Depth of module from topsrcdir
|
||||
MODULE_DEPTH=`echo $MODULE_DIR | sed -e 's|[^/]||g' -e 's|/|../|g' -e 's|/$||'`
|
||||
|
||||
# Relative directory script was run from
|
||||
RUN_DIR=`echo $PWD | sed -e 's|.*\('$MODULE_DIR'\)$|\1|'`
|
||||
|
||||
if [ -z "$RUN_DIR" -o "$RUN_DIR" != "$MODULE_DIR" ]
|
||||
then
|
||||
echo
|
||||
echo "This script needs to be run from $MODULE_DIR"
|
||||
echo
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ -n "$MODULE_DEPTH" ]
|
||||
then
|
||||
cd $MODULE_DEPTH
|
||||
fi
|
||||
|
||||
if [ -f config.status ]
|
||||
then
|
||||
CONFIG_FILES=`cat $MODULE/makefiles` ./config.status
|
||||
else
|
||||
echo
|
||||
echo "Missing config.status in $PWD"
|
||||
echo "Have you run ./configure yet?"
|
||||
echo
|
||||
exit -1
|
||||
fi
|
||||
22
mozilla/netwerk/macbuild/NetwerkSharedPrefix.h
Normal file
22
mozilla/netwerk/macbuild/NetwerkSharedPrefix.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* -*- 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.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) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Defining the following causes NS_NET to be defined as NS_EXPORT. */
|
||||
#define _IMPL_NS_NET
|
||||
|
||||
#include "MacSharedPrefix.h"
|
||||
22
mozilla/netwerk/macbuild/NetwerkSharedPrefix_debug.h
Normal file
22
mozilla/netwerk/macbuild/NetwerkSharedPrefix_debug.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* -*- 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.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) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Defining the following causes NS_NET to be defined as NS_EXPORT. */
|
||||
#define _IMPL_NS_NET
|
||||
|
||||
#include "MacSharedPrefix_debug.h"
|
||||
BIN
mozilla/netwerk/macbuild/netwerk.mcp
Normal file
BIN
mozilla/netwerk/macbuild/netwerk.mcp
Normal file
Binary file not shown.
30
mozilla/netwerk/makefile.win
Normal file
30
mozilla/netwerk/makefile.win
Normal file
@@ -0,0 +1,30 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DIRS= \
|
||||
base \
|
||||
dns \
|
||||
build \
|
||||
protocol \
|
||||
test \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
21
mozilla/netwerk/makefiles
Normal file
21
mozilla/netwerk/makefiles
Normal file
@@ -0,0 +1,21 @@
|
||||
netwerk/Makefile
|
||||
netwerk/base/Makefile
|
||||
netwerk/base/public/Makefile
|
||||
netwerk/base/src/Makefile
|
||||
netwerk/dns/Makefile
|
||||
netwerk/dns/public/Makefile
|
||||
netwerk/dns/src/Makefile
|
||||
netwerk/build/Makefile
|
||||
netwerk/protocol/Makefile
|
||||
netwerk/protocol/file/Makefile
|
||||
netwerk/protocol/file/public/Makefile
|
||||
netwerk/protocol/file/src/Makefile
|
||||
netwerk/protocol/ftp/Makefile
|
||||
netwerk/protocol/ftp/public/Makefile
|
||||
netwerk/protocol/ftp/src/Makefile
|
||||
netwerk/protocol/http/Makefile
|
||||
netwerk/protocol/http/public/Makefile
|
||||
netwerk/protocol/http/src/Makefile
|
||||
netwerk/protocol/resource/Makefile
|
||||
netwerk/protocol/resource/src/Makefile
|
||||
netwerk/test/Makefile
|
||||
35
mozilla/netwerk/protocol/Makefile.in
Normal file
35
mozilla/netwerk/protocol/Makefile.in
Normal file
@@ -0,0 +1,35 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
file \
|
||||
resource \
|
||||
ftp \
|
||||
http \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
33
mozilla/netwerk/protocol/file/Makefile.in
Normal file
33
mozilla/netwerk/protocol/file/Makefile.in
Normal file
@@ -0,0 +1,33 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
30
mozilla/netwerk/protocol/file/makefile.win
Normal file
30
mozilla/netwerk/protocol/file/makefile.win
Normal file
@@ -0,0 +1,30 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile to build the pluggable HTTP
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
DEPTH=..\..\..
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
42
mozilla/netwerk/protocol/file/public/Makefile.in
Normal file
42
mozilla/netwerk/protocol/file/public/Makefile.in
Normal file
@@ -0,0 +1,42 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
XPIDL_MODULE = netwerk_file
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIFileChannel.idl \
|
||||
nsIFileProtocolHandler.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
36
mozilla/netwerk/protocol/file/public/makefile.win
Normal file
36
mozilla/netwerk/protocol/file/public/makefile.win
Normal file
@@ -0,0 +1,36 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..\..
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
XPIDL_MODULE = netwerk_file
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIFileChannel.idl \
|
||||
.\nsIFileProtocolHandler.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
122
mozilla/netwerk/protocol/file/public/nsIFileChannel.idl
Normal file
122
mozilla/netwerk/protocol/file/public/nsIFileChannel.idl
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- 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.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 "nsIChannel.idl"
|
||||
|
||||
interface nsISimpleEnumerator;
|
||||
|
||||
[scriptable, uuid(73025830-0ce2-11d3-9331-00104ba0fd40)]
|
||||
interface nsIFileChannel : nsIChannel
|
||||
{
|
||||
/**
|
||||
* Returns the creation date of the URL.
|
||||
*/
|
||||
readonly attribute PRTime CreationDate;
|
||||
|
||||
/**
|
||||
* Returns the last modification date of the URL.
|
||||
*/
|
||||
readonly attribute PRTime ModDate;
|
||||
|
||||
/**
|
||||
* Returns the size of the file referred to by the URL.
|
||||
* @return NS_ERROR_FAILURE if the URL refers to a directory.
|
||||
*/
|
||||
readonly attribute unsigned long FileSize;
|
||||
|
||||
/**
|
||||
* Returns the parent directory of a URL.
|
||||
*/
|
||||
readonly attribute nsIFileChannel Parent;
|
||||
|
||||
/**
|
||||
* Returns an enumeration of the elements in a directory. Each
|
||||
* element in the enumeration is an nsIFileChannel.
|
||||
* @return NS_ERROR_FAILURE if the current nsIFileChannel does
|
||||
* not specify a directory.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator Children;
|
||||
|
||||
/**
|
||||
* Returns a native path string suitable to be passes to native platform
|
||||
* routines.
|
||||
*/
|
||||
readonly attribute string NativePath;
|
||||
|
||||
/**
|
||||
* Returns true if the file exists.
|
||||
*/
|
||||
boolean Exists();
|
||||
|
||||
/**
|
||||
* Creates an empty file if the file does not exist.
|
||||
*/
|
||||
void Create();
|
||||
|
||||
/**
|
||||
* Returns true if the file exists.
|
||||
*/
|
||||
void Delete();
|
||||
|
||||
/**
|
||||
* Move or rename a file.
|
||||
*/
|
||||
void MoveFrom(in nsIURI src);
|
||||
|
||||
/**
|
||||
* Copies the contents of a file to a new destination. Creates the
|
||||
* destination file if it doesn't already exist, otherwise overwrites
|
||||
* it.
|
||||
*/
|
||||
void CopyFrom(in nsIURI src);
|
||||
|
||||
/**
|
||||
* Returns true if the file URL specifies a directory. Note that this
|
||||
* may be the case even if the file URL does not terminate with a slash.
|
||||
*/
|
||||
boolean IsDirectory();
|
||||
|
||||
/**
|
||||
* Returns true if the file URL specifies a file and not a directory.
|
||||
*/
|
||||
boolean IsFile();
|
||||
|
||||
/**
|
||||
* Returns true if the specified file is a symbolic link (on unix),
|
||||
* alias (on Mac) or shortcut (on Windows).
|
||||
*/
|
||||
boolean IsLink();
|
||||
|
||||
/**
|
||||
* Returns a file URL to the destination of a link (alias or shortcut).
|
||||
*/
|
||||
nsIFileChannel ResolveLink();
|
||||
|
||||
/**
|
||||
* Returns a unique file name for the directory of the current URL.
|
||||
*/
|
||||
string MakeUniqueFileName(in string baseName);
|
||||
|
||||
/**
|
||||
* Executes a program specified by the file channel.
|
||||
* @param args - The program arguments to run with. If not specified,
|
||||
* the Query portion of the URI is used as the argument string.
|
||||
*/
|
||||
void Execute(in string args);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
@@ -16,10 +16,11 @@
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __NS_JSWINPROTOTYPE_H__
|
||||
#define __NS_JSWINPROTOTYPE_H__
|
||||
#include "nsIProtocolHandler.idl"
|
||||
|
||||
PRInt32
|
||||
InitWinProfilePrototype(JSContext *jscontext, JSObject *global, JSObject **winRegPrototype);
|
||||
interface nsIFileChannel;
|
||||
|
||||
#endif
|
||||
interface nsIFileProtocolHandler : nsIProtocolHandler
|
||||
{
|
||||
nsIFileChannel NewChannelFromNativePath(in string nativePath);
|
||||
};
|
||||
47
mozilla/netwerk/protocol/file/src/Makefile.in
Normal file
47
mozilla/netwerk/protocol/file/src/Makefile.in
Normal file
@@ -0,0 +1,47 @@
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
LIBRARY_NAME = fileprotocol
|
||||
|
||||
IS_COMPONENT = 1
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
CPPSRCS = \
|
||||
nsFileChannel.cpp \
|
||||
nsFileProtocolHandler.cpp \
|
||||
nsFileProtocolFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom netwerk raptor
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
TARGET = $(LIBARY)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
61
mozilla/netwerk/protocol/file/src/makefile.win
Normal file
61
mozilla/netwerk/protocol/file/src/makefile.win
Normal file
@@ -0,0 +1,61 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
MODULE=netwerk
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
IS_COMPONENT=1
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=fileprotocol
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
LLIBS= $(LLIBS) \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\plc3.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(NULL)
|
||||
|
||||
MISCDEP=$(LLIBS)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsFileChannel.obj \
|
||||
.\$(OBJDIR)\nsFileProtocolHandler.obj \
|
||||
.\$(OBJDIR)\nsFileProtocolFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES=-I.
|
||||
|
||||
INCLUDES = $(LOCAL_INCLUDES)
|
||||
|
||||
REQUIRES= netwerk
|
||||
|
||||
INCS = $(INCS) \
|
||||
-I$(DEPTH)\dist\include \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
843
mozilla/netwerk/protocol/file/src/nsFileChannel.cpp
Normal file
843
mozilla/netwerk/protocol/file/src/nsFileChannel.cpp
Normal file
@@ -0,0 +1,843 @@
|
||||
/* -*- 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 "nsFileChannel.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIEventSinkGetter.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsFileProtocolHandler.h"
|
||||
#include "nsIBuffer.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "netCore.h"
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIURL.h"
|
||||
#include "prio.h"
|
||||
|
||||
NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFileChannel::nsFileChannel()
|
||||
: mURI(nsnull), mGetter(nsnull), mListener(nsnull), mEventQueue(nsnull),
|
||||
mContext(nsnull), mState(QUIESCENT),
|
||||
mSuspended(PR_FALSE), mFileStream(nsnull),
|
||||
mBufferInputStream(nsnull), mBufferOutputStream(nsnull),
|
||||
mStatus(NS_OK), mHandler(nsnull), mSourceOffset(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileChannel::Init(nsFileProtocolHandler* handler,
|
||||
const char* verb, nsIURI* uri, nsIEventSinkGetter* getter,
|
||||
nsIEventQueue* queue)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
mHandler = handler;
|
||||
NS_ADDREF(mHandler);
|
||||
|
||||
mGetter = getter;
|
||||
NS_IF_ADDREF(mGetter);
|
||||
|
||||
mLock = PR_NewLock();
|
||||
if (mLock == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (getter) {
|
||||
rv = getter->GetEventSink(verb, nsIStreamListener::GetIID(), (nsISupports**)&mListener);
|
||||
// ignore the failure -- we can live without having an event sink
|
||||
}
|
||||
|
||||
mURI = uri;
|
||||
NS_ADDREF(mURI);
|
||||
|
||||
// XXX temporary, until we integrate more thoroughly with nsFileSpec
|
||||
char* url;
|
||||
rv = mURI->GetSpec(&url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsFileURL fileURL(url);
|
||||
nsCRT::free(url);
|
||||
mSpec = fileURL;
|
||||
|
||||
mEventQueue = queue;
|
||||
NS_IF_ADDREF(mEventQueue);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsFileChannel::~nsFileChannel()
|
||||
{
|
||||
NS_IF_RELEASE(mURI);
|
||||
NS_IF_RELEASE(mGetter);
|
||||
NS_IF_RELEASE(mListener);
|
||||
NS_IF_RELEASE(mEventQueue);
|
||||
NS_IF_RELEASE(mContext);
|
||||
NS_IF_RELEASE(mHandler);
|
||||
NS_ASSERTION(mFileStream == nsnull, "channel not closed");
|
||||
NS_ASSERTION(mBufferInputStream == nsnull, "channel not closed");
|
||||
NS_ASSERTION(mBufferOutputStream == nsnull, "channel not closed");
|
||||
if (mLock)
|
||||
PR_DestroyLock(mLock);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ASSERTION(aInstancePtr, "no instance pointer");
|
||||
if (aIID.Equals(nsIFileChannel::GetIID()) ||
|
||||
aIID.Equals(nsIChannel::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIFileChannel*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsFileChannel);
|
||||
NS_IMPL_RELEASE(nsFileChannel);
|
||||
|
||||
NS_METHOD
|
||||
nsFileChannel::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
|
||||
{
|
||||
nsFileChannel* fc = new nsFileChannel();
|
||||
if (fc == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(fc);
|
||||
nsresult rv = fc->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(fc);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// From nsIRequest
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Cancel()
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
mStatus = NS_BINDING_ABORTED;
|
||||
if (mSuspended) {
|
||||
Resume();
|
||||
}
|
||||
mState = ENDING;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Suspend()
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (!mSuspended) {
|
||||
// XXX close the stream here?
|
||||
mStatus = mHandler->Suspend(this);
|
||||
mSuspended = PR_TRUE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Resume()
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (!mSuspended) {
|
||||
// XXX re-open the stream and seek here?
|
||||
mStatus = mHandler->Resume(this);
|
||||
mSuspended = PR_FALSE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsAsyncOutputStream : public nsIBufferOutputStream {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIBaseStream methods:
|
||||
|
||||
NS_IMETHOD Close() {
|
||||
return mOutputStream->Close();
|
||||
}
|
||||
|
||||
// nsIOutputStream methods:
|
||||
|
||||
NS_IMETHOD Write(const char *buf, PRUint32 count, PRUint32 *writeCount) {
|
||||
nsresult rv;
|
||||
rv = mOutputStream->Write(buf, count, writeCount);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mListener->OnDataAvailable(mContext, mInputStream, mOffset, *writeCount);
|
||||
mOffset += *writeCount;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush() {
|
||||
return mOutputStream->Flush();
|
||||
}
|
||||
|
||||
// nsIBufferOutputStream methods:
|
||||
|
||||
NS_IMETHOD GetBuffer(nsIBuffer * *aBuffer) {
|
||||
return mOutputStream->GetBuffer(aBuffer);
|
||||
}
|
||||
|
||||
NS_IMETHOD WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *writeCount) {
|
||||
nsresult rv;
|
||||
rv = mOutputStream->WriteFrom(inStr, count, writeCount);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mListener->OnDataAvailable(mContext, mInputStream, mOffset, *writeCount);
|
||||
mOffset += *writeCount;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAsyncOutputStream()
|
||||
: mContext(nsnull), mListener(nsnull), mInputStream(nsnull),
|
||||
mOutputStream(nsnull), mOffset(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult Init(nsISupports* context, nsIStreamListener* listener,
|
||||
PRUint32 growBySize, PRUint32 maxSize) {
|
||||
nsresult rv;
|
||||
rv = NS_NewPipe(&mInputStream, &mOutputStream,
|
||||
growBySize, maxSize, PR_TRUE, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mContext = context;
|
||||
NS_IF_ADDREF(mContext);
|
||||
mListener = listener;
|
||||
NS_ADDREF(mListener);
|
||||
return rv;
|
||||
}
|
||||
|
||||
virtual ~nsAsyncOutputStream() {
|
||||
NS_IF_RELEASE(mContext);
|
||||
NS_IF_RELEASE(mListener);
|
||||
NS_IF_RELEASE(mInputStream);
|
||||
NS_IF_RELEASE(mOutputStream);
|
||||
}
|
||||
|
||||
static NS_METHOD Create(nsIBufferInputStream* *inStr,
|
||||
nsIBufferOutputStream* *outStr,
|
||||
nsISupports* context, nsIStreamListener* listener,
|
||||
PRUint32 growBySize, PRUint32 maxSize) {
|
||||
nsAsyncOutputStream* str = new nsAsyncOutputStream();
|
||||
if (str == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(str);
|
||||
nsresult rv = str->Init(context, listener, growBySize, maxSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(str);
|
||||
return rv;
|
||||
}
|
||||
*inStr = str->mInputStream;
|
||||
NS_ADDREF(*inStr);
|
||||
*outStr = str;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsISupports* mContext;
|
||||
nsIStreamListener* mListener;
|
||||
nsIBufferInputStream* mInputStream;
|
||||
nsIBufferOutputStream* mOutputStream;
|
||||
PRUint32 mOffset;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAsyncOutputStream, nsIBufferOutputStream::GetIID());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// From nsIChannel
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetURI(nsIURI * *aURI)
|
||||
{
|
||||
*aURI = mURI;
|
||||
NS_ADDREF(mURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::OpenInputStream(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsIInputStream **result)
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (mState != QUIESCENT)
|
||||
return NS_ERROR_IN_PROGRESS;
|
||||
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewPipe(&mBufferInputStream, &mBufferOutputStream,
|
||||
NS_FILE_TRANSPORT_SEGMENT_SIZE,
|
||||
NS_FILE_TRANSPORT_BUFFER_SIZE, PR_TRUE, nsnull);
|
||||
// rv = serv->NewSyncStreamListener(&mBufferInputStream, &mBufferOutputStream, &mListener);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mState = START_READ;
|
||||
mSourceOffset = startPosition;
|
||||
mAmount = readCount;
|
||||
mListener = nsnull;
|
||||
|
||||
rv = mHandler->DispatchRequest(this);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = mBufferInputStream;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::OpenOutputStream(PRUint32 startPosition, nsIOutputStream **result)
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (mState != QUIESCENT)
|
||||
return NS_ERROR_IN_PROGRESS;
|
||||
|
||||
#if 0
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIStreamListener* syncListener;
|
||||
nsIBufferInputStream* inStr;
|
||||
nsIBufferOutputStream* outStr;
|
||||
rv = serv->NewSyncStreamListener(&inStr, &outStr, &syncListener);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mListener = syncListener;
|
||||
mOutputStream = outStr;
|
||||
mState = START_READ;
|
||||
mSourceOffset = startPosition;
|
||||
mAmount = readCount;
|
||||
|
||||
rv = mHandler->DispatchRequest(this);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(inStr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = inStr;
|
||||
#else
|
||||
NS_ASSERTION(startPosition == 0, "implement startPosition");
|
||||
nsISupports* str;
|
||||
rv = NS_NewTypicalOutputFileStream(&str, mSpec);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = str->QueryInterface(nsIOutputStream::GetIID(), (void**)result);
|
||||
NS_RELEASE(str);
|
||||
return rv;
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamListener *listener)
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = serv->NewAsyncStreamListener(listener, eventQueue, &mListener);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsAsyncOutputStream::Create(&mBufferInputStream,
|
||||
&mBufferOutputStream,
|
||||
ctxt, mListener,
|
||||
NS_FILE_TRANSPORT_SEGMENT_SIZE,
|
||||
NS_FILE_TRANSPORT_BUFFER_SIZE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mContext = ctxt;
|
||||
NS_IF_ADDREF(mContext);
|
||||
|
||||
mState = START_READ;
|
||||
mSourceOffset = startPosition;
|
||||
mAmount = readCount;
|
||||
|
||||
rv = mHandler->DispatchRequest(this);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::AsyncWrite(nsIInputStream *fromStream,
|
||||
PRUint32 startPosition, PRInt32 writeCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamObserver *observer)
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRunnable methods:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Run(void)
|
||||
{
|
||||
while (mState != QUIESCENT && !mSuspended) {
|
||||
Process();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_METHOD
|
||||
nsWriteToFile(void* closure,
|
||||
const char* fromRawSegment,
|
||||
PRUint32 toOffset,
|
||||
PRUint32 count,
|
||||
PRUint32 *writeCount)
|
||||
{
|
||||
nsIOutputStream* outStr = (nsIOutputStream*)closure;
|
||||
nsresult rv = outStr->Write(fromRawSegment, count, writeCount);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsFileChannel::Process(void)
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
switch (mState) {
|
||||
case START_READ: {
|
||||
nsISupports* fs;
|
||||
NS_ASSERTION(mSourceOffset == 0, "implement seek");
|
||||
|
||||
if (mListener) {
|
||||
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
}
|
||||
|
||||
mStatus = NS_NewTypicalInputFileStream(&fs, mSpec);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = fs->QueryInterface(nsIInputStream::GetIID(), (void**)&mFileStream);
|
||||
NS_RELEASE(fs);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mState = READING;
|
||||
break;
|
||||
}
|
||||
case READING: {
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
nsIInputStream* fileStr = NS_STATIC_CAST(nsIInputStream*, mFileStream);
|
||||
|
||||
PRUint32 inLen;
|
||||
mStatus = fileStr->GetLength(&inLen);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
PRUint32 amt;
|
||||
mStatus = mBufferOutputStream->WriteFrom(fileStr, inLen, &amt);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
// and feed the buffer to the application via the buffer stream:
|
||||
if (mListener) {
|
||||
mStatus = mListener->OnDataAvailable(mContext, mBufferInputStream, mSourceOffset, amt);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
}
|
||||
|
||||
mSourceOffset += amt;
|
||||
|
||||
// stay in the READING state
|
||||
break;
|
||||
}
|
||||
case START_WRITE: {
|
||||
nsISupports* fs;
|
||||
|
||||
if (mListener) {
|
||||
mStatus = mListener->OnStartBinding(mContext); // always send the start notification
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
}
|
||||
|
||||
mStatus = NS_NewTypicalOutputFileStream(&fs, mSpec);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mStatus = fs->QueryInterface(nsIOutputStream::GetIID(), (void**)&mFileStream);
|
||||
NS_RELEASE(fs);
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
mState = WRITING;
|
||||
break;
|
||||
}
|
||||
case WRITING: {
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
#if 0
|
||||
PRUint32 amt;
|
||||
mStatus = mBuffer->ReadSegments(nsWriteToFile, mFileStream, (PRUint32)-1, &amt);
|
||||
if (mStatus == NS_BASE_STREAM_EOF) goto error;
|
||||
if (NS_FAILED(mStatus)) goto error;
|
||||
|
||||
nsAutoCMonitor mon(mBuffer);
|
||||
mon.Notify();
|
||||
|
||||
mSourceOffset += amt;
|
||||
#endif
|
||||
// stay in the WRITING state
|
||||
break;
|
||||
}
|
||||
case ENDING: {
|
||||
mBufferOutputStream->Flush();
|
||||
if (mListener) {
|
||||
// XXX where do we get the error message?
|
||||
(void)mListener->OnStopBinding(mContext, mStatus, nsnull);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mBufferOutputStream);
|
||||
mBufferOutputStream = nsnull;
|
||||
NS_IF_RELEASE(mBufferInputStream);
|
||||
mBufferInputStream = nsnull;
|
||||
NS_IF_RELEASE(mFileStream);
|
||||
mFileStream = nsnull;
|
||||
NS_IF_RELEASE(mContext);
|
||||
mContext = nsnull;
|
||||
|
||||
mState = QUIESCENT;
|
||||
break;
|
||||
}
|
||||
case QUIESCENT: {
|
||||
NS_NOTREACHED("trying to continue a quiescent file transfer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
error:
|
||||
mState = ENDING;
|
||||
return;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// From nsIFileChannel
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetCreationDate(PRTime *aCreationDate)
|
||||
{
|
||||
// XXX no GetCreationDate in nsFileSpec yet
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetModDate(PRTime *aModDate)
|
||||
{
|
||||
nsFileSpec::TimeStamp date;
|
||||
mSpec.GetModDate(date);
|
||||
LL_I2L(*aModDate, date);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetFileSize(PRUint32 *aFileSize)
|
||||
{
|
||||
*aFileSize = mSpec.GetFileSize();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetParent(nsIFileChannel * *aParent)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsFileSpec parentSpec;
|
||||
mSpec.GetParent(parentSpec);
|
||||
nsFileURL parentURL(parentSpec);
|
||||
const char* urlStr = parentURL.GetURLString();
|
||||
|
||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsIChannel* channel;
|
||||
rv = serv->NewChannel("load", // XXX what should this be?
|
||||
urlStr, nsnull,
|
||||
mGetter, &channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// this cast is safe because nsFileURL::GetURLString aways
|
||||
// returns file: strings, and consequently we'll make nsIFileChannel
|
||||
// objects from them:
|
||||
*aParent = NS_STATIC_CAST(nsIFileChannel*, channel);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsDirEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsDirEnumerator() : mHandler(nsnull), mDir(nsnull), mNext(nsnull) {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult Init(nsFileProtocolHandler* handler, nsFileSpec& spec) {
|
||||
const char* path = spec.GetNativePathCString();
|
||||
mDir = PR_OpenDir(path);
|
||||
if (mDir == nsnull) // not a directory?
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mHandler = handler;
|
||||
NS_ADDREF(mHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD HasMoreElements(PRBool *result) {
|
||||
nsresult rv;
|
||||
if (mNext == nsnull && mDir) {
|
||||
PRDirEntry* entry = PR_ReadDir(mDir, PR_SKIP_BOTH);
|
||||
if (entry == nsnull) {
|
||||
// end of dir entries
|
||||
|
||||
PRStatus status = PR_CloseDir(mDir);
|
||||
if (status != PR_SUCCESS)
|
||||
return NS_ERROR_FAILURE;
|
||||
mDir = nsnull;
|
||||
|
||||
*result = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const char* path = entry->name;
|
||||
rv = mHandler->NewChannelFromNativePath(path, &mNext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ASSERTION(mNext, "NewChannel failed");
|
||||
}
|
||||
*result = mNext != nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetNext(nsISupports **result) {
|
||||
nsresult rv;
|
||||
PRBool hasMore;
|
||||
rv = HasMoreElements(&hasMore);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = mNext; // might return nsnull
|
||||
mNext = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual ~nsDirEnumerator() {
|
||||
if (mDir) {
|
||||
PRStatus status = PR_CloseDir(mDir);
|
||||
NS_ASSERTION(status == PR_SUCCESS, "close failed");
|
||||
}
|
||||
NS_IF_RELEASE(mHandler);
|
||||
NS_IF_RELEASE(mNext);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsFileProtocolHandler* mHandler;
|
||||
PRDir* mDir;
|
||||
nsIFileChannel* mNext;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsDirEnumerator, nsISimpleEnumerator::GetIID());
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetChildren(nsISimpleEnumerator * *aChildren)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
PRBool isDir;
|
||||
rv = IsDirectory(&isDir);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!isDir)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsDirEnumerator* dirEnum = new nsDirEnumerator();
|
||||
if (dirEnum == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(dirEnum);
|
||||
rv = dirEnum->Init(mHandler, mSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(dirEnum);
|
||||
return rv;
|
||||
}
|
||||
*aChildren = dirEnum;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetNativePath(char * *aNativePath)
|
||||
{
|
||||
char* nativePath = nsCRT::strdup(mSpec.GetNativePathCString());
|
||||
if (nativePath == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*aNativePath = nativePath;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Exists(PRBool *result)
|
||||
{
|
||||
*result = mSpec.Exists();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Create()
|
||||
{
|
||||
// XXX no Create in nsFileSpec -- creates non-existent file
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Delete()
|
||||
{
|
||||
// XXX no Delete in nsFileSpec -- deletes file or dir
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::MoveFrom(nsIURI *src)
|
||||
{
|
||||
#if 0
|
||||
nsresult rv;
|
||||
nsIFileChannel* fc;
|
||||
rv = src->QueryInterface(nsIFileChannel::GetIID(), (void**)&fc);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = fc->moveToDir(this);
|
||||
NS_RELEASE(fc);
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
// Do it the hard way -- fetch the URL and store the bits locally.
|
||||
// Delete the src when done.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::CopyFrom(nsIURI *src)
|
||||
{
|
||||
#if 0
|
||||
nsresult rv;
|
||||
nsIFileChannel* fc;
|
||||
rv = src->QueryInterface(nsIFileChannel::GetIID(), (void**)&fc);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = fc->copyToDir(this);
|
||||
NS_RELEASE(fc);
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
// Do it the hard way -- fetch the URL and store the bits locally.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#else
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::IsDirectory(PRBool *result)
|
||||
{
|
||||
*result = mSpec.IsDirectory();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::IsFile(PRBool *result)
|
||||
{
|
||||
*result = mSpec.IsFile();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::IsLink(PRBool *_retval)
|
||||
{
|
||||
// XXX no IsLink in nsFileSpec (for alias/shortcut/symlink)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::ResolveLink(nsIFileChannel **_retval)
|
||||
{
|
||||
// XXX no ResolveLink in nsFileSpec yet -- returns what link points to
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::MakeUniqueFileName(const char* baseName, char **_retval)
|
||||
{
|
||||
// XXX makeUnique needs to return the name or file spec to the newly create
|
||||
// file!
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::Execute(const char *args)
|
||||
{
|
||||
nsresult rv;
|
||||
char* queryArgs = nsnull;
|
||||
|
||||
if (args == nsnull) {
|
||||
nsIURL* url;
|
||||
rv = mURI->QueryInterface(nsIURL::GetIID(), (void**)&url);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = url->GetQuery(&queryArgs);
|
||||
NS_RELEASE(url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
args = queryArgs;
|
||||
}
|
||||
}
|
||||
|
||||
rv = mSpec.Execute(args);
|
||||
if (queryArgs)
|
||||
nsCRT::free(queryArgs);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
183
mozilla/netwerk/protocol/file/src/nsFileChannel.h
Normal file
183
mozilla/netwerk/protocol/file/src/nsFileChannel.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsFileChannel_h__
|
||||
#define nsFileChannel_h__
|
||||
|
||||
#include "nsIFileChannel.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "prlock.h"
|
||||
|
||||
class nsIEventSinkGetter;
|
||||
class nsIStreamListener;
|
||||
class nsFileProtocolHandler;
|
||||
class nsIBaseStream;
|
||||
class nsIBuffer;
|
||||
class nsIBufferInputStream;
|
||||
class nsIBufferOutputStream;
|
||||
|
||||
class nsFileChannel : public nsIFileChannel, public nsIRunnable {
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIRequest:
|
||||
|
||||
/* void Cancel (); */
|
||||
NS_IMETHOD Cancel();
|
||||
|
||||
/* void Suspend (); */
|
||||
NS_IMETHOD Suspend();
|
||||
|
||||
/* void Resume (); */
|
||||
NS_IMETHOD Resume();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIChannel:
|
||||
|
||||
/* readonly attribute nsIURI URI; */
|
||||
NS_IMETHOD GetURI(nsIURI * *aURI);
|
||||
|
||||
/* nsIInputStream OpenInputStream (); */
|
||||
NS_IMETHOD OpenInputStream(PRUint32 startPosition, PRInt32 count, nsIInputStream **_retval);
|
||||
|
||||
/* nsIOutputStream OpenOutputStream (); */
|
||||
NS_IMETHOD OpenOutputStream(PRUint32 startPosition, nsIOutputStream **_retval);
|
||||
|
||||
/* void AsyncRead (in unsigned long startPosition, in long readCount, in nsISupports ctxt, in nsIEventQueue eventQueue, in nsIStreamListener listener); */
|
||||
NS_IMETHOD AsyncRead(PRUint32 startPosition, PRInt32 readCount, nsISupports *ctxt, nsIEventQueue *eventQueue, nsIStreamListener *listener);
|
||||
|
||||
/* void AsyncWrite (in nsIInputStream fromStream, in unsigned long startPosition, in long writeCount, in nsISupports ctxt, in nsIEventQueue eventQueue, in nsIStreamObserver observer); */
|
||||
NS_IMETHOD AsyncWrite(nsIInputStream *fromStream, PRUint32 startPosition, PRInt32 writeCount, nsISupports *ctxt, nsIEventQueue *eventQueue, nsIStreamObserver *observer);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIFileChannel:
|
||||
|
||||
/* readonly attribute PRTime CreationDate; */
|
||||
NS_IMETHOD GetCreationDate(PRTime *aCreationDate);
|
||||
|
||||
/* readonly attribute PRTime ModDate; */
|
||||
NS_IMETHOD GetModDate(PRTime *aModDate);
|
||||
|
||||
/* readonly attribute unsigned long FileSize; */
|
||||
NS_IMETHOD GetFileSize(PRUint32 *aFileSize);
|
||||
|
||||
/* readonly attribute nsIFileChannel Parent; */
|
||||
NS_IMETHOD GetParent(nsIFileChannel * *aParent);
|
||||
|
||||
/* readonly attribute nsISimpleEnumerator Children; */
|
||||
NS_IMETHOD GetChildren(nsISimpleEnumerator * *aChildren);
|
||||
|
||||
/* readonly attribute string NativePath; */
|
||||
NS_IMETHOD GetNativePath(char * *aNativePath);
|
||||
|
||||
/* boolean Exists (); */
|
||||
NS_IMETHOD Exists(PRBool *_retval);
|
||||
|
||||
/* void Create (); */
|
||||
NS_IMETHOD Create();
|
||||
|
||||
/* void Delete (); */
|
||||
NS_IMETHOD Delete();
|
||||
|
||||
/* void MoveFrom (in nsIURI src); */
|
||||
NS_IMETHOD MoveFrom(nsIURI *src);
|
||||
|
||||
/* void CopyFrom (in nsIURI src); */
|
||||
NS_IMETHOD CopyFrom(nsIURI *src);
|
||||
|
||||
/* boolean IsDirectory (); */
|
||||
NS_IMETHOD IsDirectory(PRBool *_retval);
|
||||
|
||||
/* boolean IsFile (); */
|
||||
NS_IMETHOD IsFile(PRBool *_retval);
|
||||
|
||||
/* boolean IsLink (); */
|
||||
NS_IMETHOD IsLink(PRBool *_retval);
|
||||
|
||||
/* nsIFileChannel ResolveLink (); */
|
||||
NS_IMETHOD ResolveLink(nsIFileChannel **_retval);
|
||||
|
||||
/* string MakeUniqueFileName (in string baseName); */
|
||||
NS_IMETHOD MakeUniqueFileName(const char *baseName, char **_retval);
|
||||
|
||||
/* void Execute (in string args); */
|
||||
NS_IMETHOD Execute(const char *args);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRunnable methods:
|
||||
|
||||
NS_IMETHOD Run(void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsFileChannel:
|
||||
|
||||
nsFileChannel();
|
||||
// Always make the destructor virtual:
|
||||
virtual ~nsFileChannel();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
|
||||
nsresult Init(nsFileProtocolHandler* handler,
|
||||
const char* verb, nsIURI* uri, nsIEventSinkGetter* getter,
|
||||
nsIEventQueue* queue);
|
||||
|
||||
void Process(void);
|
||||
|
||||
enum State {
|
||||
QUIESCENT,
|
||||
START_READ,
|
||||
READING,
|
||||
START_WRITE,
|
||||
WRITING,
|
||||
ENDING
|
||||
};
|
||||
|
||||
protected:
|
||||
nsIURI* mURI;
|
||||
nsIEventSinkGetter* mGetter; // XXX it seems wrong keeping this -- used by GetParent
|
||||
nsIStreamListener* mListener;
|
||||
nsIEventQueue* mEventQueue;
|
||||
|
||||
nsFileSpec mSpec;
|
||||
|
||||
nsISupports* mContext;
|
||||
nsFileProtocolHandler* mHandler;
|
||||
State mState;
|
||||
PRBool mSuspended;
|
||||
|
||||
// state variables:
|
||||
nsIBaseStream* mFileStream; // cast to nsIInputStream/nsIOutputStream for reading/Writing
|
||||
nsIBufferInputStream* mBufferInputStream;
|
||||
nsIBufferOutputStream* mBufferOutputStream;
|
||||
nsresult mStatus;
|
||||
PRUint32 mSourceOffset;
|
||||
PRInt32 mAmount;
|
||||
|
||||
private:
|
||||
PRLock* mLock;
|
||||
};
|
||||
|
||||
#define NS_FILE_TRANSPORT_SEGMENT_SIZE (4*1024)
|
||||
#define NS_FILE_TRANSPORT_BUFFER_SIZE (32*1024)
|
||||
|
||||
#endif // nsFileChannel_h__
|
||||
86
mozilla/netwerk/protocol/file/src/nsFileProtocolFactory.cpp
Normal file
86
mozilla/netwerk/protocol/file/src/nsFileProtocolFactory.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/* -*- 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 "nsIGenericFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsFileProtocolHandler.h"
|
||||
#include "nscore.h"
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kFileProtocolHandlerCID, NS_FILEPROTOCOLHANDLER_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aFactory == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIGenericFactory* fact;
|
||||
if (aClass.Equals(kFileProtocolHandlerCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsFileProtocolHandler::Create);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*aFactory = fact;
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kFileProtocolHandlerCID,
|
||||
"File Protocol Handler",
|
||||
NS_NETWORK_PROTOCOL_PROGID_PREFIX "file",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kFileProtocolHandlerCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
236
mozilla/netwerk/protocol/file/src/nsFileProtocolHandler.cpp
Normal file
236
mozilla/netwerk/protocol/file/src/nsFileProtocolHandler.cpp
Normal file
@@ -0,0 +1,236 @@
|
||||
/* -*- 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.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 "nsFileChannel.h"
|
||||
#include "nsFileProtocolHandler.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventSinkGetter.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFileProtocolHandler::nsFileProtocolHandler()
|
||||
: mPool(nsnull), mSuspended(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
#define NS_FILE_TRANSPORT_WORKER_STACK_SIZE (8*1024)
|
||||
|
||||
nsresult
|
||||
nsFileProtocolHandler::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = NS_NewThreadPool(&mPool, NS_FILE_TRANSPORT_WORKER_COUNT,
|
||||
NS_FILE_TRANSPORT_WORKER_COUNT,
|
||||
NS_FILE_TRANSPORT_WORKER_STACK_SIZE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsFileProtocolHandler::~nsFileProtocolHandler()
|
||||
{
|
||||
// this will wait for all outstanding requests to be processed, then
|
||||
// join with the worker threads, and finally free the pool:
|
||||
NS_IF_RELEASE(mPool);
|
||||
NS_IF_RELEASE(mSuspended);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsFileProtocolHandler, nsIProtocolHandler::GetIID());
|
||||
|
||||
NS_METHOD
|
||||
nsFileProtocolHandler::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsFileProtocolHandler* ph = new nsFileProtocolHandler();
|
||||
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
|
||||
nsFileProtocolHandler::GetScheme(char* *result)
|
||||
{
|
||||
*result = nsCRT::strdup("file");
|
||||
if (*result == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::GetDefaultPort(PRInt32 *result)
|
||||
{
|
||||
*result = -1; // no port for file: URLs
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::MakeAbsolute(const char* aSpec,
|
||||
nsIURI* aBaseURI,
|
||||
char* *result)
|
||||
{
|
||||
// XXX optimize this to not needlessly construct the URL
|
||||
|
||||
nsresult rv;
|
||||
nsIURI* url;
|
||||
rv = NewURI(aSpec, aBaseURI, &url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->GetSpec(result);
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// file: URLs (currently) have no additional structure beyond that provided by standard
|
||||
// URLs, so there is no "outer" given to CreateInstance
|
||||
|
||||
nsIURI* url;
|
||||
if (aBaseURI) {
|
||||
rv = aBaseURI->Clone(&url);
|
||||
}
|
||||
else {
|
||||
rv = nsComponentManager::CreateInstance(kStandardURLCID, nsnull,
|
||||
nsIURI::GetIID(),
|
||||
(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
|
||||
nsFileProtocolHandler::NewChannel(const char* verb, nsIURI* url,
|
||||
nsIEventSinkGetter* eventSinkGetter,
|
||||
nsIEventQueue* eventQueue,
|
||||
nsIChannel* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsFileChannel* channel;
|
||||
rv = nsFileChannel::Create(nsnull, nsIFileChannel::GetIID(), (void**)&channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->Init(this, verb, url, eventSinkGetter, eventQueue);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(channel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = channel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::NewChannelFromNativePath(const char* nativePath,
|
||||
nsIFileChannel* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsFileSpec spec(nativePath);
|
||||
nsFileURL fileURL(spec);
|
||||
const char* urlStr = fileURL.GetURLString();
|
||||
nsIURI* uri;
|
||||
|
||||
rv = NewURI(urlStr, nsnull, &uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NewChannel("load", // XXX what should this be?
|
||||
uri,
|
||||
nsnull, // XXX bogus getter
|
||||
nsnull, // XXX bogus
|
||||
(nsIChannel**)result);
|
||||
NS_RELEASE(uri);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsFileProtocolHandler::ProcessPendingRequests(void)
|
||||
{
|
||||
return mPool->ProcessPendingRequests();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileProtocolHandler::DispatchRequest(nsIRunnable* runnable)
|
||||
{
|
||||
return mPool->DispatchRequest(runnable);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsFileProtocolHandler::Suspend(nsFileChannel* request)
|
||||
{
|
||||
nsresult rv;
|
||||
if (mSuspended == nsnull) {
|
||||
rv = NS_NewISupportsArray(&mSuspended);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mSuspended->AppendElement(NS_STATIC_CAST(nsIChannel*, request));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileProtocolHandler::Resume(nsFileChannel* request)
|
||||
{
|
||||
nsresult rv;
|
||||
if (mSuspended == nsnull)
|
||||
return NS_ERROR_FAILURE;
|
||||
// XXX RemoveElement returns a bool instead of nsresult!
|
||||
PRBool removed = mSuspended->RemoveElement(NS_STATIC_CAST(nsIChannel*, request));
|
||||
rv = removed ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// restart the request
|
||||
rv = mPool->DispatchRequest(NS_STATIC_CAST(nsIRunnable*, request));
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
79
mozilla/netwerk/protocol/file/src/nsFileProtocolHandler.h
Normal file
79
mozilla/netwerk/protocol/file/src/nsFileProtocolHandler.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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.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 nsFileProtocolHandler_h___
|
||||
#define nsFileProtocolHandler_h___
|
||||
|
||||
#include "nsIFileProtocolHandler.h"
|
||||
|
||||
class nsISupportsArray;
|
||||
class nsIRunnable;
|
||||
class nsFileChannel;
|
||||
class nsIThreadPool;
|
||||
|
||||
#define NS_FILE_TRANSPORT_WORKER_COUNT 4
|
||||
|
||||
// {25029490-F132-11d2-9588-00805F369F95}
|
||||
#define NS_FILEPROTOCOLHANDLER_CID \
|
||||
{ /* fbc81170-1f69-11d3-9344-00104ba0fd40 */ \
|
||||
0xfbc81170, \
|
||||
0x1f69, \
|
||||
0x11d3, \
|
||||
{0x93, 0x44, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsFileProtocolHandler : public nsIFileProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIProtocolHandler methods:
|
||||
NS_IMETHOD GetScheme(char * *aScheme);
|
||||
NS_IMETHOD GetDefaultPort(PRInt32 *aDefaultPort);
|
||||
NS_IMETHOD MakeAbsolute(const char *aRelativeSpec, nsIURI *aBaseURI,
|
||||
char **_retval);
|
||||
NS_IMETHOD NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **_retval);
|
||||
NS_IMETHOD NewChannel(const char* verb, nsIURI* url,
|
||||
nsIEventSinkGetter *eventSinkGetter,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIChannel **_retval);
|
||||
|
||||
// nsIFileProtocolHandler methods:
|
||||
NS_IMETHOD NewChannelFromNativePath(const char* nativePath,
|
||||
nsIFileChannel* *result);
|
||||
|
||||
// nsFileProtocolHandler methods:
|
||||
nsFileProtocolHandler();
|
||||
virtual ~nsFileProtocolHandler();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
nsresult DispatchRequest(nsIRunnable* runnable);
|
||||
nsresult Suspend(nsFileChannel* request);
|
||||
nsresult Resume(nsFileChannel* request);
|
||||
nsresult ProcessPendingRequests(void);
|
||||
|
||||
protected:
|
||||
nsIThreadPool* mPool;
|
||||
nsISupportsArray* mSuspended;
|
||||
};
|
||||
|
||||
#endif /* nsFileProtocolHandler_h___ */
|
||||
33
mozilla/netwerk/protocol/ftp/Makefile.in
Normal file
33
mozilla/netwerk/protocol/ftp/Makefile.in
Normal file
@@ -0,0 +1,33 @@
|
||||
#! gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
27
mozilla/netwerk/protocol/ftp/makefile.win
Normal file
27
mozilla/netwerk/protocol/ftp/makefile.win
Normal file
@@ -0,0 +1,27 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
44
mozilla/netwerk/protocol/ftp/public/Makefile.in
Normal file
44
mozilla/netwerk/protocol/ftp/public/Makefile.in
Normal file
@@ -0,0 +1,44 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
XPIDL_MODULE = netwerk_ftp
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIFTPChannel.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
ftpCore.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
45
mozilla/netwerk/protocol/ftp/public/ftpCore.h
Normal file
45
mozilla/netwerk/protocol/ftp/public/ftpCore.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* -*- 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.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 __ftpCore_h___
|
||||
#define __ftpCore_h___
|
||||
|
||||
#include "nsError.h"
|
||||
|
||||
//////////////////////////////
|
||||
//// FTP CODES RANGE: 20-30
|
||||
//////////////////////////////
|
||||
#define NS_ERROR_FTP_LOGIN \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 21)
|
||||
|
||||
#define NS_ERROR_FTP_MODE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 22)
|
||||
|
||||
#define NS_ERROR_FTP_CWD \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 23)
|
||||
|
||||
#define NS_ERROR_FTP_PASV \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 24)
|
||||
|
||||
#define NS_ERROR_FTP_DEL_DIR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 25)
|
||||
|
||||
#define NS_ERROR_FTP_MKDIR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 26)
|
||||
|
||||
#endif // __ftpCore_h___
|
||||
39
mozilla/netwerk/protocol/ftp/public/makefile.win
Normal file
39
mozilla/netwerk/protocol/ftp/public/makefile.win
Normal file
@@ -0,0 +1,39 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..\..
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
XPIDL_MODULE = netwerk_ftp
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIFTPChannel.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
ftpCore.h \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
||||
38
mozilla/netwerk/protocol/ftp/public/nsIFTPChannel.idl
Normal file
38
mozilla/netwerk/protocol/ftp/public/nsIFTPChannel.idl
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*- 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.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 "nsIChannel.idl"
|
||||
|
||||
interface nsIStreamListener;
|
||||
|
||||
[scriptable, uuid(64718e40-18c2-11d3-9337-00104ba0fd40)]
|
||||
interface nsIFTPChannel : nsIChannel
|
||||
{
|
||||
// PRE connect
|
||||
|
||||
// POST connect
|
||||
|
||||
// Initiate connect
|
||||
void Get();
|
||||
|
||||
void Put();
|
||||
|
||||
void SetStreamListener(in nsIStreamListener aListener);
|
||||
};
|
||||
|
||||
|
||||
47
mozilla/netwerk/protocol/ftp/src/Makefile.in
Normal file
47
mozilla/netwerk/protocol/ftp/src/Makefile.in
Normal file
@@ -0,0 +1,47 @@
|
||||
# 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.
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
LIBRARY_NAME = ftpprotocol
|
||||
|
||||
IS_COMPONENT = 1
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
CPPSRCS = \
|
||||
nsFtpProtocolHandler.cpp \
|
||||
nsFTPChannel.cpp \
|
||||
nsFtpStreamListenerEvent.cpp \
|
||||
nsFtpConnectionThread.cpp \
|
||||
nsFtpFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# hack until necko lands
|
||||
ifndef NECKO
|
||||
PUBLIC = $(DEPTH)/netwerk/dist/include
|
||||
endif
|
||||
|
||||
TARGET = $(LIBARY)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
54
mozilla/netwerk/protocol/ftp/src/makefile.win
Normal file
54
mozilla/netwerk/protocol/ftp/src/makefile.win
Normal file
@@ -0,0 +1,54 @@
|
||||
# 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.
|
||||
|
||||
MODULE = netwerk
|
||||
|
||||
DEPTH = ..\..\..\..
|
||||
|
||||
// temporary, until we land:
|
||||
!ifndef NECKO
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
PUBLIC = $(DEPTH)\netwerk\dist\include
|
||||
!endif
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=ftpprotocol
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
LCFLAGS = -DWIN32_LEAN_AND_MEAN -D_IMPL_NS_NET
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsFtpProtocolHandler.obj \
|
||||
.\$(OBJDIR)\nsFTPChannel.obj \
|
||||
.\$(OBJDIR)\nsFtpStreamListenerEvent.obj \
|
||||
.\$(OBJDIR)\nsFtpConnectionThread.obj \
|
||||
.\$(OBJDIR)\nsFtpFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\netwerk.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\plc3.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
INCS = $(INCS) \
|
||||
-I$(DEPTH)\dist\include \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
|
||||
295
mozilla/netwerk/protocol/ftp/src/nsFTPChannel.cpp
Normal file
295
mozilla/netwerk/protocol/ftp/src/nsFTPChannel.cpp
Normal file
@@ -0,0 +1,295 @@
|
||||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
// ftp implementation
|
||||
|
||||
#include "nsFTPChannel.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsFtpConnectionThread.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIEventSinkGetter.h"
|
||||
|
||||
#include "prprf.h" // PR_sscanf
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
// There are actually two transport connections established for an
|
||||
// ftp connection. One is used for the command channel , and
|
||||
// the other for the data channel. The command channel is the first
|
||||
// connection made and is used to negotiate the second, data, channel.
|
||||
// The data channel is driven by the command channel and is either
|
||||
// initiated by the server (PORT command) or by the client (PASV command).
|
||||
// Client initiation is the most command case and is attempted first.
|
||||
|
||||
nsFTPChannel::nsFTPChannel()
|
||||
: mUrl(nsnull), mConnected(PR_FALSE), mListener(nsnull) {
|
||||
|
||||
nsresult rv;
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueService, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = eventQService->GetThreadEventQueue(PR_CurrentThread(), &mEventQueue);
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
mEventQueue = nsnull;
|
||||
}
|
||||
|
||||
nsFTPChannel::~nsFTPChannel() {
|
||||
NS_IF_RELEASE(mUrl);
|
||||
NS_IF_RELEASE(mListener);
|
||||
NS_IF_RELEASE(mEventQueue);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsFTPChannel);
|
||||
NS_IMPL_RELEASE(nsFTPChannel);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::QueryInterface(const nsIID& aIID, void** aInstancePtr) {
|
||||
NS_ASSERTION(aInstancePtr, "no instance pointer");
|
||||
if (aIID.Equals(nsIFTPChannel::GetIID()) ||
|
||||
aIID.Equals(nsIChannel::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID) ) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIFTPChannel*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsIStreamListener::GetIID()) ||
|
||||
aIID.Equals(nsIStreamObserver::GetIID())) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIStreamListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFTPChannel::Init(const char* verb, nsIURI* uri, nsIEventSinkGetter* getter,
|
||||
nsIEventQueue* queue)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (mConnected)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mUrl = uri;
|
||||
NS_ADDREF(mUrl);
|
||||
|
||||
mEventQueue = queue;
|
||||
NS_ADDREF(mEventQueue);
|
||||
|
||||
nsIProgressEventSink* eventSink;
|
||||
rv = getter->GetEventSink(verb, nsIProgressEventSink::GetIID(),
|
||||
(nsISupports**)&eventSink);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mEventSink = eventSink;
|
||||
NS_ADDREF(mEventSink);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsFTPChannel::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
|
||||
{
|
||||
nsFTPChannel* fc = new nsFTPChannel();
|
||||
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
|
||||
nsFTPChannel::Cancel(void)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::Suspend(void)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::Resume(void)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIChannel methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::GetURI(nsIURI * *aURL)
|
||||
{
|
||||
NS_ADDREF(mUrl);
|
||||
*aURL = mUrl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OpenInputStream(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsIInputStream **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OpenOutputStream(PRUint32 startPosition, nsIOutputStream **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamListener *listener)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::AsyncWrite(nsIInputStream *fromStream,
|
||||
PRUint32 startPosition,
|
||||
PRInt32 writeCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamObserver *observer)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::GetContentType(char* *contentType) {
|
||||
|
||||
// XXX for ftp we need to do a file extension-to-type mapping lookup
|
||||
// XXX in some hash table/registry of mime-types
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIFTPChannel methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::Get(void) {
|
||||
nsresult rv;
|
||||
nsIThread* workerThread = nsnull;
|
||||
nsFtpConnectionThread* protocolInterpreter =
|
||||
new nsFtpConnectionThread(mEventQueue, this);
|
||||
NS_ASSERTION(protocolInterpreter, "ftp protocol interpreter alloc failed");
|
||||
NS_ADDREF(protocolInterpreter);
|
||||
|
||||
if (!protocolInterpreter)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
protocolInterpreter->Init(workerThread, mUrl);
|
||||
protocolInterpreter->SetUsePasv(PR_TRUE);
|
||||
|
||||
rv = NS_NewThread(&workerThread, protocolInterpreter);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "new thread failed");
|
||||
|
||||
// XXX this release should probably be in the destructor.
|
||||
NS_RELEASE(protocolInterpreter);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::Put(void) {
|
||||
nsresult rv;
|
||||
nsIThread* workerThread = nsnull;
|
||||
nsFtpConnectionThread* protocolInterpreter =
|
||||
new nsFtpConnectionThread(mEventQueue, this);
|
||||
NS_ASSERTION(protocolInterpreter, "ftp protocol interpreter alloc failed");
|
||||
NS_ADDREF(protocolInterpreter);
|
||||
|
||||
if (!protocolInterpreter)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
protocolInterpreter->Init(workerThread, mUrl);
|
||||
protocolInterpreter->SetAction(PUT);
|
||||
protocolInterpreter->SetUsePasv(PR_TRUE);
|
||||
|
||||
rv = NS_NewThread(&workerThread, protocolInterpreter);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "new thread failed");
|
||||
|
||||
// XXX this release should probably be in the destructor.
|
||||
NS_RELEASE(protocolInterpreter);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::SetStreamListener(nsIStreamListener *aListener) {
|
||||
mListener = aListener;
|
||||
NS_ADDREF(mListener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamObserver methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnStartBinding(nsISupports* context) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg) {
|
||||
// Release the lock so the user get's the data stream
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnStartRequest(nsISupports* context) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnStopRequest(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg) {
|
||||
// Release the lock so the user get's the data stream
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamListener methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnDataAvailable(nsISupports* context,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength) {
|
||||
// Fill in the buffer w/ the new data.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
102
mozilla/netwerk/protocol/ftp/src/nsFTPChannel.h
Normal file
102
mozilla/netwerk/protocol/ftp/src/nsFTPChannel.h
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.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.
|
||||
*/
|
||||
|
||||
// ftp implementation header
|
||||
|
||||
#ifndef nsFTPChannel_h___
|
||||
#define nsFTPChannel_h___
|
||||
|
||||
#include "nsIFTPChannel.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsString2.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
class nsIEventSinkGetter;
|
||||
class nsIProgressEventSink;
|
||||
|
||||
class nsFTPChannel : public nsIFTPChannel,
|
||||
public nsIStreamListener {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRequest methods:
|
||||
NS_IMETHOD Cancel();
|
||||
NS_IMETHOD Suspend();
|
||||
NS_IMETHOD Resume();
|
||||
|
||||
// nsIChannel methods:
|
||||
NS_IMETHOD GetURI(nsIURI * *aURL);
|
||||
NS_IMETHOD OpenInputStream(PRUint32 startPosition, PRInt32 readCount, nsIInputStream **_retval);
|
||||
NS_IMETHOD OpenOutputStream(PRUint32 startPosition, nsIOutputStream **_retval);
|
||||
NS_IMETHOD AsyncRead(PRUint32 startPosition, PRInt32 readCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamListener *listener);
|
||||
NS_IMETHOD AsyncWrite(nsIInputStream *fromStream,
|
||||
PRUint32 startPosition,
|
||||
PRInt32 writeCount,
|
||||
nsISupports *ctxt,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIStreamObserver *observer);
|
||||
|
||||
// nsIFTPChannel methods:
|
||||
NS_IMETHOD Get(void);
|
||||
NS_IMETHOD Put(void);
|
||||
NS_IMETHOD SetStreamListener(nsIStreamListener* aListener);
|
||||
|
||||
// nsIStreamObserver methods:
|
||||
NS_IMETHOD OnStartBinding(nsISupports* context);
|
||||
NS_IMETHOD OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg);
|
||||
NS_IMETHOD OnStartRequest(nsISupports *ctxt);
|
||||
NS_IMETHOD OnStopRequest(nsISupports *ctxt,
|
||||
nsresult status,
|
||||
const PRUnichar *errorMsg);
|
||||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnDataAvailable(nsISupports* context,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
// nsFTPChannel methods:
|
||||
nsFTPChannel();
|
||||
virtual ~nsFTPChannel();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
|
||||
nsresult Init(const char* verb, nsIURI* uri, nsIEventSinkGetter* getter,
|
||||
nsIEventQueue* queue);
|
||||
|
||||
NS_IMETHOD GetContentType(char* *contentType);
|
||||
|
||||
protected:
|
||||
nsIURI* mUrl;
|
||||
nsIEventQueue* mEventQueue;
|
||||
nsIProgressEventSink* mEventSink;
|
||||
|
||||
PRBool mConnected;
|
||||
nsIStreamListener* mListener;
|
||||
};
|
||||
|
||||
#endif /* nsFTPChannel_h___ */
|
||||
1552
mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
Normal file
1552
mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
Normal file
File diff suppressed because it is too large
Load Diff
182
mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.h
Normal file
182
mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.h
Normal file
@@ -0,0 +1,182 @@
|
||||
/* -*- 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.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 "nsIThread.h"
|
||||
#include "nsISocketTransportService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIURI.h"
|
||||
#include "prlock.h"
|
||||
|
||||
#include "nsString2.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
#include "time.h" // XXX should probably be using PRTime stuff
|
||||
|
||||
|
||||
// ftp server types
|
||||
#define FTP_GENERIC_TYPE 0
|
||||
#define FTP_UNIX_TYPE 1
|
||||
#define FTP_DCTS_TYPE 2
|
||||
#define FTP_NCSA_TYPE 3
|
||||
#define FTP_PETER_LEWIS_TYPE 4
|
||||
#define FTP_MACHTEN_TYPE 5
|
||||
#define FTP_CMS_TYPE 6
|
||||
#define FTP_TCPC_TYPE 7
|
||||
#define FTP_VMS_TYPE 8
|
||||
#define FTP_NT_TYPE 9
|
||||
#define FTP_WEBSTAR_TYPE 10
|
||||
|
||||
// ftp states
|
||||
typedef enum _FTP_STATE {
|
||||
///////////////////////
|
||||
//// Internal states
|
||||
///////////////////////
|
||||
FTP_READ_BUF,
|
||||
FTP_ERROR,
|
||||
FTP_COMPLETE,
|
||||
|
||||
///////////////////////
|
||||
//// Command channel connection setup states
|
||||
///////////////////////
|
||||
FTP_S_USER, // send username
|
||||
FTP_R_USER,
|
||||
FTP_S_PASS, // send password
|
||||
FTP_R_PASS,
|
||||
FTP_S_SYST, // send system (interrogates server)
|
||||
FTP_R_SYST,
|
||||
FTP_S_ACCT, // send account
|
||||
FTP_R_ACCT,
|
||||
FTP_S_MACB,
|
||||
FTP_R_MACB,
|
||||
FTP_S_PWD , // send parent working directory (pwd)
|
||||
FTP_R_PWD ,
|
||||
FTP_S_DEL_FILE, // send delete file
|
||||
FTP_R_DEL_FILE,
|
||||
FTP_S_DEL_DIR , // send delete directory
|
||||
FTP_R_DEL_DIR ,
|
||||
FTP_S_MKDIR, // send mkdir
|
||||
FTP_R_MKDIR,
|
||||
FTP_S_MODE, // send ASCII or BINARY
|
||||
FTP_R_MODE,
|
||||
FTP_S_CWD, // send change working directory
|
||||
FTP_R_CWD,
|
||||
FTP_S_SIZE, // send size
|
||||
FTP_R_SIZE,
|
||||
FTP_S_PUT, // send STOR to upload the file
|
||||
FTP_R_PUT,
|
||||
FTP_S_RETR, // send retrieve to download the file
|
||||
FTP_R_RETR,
|
||||
FTP_S_MDTM, // send MDTM to get time information
|
||||
FTP_R_MDTM,
|
||||
FTP_S_LIST, // send LIST or NLST (server dependent) to get a dir listing
|
||||
FTP_R_LIST,
|
||||
|
||||
///////////////////////
|
||||
//// Data channel connection setup states
|
||||
///////////////////////
|
||||
FTP_S_PASV, // send passsive
|
||||
FTP_R_PASV,
|
||||
// FTP_S_PORT, // send port
|
||||
// FTP_R_PORT
|
||||
|
||||
} FTP_STATE;
|
||||
|
||||
// higher level ftp actions
|
||||
typedef enum _FTP_ACTION {
|
||||
GET,
|
||||
PUT,
|
||||
MKDIR,
|
||||
DEL
|
||||
} FTP_ACTION;
|
||||
|
||||
class nsFtpConnectionThread : public nsIRunnable {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsFtpConnectionThread(nsIEventQueue* aEventQ, nsIStreamListener *aListener);
|
||||
virtual ~nsFtpConnectionThread();
|
||||
|
||||
// nsIRunnable method
|
||||
NS_IMETHOD Run();
|
||||
#if 0
|
||||
// nsICancelable methods:
|
||||
NS_IMETHOD Cancel(void);
|
||||
NS_IMETHOD Suspend(void);
|
||||
NS_IMETHOD Resume(void);
|
||||
#endif
|
||||
nsresult Init(nsIThread* aThread,
|
||||
nsIURI* aUrl);
|
||||
|
||||
// user level setup
|
||||
nsresult SetAction(FTP_ACTION aAction);
|
||||
nsresult SetUsePasv(PRBool aUsePasv);
|
||||
|
||||
private:
|
||||
nsresult Read(void);
|
||||
void SetSystInternals(void);
|
||||
FTP_STATE FindActionState(void);
|
||||
FTP_STATE FindGetState(void);
|
||||
nsresult MapResultCodeToString(nsresult aResultCode, PRUnichar* *aOutMsg);
|
||||
|
||||
// Private members
|
||||
|
||||
nsIEventQueue* mEventQueue; // used to communicate outside this thread
|
||||
nsIURI* mUrl;
|
||||
|
||||
FTP_STATE mState; // the current state
|
||||
FTP_STATE mNextState; // the next state
|
||||
FTP_ACTION mAction; // the higher level action
|
||||
|
||||
nsIInputStream* mCInStream; // command channel input
|
||||
nsIOutputStream* mCOutStream; // command channel output
|
||||
|
||||
//nsString2 mDataAddress; // the host:port combo for the data connection
|
||||
nsIInputStream* mDInStream; // data channel input
|
||||
nsIOutputStream* mDOutStream; // data channel output
|
||||
|
||||
PRInt32 mResponseCode; // the last command response code.
|
||||
nsString2 mResponseMsg; // the last command response text
|
||||
nsString2 mUsername;
|
||||
nsString2 mPassword;
|
||||
nsString2 mFilename; // url filename (if any)
|
||||
PRInt32 mLength; // length of the file
|
||||
time_t mLastModified; // last modified time for file
|
||||
|
||||
// these members should be hung off of a specific transport connection
|
||||
PRInt32 mServerType;
|
||||
PRBool mPasv;
|
||||
PRBool mList; // use LIST instead of NLST
|
||||
// end "these ...."
|
||||
|
||||
PRBool mConnected;
|
||||
PRBool mUseDefaultPath; // use PWD to figure out path
|
||||
PRBool mUsePasv; // use a passive data connection.
|
||||
PRBool mAscii; // transfer mode (ascii or binary)
|
||||
PRBool mDirectory; // this url is a directory
|
||||
|
||||
nsIStreamListener* mListener; // the listener we want to call
|
||||
// during our event firing.
|
||||
|
||||
PRLock *mLock;
|
||||
PRThread *mThread;
|
||||
};
|
||||
|
||||
#define NS_FTP_THREAD_SEGMENT_SIZE (4*1024)
|
||||
#define NS_FTP_THREAD_BUFFER_SIZE (16*1024)
|
||||
86
mozilla/netwerk/protocol/ftp/src/nsFtpFactory.cpp
Normal file
86
mozilla/netwerk/protocol/ftp/src/nsFtpFactory.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/* -*- 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 "nsIGenericFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsFtpProtocolHandler.h"
|
||||
#include "nscore.h"
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kFtpProtocolHandlerCID, NS_FTPPROTOCOLHANDLER_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aFactory == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIGenericFactory* fact;
|
||||
if (aClass.Equals(kFtpProtocolHandlerCID)) {
|
||||
rv = NS_NewGenericFactory(&fact, nsFtpProtocolHandler::Create);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*aFactory = fact;
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kFtpProtocolHandlerCID,
|
||||
"FTP Protocol Handler",
|
||||
NS_NETWORK_PROTOCOL_PROGID_PREFIX "ftp",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE1(nsIComponentManager, compMgr, aServMgr, kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = compMgr->UnregisterComponent(kFtpProtocolHandlerCID, aPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
149
mozilla/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp
Normal file
149
mozilla/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp
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.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 "nsFTPChannel.h"
|
||||
#include "nsFtpProtocolHandler.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventSinkGetter.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
||||
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFtpProtocolHandler::nsFtpProtocolHandler() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsFtpProtocolHandler::~nsFtpProtocolHandler() {
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsFtpProtocolHandler, nsIProtocolHandler::GetIID());
|
||||
|
||||
NS_METHOD
|
||||
nsFtpProtocolHandler::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult)
|
||||
{
|
||||
nsFtpProtocolHandler* ph = new nsFtpProtocolHandler();
|
||||
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
|
||||
nsFtpProtocolHandler::GetScheme(char* *result)
|
||||
{
|
||||
*result = nsCRT::strdup("ftp");
|
||||
if (*result == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::GetDefaultPort(PRInt32 *result)
|
||||
{
|
||||
*result = 21;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::MakeAbsolute(const char* aSpec,
|
||||
nsIURI* aBaseURI,
|
||||
char* *result)
|
||||
{
|
||||
// XXX optimize this to not needlessly construct the URL
|
||||
|
||||
nsresult rv;
|
||||
nsIURI* url;
|
||||
rv = NewURI(aSpec, aBaseURI, &url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->GetSpec(result);
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Ftp URLs (currently) have no additional structure beyond that provided by standard
|
||||
// URLs, so there is no "outer" given to CreateInstance
|
||||
|
||||
nsIURI* url;
|
||||
if (aBaseURI) {
|
||||
rv = aBaseURI->Clone(&url);
|
||||
}
|
||||
else {
|
||||
rv = nsComponentManager::CreateInstance(kStandardURLCID, nsnull,
|
||||
nsIURI::GetIID(),
|
||||
(void**)&url);
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = url->SetSpec((char*)aSpec);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// XXX this is the default port for ftp. we need to strip out the actual
|
||||
// XXX requested port.
|
||||
rv = url->SetPort(21);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::NewChannel(const char* verb, nsIURI* url,
|
||||
nsIEventSinkGetter* eventSinkGetter,
|
||||
nsIEventQueue* eventQueue,
|
||||
nsIChannel* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsFTPChannel* channel;
|
||||
rv = nsFTPChannel::Create(nsnull, nsIFTPChannel::GetIID(), (void**)&channel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = channel->Init(verb, url, eventSinkGetter, eventQueue);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(channel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = channel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
57
mozilla/netwerk/protocol/ftp/src/nsFtpProtocolHandler.h
Normal file
57
mozilla/netwerk/protocol/ftp/src/nsFtpProtocolHandler.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- 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.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 nsFtpProtocolHandler_h___
|
||||
#define nsFtpProtocolHandler_h___
|
||||
|
||||
#include "nsIProtocolHandler.h"
|
||||
|
||||
// {25029490-F132-11d2-9588-00805F369F95}
|
||||
#define NS_FTPPROTOCOLHANDLER_CID \
|
||||
{ 0x25029490, 0xf132, 0x11d2, { 0x95, 0x88, 0x0, 0x80, 0x5f, 0x36, 0x9f, 0x95 } }
|
||||
|
||||
class nsFtpProtocolHandler : public nsIProtocolHandler
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIProtocolHandler methods:
|
||||
NS_IMETHOD GetScheme(char * *aScheme);
|
||||
NS_IMETHOD GetDefaultPort(PRInt32 *aDefaultPort);
|
||||
NS_IMETHOD MakeAbsolute(const char *aRelativeSpec, nsIURI *aBaseURI,
|
||||
char **_retval);
|
||||
NS_IMETHOD NewURI(const char *aSpec, nsIURI *aBaseURI,
|
||||
nsIURI **_retval);
|
||||
NS_IMETHOD NewChannel(const char* verb, nsIURI* url,
|
||||
nsIEventSinkGetter *eventSinkGetter,
|
||||
nsIEventQueue *eventQueue,
|
||||
nsIChannel **_retval);
|
||||
|
||||
// nsFtpProtocolHandler methods:
|
||||
nsFtpProtocolHandler();
|
||||
virtual ~nsFtpProtocolHandler();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
|
||||
|
||||
protected:
|
||||
nsISupports* mEventSinkGetter;
|
||||
};
|
||||
|
||||
#endif /* nsFtpProtocolHandler_h___ */
|
||||
212
mozilla/netwerk/protocol/ftp/src/nsFtpStreamListenerEvent.cpp
Normal file
212
mozilla/netwerk/protocol/ftp/src/nsFtpStreamListenerEvent.cpp
Normal file
@@ -0,0 +1,212 @@
|
||||
/* -*- 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.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 "nsFtpStreamListenerEvent.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
||||
nsFtpStreamListenerEvent::nsFtpStreamListenerEvent(nsIStreamListener* listener,
|
||||
nsISupports* context)
|
||||
: mListener(listener), mContext(context)
|
||||
{
|
||||
NS_IF_ADDREF(mListener);
|
||||
NS_IF_ADDREF(mContext);
|
||||
}
|
||||
|
||||
nsFtpStreamListenerEvent::~nsFtpStreamListenerEvent()
|
||||
{
|
||||
NS_IF_RELEASE(mListener);
|
||||
NS_IF_RELEASE(mContext);
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsFtpStreamListenerEvent::HandlePLEvent(PLEvent* aEvent)
|
||||
{
|
||||
// WARNING: This is a dangerous cast since it must adjust the pointer
|
||||
// to compensate for the vtable...
|
||||
nsFtpStreamListenerEvent *ev = (nsFtpStreamListenerEvent*)aEvent;
|
||||
|
||||
nsresult rv = ev->HandleEvent();
|
||||
//ev->mListener->SetStatus(rv);
|
||||
}
|
||||
|
||||
void PR_CALLBACK nsFtpStreamListenerEvent::DestroyPLEvent(PLEvent* aEvent)
|
||||
{
|
||||
// WARNING: This is a dangerous cast since it must adjust the pointer
|
||||
// to compensate for the vtable...
|
||||
nsFtpStreamListenerEvent *ev = (nsFtpStreamListenerEvent*)aEvent;
|
||||
|
||||
delete ev;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFtpStreamListenerEvent::Fire(nsIEventQueue* aEventQueue)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aEventQueue, "nsIEventQueue for thread is null");
|
||||
|
||||
PL_InitEvent(this, nsnull,
|
||||
(PLHandleEventProc) nsFtpStreamListenerEvent::HandlePLEvent,
|
||||
(PLDestroyEventProc) nsFtpStreamListenerEvent::DestroyPLEvent);
|
||||
|
||||
PRStatus status = aEventQueue->PostEvent(this);
|
||||
return status == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnStartBinding...
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpOnStartBindingEvent::HandleEvent()
|
||||
{
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener;
|
||||
return receiver->OnStartBinding(mContext);
|
||||
}
|
||||
/*
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamObserver::OnStartBinding(nsISupports* context)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStartBindingEvent* event =
|
||||
new nsOnStartBindingEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnDataAvailable
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFtpOnDataAvailableEvent::~nsFtpOnDataAvailableEvent()
|
||||
{
|
||||
NS_RELEASE(mIStream);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFtpOnDataAvailableEvent::Init(nsIBufferInputStream* aIStream,
|
||||
PRUint32 aSourceOffset, PRUint32 aLength)
|
||||
{
|
||||
mLength = aLength;
|
||||
mSourceOffset = aSourceOffset;
|
||||
mIStream = aIStream;
|
||||
NS_ADDREF(mIStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpOnDataAvailableEvent::HandleEvent()
|
||||
{
|
||||
nsIStreamListener* receiver = (nsIStreamListener*)mListener;
|
||||
return receiver->OnDataAvailable(mContext, mIStream, mSourceOffset, mLength);
|
||||
}
|
||||
/*
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamListener::OnDataAvailable(nsISupports* context,
|
||||
nsIBufferInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnDataAvailableEvent* event =
|
||||
new nsOnDataAvailableEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aIStream, aSourceOffset, aLength);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnStopBinding
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFtpOnStopBindingEvent::~nsFtpOnStopBindingEvent()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFtpOnStopBindingEvent::Init(nsresult status, PRUnichar* aMsg)
|
||||
{
|
||||
mStatus = status;
|
||||
mMessage = aMsg;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpOnStopBindingEvent::HandleEvent()
|
||||
{
|
||||
nsIStreamObserver* receiver = (nsIStreamObserver*)mListener;
|
||||
return receiver->OnStopBinding(mContext, mStatus, mMessage);
|
||||
}
|
||||
/*
|
||||
NS_IMETHODIMP
|
||||
nsMarshalingStreamObserver::OnStopBinding(nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
nsresult rv = GetStatus();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsOnStopBindingEvent* event =
|
||||
new nsOnStopBindingEvent(this, context);
|
||||
if (event == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = event->Init(aStatus, aMsg);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
rv = event->Fire(mEventQueue);
|
||||
if (NS_FAILED(rv)) goto failed;
|
||||
return rv;
|
||||
|
||||
failed:
|
||||
delete event;
|
||||
return rv;
|
||||
}
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
90
mozilla/netwerk/protocol/ftp/src/nsFtpStreamListenerEvent.h
Normal file
90
mozilla/netwerk/protocol/ftp/src/nsFtpStreamListenerEvent.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/* -*- 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.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 ___nsftpstreamlistener_h__
|
||||
#define ___nsftpstreamlistener_h__
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
||||
class nsFtpStreamListenerEvent : public PLEvent {
|
||||
public:
|
||||
nsFtpStreamListenerEvent(nsIStreamListener* listener, nsISupports* context);
|
||||
virtual ~nsFtpStreamListenerEvent();
|
||||
|
||||
nsresult Fire(nsIEventQueue* aEventQ);
|
||||
|
||||
NS_IMETHOD HandleEvent() = 0;
|
||||
|
||||
protected:
|
||||
static void PR_CALLBACK HandlePLEvent(PLEvent* aEvent);
|
||||
static void PR_CALLBACK DestroyPLEvent(PLEvent* aEvent);
|
||||
|
||||
nsIStreamListener* mListener;
|
||||
nsISupports* mContext;
|
||||
};
|
||||
|
||||
class nsFtpOnStartBindingEvent : public nsFtpStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsFtpOnStartBindingEvent(nsIStreamListener* listener, nsISupports* context)
|
||||
: nsFtpStreamListenerEvent(listener, context) {}
|
||||
virtual ~nsFtpOnStartBindingEvent() {}
|
||||
|
||||
NS_IMETHOD HandleEvent();
|
||||
};
|
||||
|
||||
|
||||
class nsFtpOnDataAvailableEvent : public nsFtpStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsFtpOnDataAvailableEvent(nsIStreamListener* listener, nsISupports* context)
|
||||
: nsFtpStreamListenerEvent(listener, context),
|
||||
mIStream(nsnull), mLength(0) {}
|
||||
virtual ~nsFtpOnDataAvailableEvent();
|
||||
|
||||
nsresult Init(nsIBufferInputStream* aIStream, PRUint32 aSourceOffset, PRUint32 aLength);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsIBufferInputStream* mIStream;
|
||||
PRUint32 mSourceOffset;
|
||||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
|
||||
class nsFtpOnStopBindingEvent : public nsFtpStreamListenerEvent
|
||||
{
|
||||
public:
|
||||
nsFtpOnStopBindingEvent(nsIStreamListener* listener, nsISupports* context)
|
||||
: nsFtpStreamListenerEvent(listener, context),
|
||||
mStatus(NS_OK), mMessage(nsnull) {}
|
||||
virtual ~nsFtpOnStopBindingEvent();
|
||||
|
||||
nsresult Init(nsresult status, PRUnichar* aMsg);
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
protected:
|
||||
nsresult mStatus;
|
||||
PRUnichar* mMessage;
|
||||
};
|
||||
|
||||
#endif // ___nsftpstreamlistener_h__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user