httpclient 2.3.0.1 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +19 -0
- data/lib/httpclient/cacert.p7s +148 -94
- data/lib/httpclient/cookie.rb +89 -224
- data/lib/httpclient/http.rb +2 -2
- data/lib/httpclient/session.rb +4 -3
- data/lib/httpclient/ssl_config.rb +4 -72
- data/lib/httpclient/timeout.rb +2 -2
- data/lib/httpclient/util.rb +17 -0
- data/lib/httpclient/version.rb +1 -1
- data/test/test_cookie.rb +0 -14
- data/test/test_httpclient.rb +24 -0
- metadata +4 -5
- data/lib/httpclient/cacert_sha1.p7s +0 -1858
data/README.txt
CHANGED
@@ -107,6 +107,25 @@ Thanks in advance.
|
|
107
107
|
|
108
108
|
== Changes
|
109
109
|
|
110
|
+
= Changes in 2.3.1 =
|
111
|
+
|
112
|
+
January 1, 2013 - version 2.3.1
|
113
|
+
|
114
|
+
* Changes
|
115
|
+
|
116
|
+
* #137 Signing key is expiring for cacert_sha1.p7s.
|
117
|
+
Deleted p7s signature check for default cacerts. Sorry for many troubles
|
118
|
+
in the past. This feature is not useful without having online/real-time
|
119
|
+
CA certs update but I don't think I can implement it in near future.
|
120
|
+
Users depend on this signature check (who puts cacert.p7s in R/W
|
121
|
+
filesystem and ssl_config.rb in R/O filesystem) should take care the
|
122
|
+
tampering by themself.
|
123
|
+
|
124
|
+
* Bug fixes
|
125
|
+
|
126
|
+
* #122 Support IPv6 address in URI
|
127
|
+
|
128
|
+
|
110
129
|
= Changes in 2.3.0 =
|
111
130
|
|
112
131
|
October 10, 2012 - version 2.3.0
|
data/lib/httpclient/cacert.p7s
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
MIME-Version: 1.0
|
2
|
-
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha1"; boundary="----
|
2
|
+
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha1"; boundary="----5FCD663C81182946FE75D58C22A8C67A"
|
3
3
|
|
4
4
|
This is an S/MIME signed message
|
5
5
|
|
6
|
-
------
|
6
|
+
------5FCD663C81182946FE75D58C22A8C67A
|
7
7
|
-----BEGIN CERTIFICATE-----
|
8
8
|
MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEU
|
9
9
|
MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3
|
@@ -663,25 +663,21 @@ hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
|
|
663
663
|
5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
|
664
664
|
-----END CERTIFICATE-----
|
665
665
|
-----BEGIN CERTIFICATE-----
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K
|
682
|
-
oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj
|
683
|
-
UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU
|
684
|
-
AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
|
666
|
+
MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL
|
667
|
+
MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj
|
668
|
+
KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2
|
669
|
+
MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
|
670
|
+
eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV
|
671
|
+
BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw
|
672
|
+
NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV
|
673
|
+
BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH
|
674
|
+
MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL
|
675
|
+
So17VDs6bl8VAsBQps8lL33KSLjHUGMcKiEIfJo22Av+0SbFWDEwKCXzXV2juLal
|
676
|
+
tJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO
|
677
|
+
BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+EVXVMAoG
|
678
|
+
CCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGT
|
679
|
+
qQ7mndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBucz
|
680
|
+
rD6ogRLQy7rQkgu2npaqBA+K
|
685
681
|
-----END CERTIFICATE-----
|
686
682
|
-----BEGIN CERTIFICATE-----
|
687
683
|
MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCB
|
@@ -708,6 +704,27 @@ SJsMC8tJP33st/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2G
|
|
708
704
|
spki4cErx5z481+oghLrGREt
|
709
705
|
-----END CERTIFICATE-----
|
710
706
|
-----BEG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C/kRYkRj5KTs4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl
|
722
|
+
4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K
|
723
|
+
oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj
|
724
|
+
UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU
|
725
|
+
AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
|
726
|
+
-----END CERTIFICATE-----
|
727
|
+
-----BEGIN CERTIFICATE-----
|
711
728
|
MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEW
|
712
729
|
MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVy
|
713
730
|
c2FsIENBMB4XDTA0MDMwNDA1MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UE
|
@@ -887,40 +904,6 @@ YQ33E3FTkzf9PK8AHWyLFK9Gloy2UnzMLU7N4elLCu6a/nqY5ym6G9ocutxrzQQO
|
|
887
904
|
JkCp63M8/lCoESdVvduOS+9PGO0V/72GmGbumiVxNGxQ8bJRy2adTSk=
|
888
905
|
-----END CERTIFICATE-----
|
889
906
|
-----BEGIN CERTIFICATE-----
|
890
|
-
MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJC
|
891
|
-
TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0
|
892
|
-
aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0
|
893
|
-
aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAzMTkxOD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Gl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
|
909
|
-
Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYI
|
910
|
-
KwYBBQUHAgEWFmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3T
|
911
|
-
KbkGGew5Oanwl4Rqy+/fMIGuBgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rq
|
912
|
-
y+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1p
|
913
|
-
dGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYD
|
914
|
-
VQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6tlCL
|
915
|
-
MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSk
|
916
|
-
fnIYj9lofFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf8
|
917
|
-
7C9TqnN7Az10buYWnuulLsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1R
|
918
|
-
cHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2xgI4JVrmcGmD+XcHXetwReNDWXcG31a0y
|
919
|
-
mQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi5upZIof4l/UO/erMkqQW
|
920
|
-
xFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi5nrQNiOK
|
921
|
-
SnQ2+Q==
|
922
|
-
-----END CERTIFICATE-----
|
923
|
-
-----BEGIN CERTIFICATE-----
|
924
907
|
MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x
|
925
908
|
GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv
|
926
909
|
b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV
|
@@ -992,6 +975,40 @@ mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK
|
|
992
975
|
4SVhM7JZG+Ju1zdXtg2pEto=
|
993
976
|
-----END CERTIFICATE-----
|
994
977
|
-----BEGIN CERTIFICATE-----
|
978
|
+
MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJC
|
979
|
+
TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0
|
980
|
+
aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0
|
981
|
+
aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAzMTkxODMzMzNaFw0yMTAzMTcxODMz
|
982
|
+
MzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUw
|
983
|
+
IwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQDEyVR
|
984
|
+
dW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG
|
985
|
+
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Yp
|
986
|
+
li4kVEAkOPcahdxYTMukJ0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2D
|
987
|
+
rOpm2RgbaIr1VxqYuvXtdj182d6UajtLF8HVj71lODqV0D1VNk7feVcxKh7YWWVJ
|
988
|
+
WCCYfqtffp/p1k3sg3Spx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L
|
1003
|
+
MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSk
|
1004
|
+
fnIYj9lofFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf8
|
1005
|
+
7C9TqnN7Az10buYWnuulLsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1R
|
1006
|
+
cHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2xgI4JVrmcGmD+XcHXetwReNDWXcG31a0y
|
1007
|
+
mQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi5upZIof4l/UO/erMkqQW
|
1008
|
+
xFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi5nrQNiOK
|
1009
|
+
SnQ2+Q==
|
1010
|
+
-----END CERTIFICATE-----
|
1011
|
+
-----BEGIN CERTIFICATE-----
|
995
1012
|
MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDEl
|
996
1013
|
MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMh
|
997
1014
|
U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIz
|
@@ -1273,29 +1290,20 @@ IPG47LHlVYCsPVLIOQ7C8MAFT9aCdYy9X9LcdpoFEsmvcsPcJX6kTY4XpeCHf+Ga
|
|
1273
1290
|
WuFg3GQjPEIuTQ==
|
1274
1291
|
-----END CERTIFICATE-----
|
1275
1292
|
-----BEGIN CERTIFICATE-----
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
NqR32HuHUETVPm4pafs5S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Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9v
|
1300
|
+
dCBDQSAtIEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/
|
1301
|
+
BebfowJPDQfGAFG6DAJSLSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6
|
1302
|
+
papu+7qzcMBniKI11KOasf2twu8x+qi58/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8E
|
1303
|
+
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmtgAMADna3+FGO6Lts6K
|
1304
|
+
DPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUNG4k8VIZ3
|
1305
|
+
KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41ox
|
1306
|
+
XZ3Krr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
|
1299
1307
|
-----END CERTIFICATE-----
|
1300
1308
|
-----BEGIN CERTIFICATE-----
|
1301
1309
|
MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCB
|
@@ -1323,6 +1331,31 @@ m7v/OeZWYdMKp8RcTGB7BXcmer/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZu
|
|
1323
1331
|
MdRAGmI0Nj81Aa6sY6A=
|
1324
1332
|
-----END CERTIFICATE-----
|
1325
1333
|
-----BEGIN CERTIFICATE-----
|
1334
|
+
MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB
|
1335
|
+
qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf
|
1336
|
+
Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw
|
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lXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz
|
1352
|
+
YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
|
1353
|
+
xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2
|
1354
|
+
/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/
|
1355
|
+
LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7
|
1356
|
+
jVaMaA==
|
1357
|
+
-----END CERTIFICATE-----
|
1358
|
+
-----BEGIN CERTIFICATE-----
|
1326
1359
|
MIIDIjCCAougAwIBAgIQNKT/9jCvTKU8MxdCoZRmdTANBgkqhkiG9w0BAQUFADCB
|
1327
1360
|
xDELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ
|
1328
1361
|
Q2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UE
|
@@ -1740,6 +1773,27 @@ F4ErWjfJXir0xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGt
|
|
1740
1773
|
TxzhT5yvDwyd93gN2PQ1VoDat20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
|
1741
1774
|
-----END CERTIFICATE-----
|
1742
1775
|
-----BEGIN CERTIFICATE-----
|
1776
|
+
MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjEL
|
1777
|
+
MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW
|
1778
|
+
ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEz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ZC
|
1793
|
+
4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIxAJw9SDkjOVga
|
1794
|
+
FRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
|
1795
|
+
-----END CERTIFICATE-----
|
1796
|
+
-----BEGIN CERTIFICATE-----
|
1743
1797
|
MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB
|
1744
1798
|
yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
|
1745
1799
|
ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
|
@@ -1813,12 +1867,12 @@ lRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4mJO3
|
|
1813
1867
|
7M2CYfE45k+XmCpajQ==
|
1814
1868
|
-----END CERTIFICATE-----
|
1815
1869
|
|
1816
|
-
------
|
1817
|
-
Content-Type: application/pkcs7-signature; name="smime.p7s"
|
1870
|
+
------5FCD663C81182946FE75D58C22A8C67A
|
1871
|
+
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
|
1818
1872
|
Content-Transfer-Encoding: base64
|
1819
1873
|
Content-Disposition: attachment; filename="smime.p7s"
|
1820
1874
|
|
1821
|
-
|
1875
|
+
MIIGiwYJKoZIhvcNAQcCoIIGfDCCBngCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3
|
1822
1876
|
DQEHAaCCBAEwggP9MIIC5aADAgECAgEBMA0GCSqGSIb3DQEBDQUAMEsxCzAJBgNV
|
1823
1877
|
BAYTAkpQMREwDwYDVQQKDAhjdG9yLm9yZzEUMBIGA1UECwwLRGV2ZWxvcG1lbnQx
|
1824
1878
|
EzARBgNVBAMMCmh0dHBjbGllbnQwHhcNMDkwNTIxMTIzO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/B
|
1905
|
+
1Fv45SvkTCWo0C2l6t1ZrqfkJNLLjSVP8CKAt4NVIo34RjEiQpfLtYbKu1yQlW9N
|
1906
|
+
tcfode1vgS8ECRvFzNQAlBe5Ei9ypLdH+0sz6tEWX70W+fOSYqtJjghrbVvxcxjx
|
1907
|
+
B1FdzJkFFV+woKVtS/oFGzv+daL49JqZe1I+LB9hsNf6Z8rcVu2NI4DCnT8yD6HT
|
1908
|
+
i3jvUxGQSJx4w3oZQW0wXEZB89c0tKCACrYZkNVYIerRkmz5oH/F6NcRicDR6aSg
|
1909
|
+
4fskz2tsbOp2tB4oVcQIWsheDeoXJQMpcejrh+9+LmP5hO4iZ3SzWghylLcb6u4=
|
1856
1910
|
|
1857
|
-
------
|
1911
|
+
------5FCD663C81182946FE75D58C22A8C67A--
|
1858
1912
|
|
data/lib/httpclient/cookie.rb
CHANGED
@@ -46,11 +46,6 @@ class WebAgent
|
|
46
46
|
return (hostname == domainname)
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
50
|
-
def total_dot_num(string)
|
51
|
-
string.scan(/\./).length()
|
52
|
-
end
|
53
|
-
|
54
49
|
end
|
55
50
|
|
56
51
|
class Cookie
|
@@ -71,7 +66,7 @@ class WebAgent
|
|
71
66
|
OVERRIDE_OK = 32
|
72
67
|
HTTP_ONLY = 64
|
73
68
|
|
74
|
-
def initialize
|
69
|
+
def initialize
|
75
70
|
@name = @value = @domain = @path = nil
|
76
71
|
@expires = nil
|
77
72
|
@url = nil
|
@@ -142,7 +137,7 @@ class WebAgent
|
|
142
137
|
end
|
143
138
|
|
144
139
|
def join_quotedstr(array, sep)
|
145
|
-
ret = Array.new
|
140
|
+
ret = Array.new
|
146
141
|
old_elem = nil
|
147
142
|
array.each{|elem|
|
148
143
|
if (elem.scan(/"/).length % 2) == 0
|
@@ -188,7 +183,7 @@ class WebAgent
|
|
188
183
|
when 'expires'
|
189
184
|
@expires = nil
|
190
185
|
begin
|
191
|
-
@expires = Time.parse(value).gmtime
|
186
|
+
@expires = Time.parse(value).gmtime if value
|
192
187
|
rescue ArgumentError
|
193
188
|
end
|
194
189
|
when 'path'
|
@@ -203,6 +198,8 @@ class WebAgent
|
|
203
198
|
}
|
204
199
|
end
|
205
200
|
|
201
|
+
private
|
202
|
+
|
206
203
|
def normalize_cookie_value(value)
|
207
204
|
if value
|
208
205
|
value = value.strip.sub(/\A"(.*)"\z/) { $1 }
|
@@ -210,7 +207,6 @@ class WebAgent
|
|
210
207
|
end
|
211
208
|
value
|
212
209
|
end
|
213
|
-
private :normalize_cookie_value
|
214
210
|
end
|
215
211
|
|
216
212
|
class CookieManager
|
@@ -225,17 +221,13 @@ class WebAgent
|
|
225
221
|
attr_accessor :cookies_file
|
226
222
|
attr_accessor :accept_domains, :reject_domains
|
227
223
|
|
228
|
-
# for conformance to http://wp.netscape.com/newsref/std/cookie_spec.html
|
229
|
-
attr_accessor :netscape_rule
|
230
|
-
SPECIAL_DOMAIN = [".com",".edu",".gov",".mil",".net",".org",".int"]
|
231
|
-
|
232
224
|
def initialize(file=nil)
|
233
|
-
@cookies = Array.new
|
225
|
+
@cookies = Array.new
|
234
226
|
@cookies.extend(MonitorMixin)
|
235
227
|
@cookies_file = file
|
236
228
|
@is_saved = true
|
237
|
-
@reject_domains = Array.new
|
238
|
-
@accept_domains = Array.new
|
229
|
+
@reject_domains = Array.new
|
230
|
+
@accept_domains = Array.new
|
239
231
|
@netscape_rule = false
|
240
232
|
end
|
241
233
|
|
@@ -246,7 +238,7 @@ class WebAgent
|
|
246
238
|
|
247
239
|
def save_all_cookies(force = nil, save_unused = true, save_discarded = true)
|
248
240
|
@cookies.synchronize do
|
249
|
-
check_expired_cookies
|
241
|
+
check_expired_cookies
|
250
242
|
if @is_saved and !force
|
251
243
|
return
|
252
244
|
end
|
@@ -272,7 +264,7 @@ class WebAgent
|
|
272
264
|
save_all_cookies(force, false, false)
|
273
265
|
end
|
274
266
|
|
275
|
-
def check_expired_cookies
|
267
|
+
def check_expired_cookies
|
276
268
|
@cookies.reject!{|cookie|
|
277
269
|
is_expired = (cookie.expires && (cookie.expires < Time.now.gmtime))
|
278
270
|
if is_expired && !cookie.discard?
|
@@ -283,31 +275,15 @@ class WebAgent
|
|
283
275
|
end
|
284
276
|
|
285
277
|
def parse(str, url)
|
286
|
-
cookie = WebAgent::Cookie.new
|
278
|
+
cookie = WebAgent::Cookie.new
|
287
279
|
cookie.parse(str, url)
|
288
280
|
add(cookie)
|
289
281
|
end
|
290
282
|
|
291
|
-
def make_cookie_str(cookie_list)
|
292
|
-
if cookie_list.empty?
|
293
|
-
return nil
|
294
|
-
end
|
295
|
-
|
296
|
-
ret = ''
|
297
|
-
c = cookie_list.shift
|
298
|
-
ret += "#{c.name}=#{c.value}"
|
299
|
-
cookie_list.each{|cookie|
|
300
|
-
ret += "; #{cookie.name}=#{cookie.value}"
|
301
|
-
}
|
302
|
-
return ret
|
303
|
-
end
|
304
|
-
private :make_cookie_str
|
305
|
-
|
306
|
-
|
307
283
|
def find(url)
|
308
284
|
return nil if @cookies.empty?
|
309
285
|
|
310
|
-
cookie_list = Array.new
|
286
|
+
cookie_list = Array.new
|
311
287
|
@cookies.each{|cookie|
|
312
288
|
is_expired = (cookie.expires && (cookie.expires < Time.now.gmtime))
|
313
289
|
if cookie.use? && !is_expired && cookie.match?(url)
|
@@ -319,92 +295,37 @@ class WebAgent
|
|
319
295
|
return make_cookie_str(cookie_list)
|
320
296
|
end
|
321
297
|
|
322
|
-
def
|
323
|
-
|
324
|
-
c.domain == domain && c.path == path && c.name == name
|
325
|
-
}
|
326
|
-
end
|
327
|
-
private :find_cookie_info
|
328
|
-
|
329
|
-
# not tested well; used only netscape_rule = true.
|
330
|
-
def cookie_error(err, override)
|
331
|
-
if !err.kind_of?(ErrorOverrideOK) || !override
|
332
|
-
raise err
|
333
|
-
end
|
334
|
-
end
|
335
|
-
private :cookie_error
|
336
|
-
|
337
|
-
def add(cookie)
|
338
|
-
url = cookie.url
|
339
|
-
name, value = cookie.name, cookie.value
|
340
|
-
expires, domain, path =
|
341
|
-
cookie.expires, cookie.domain, cookie.path
|
342
|
-
secure, http_only, domain_orig, path_orig =
|
343
|
-
cookie.secure?, cookie.http_only?, cookie.domain_orig?, cookie.path_orig?
|
344
|
-
discard, override =
|
345
|
-
cookie.discard?, cookie.override?
|
346
|
-
|
347
|
-
domainname = url.host
|
348
|
-
domain_orig, path_orig = domain, path
|
349
|
-
|
350
|
-
if domain
|
298
|
+
def add(given)
|
299
|
+
check_domain(given.domain, given.url.host, given.override?)
|
351
300
|
|
352
|
-
|
353
|
-
|
354
|
-
# cookie)
|
355
|
-
# I think that this rule has almost the same effect as the
|
356
|
-
# tail match of [NETSCAPE].
|
357
|
-
if domain !~ /^\./ && domainname != domain
|
358
|
-
domain = '.'+domain
|
359
|
-
end
|
301
|
+
domain = given.domain || given.url.host
|
302
|
+
path = given.path || given.url.path.sub(%r|/[^/]*\z|, '')
|
360
303
|
|
361
|
-
|
362
|
-
if @netscape_rule
|
363
|
-
n = total_dot_num(domain)
|
364
|
-
if n < 2
|
365
|
-
cookie_error(SpecialError.new(), override)
|
366
|
-
elsif n == 2
|
367
|
-
## [NETSCAPE] rule
|
368
|
-
ok = SPECIAL_DOMAIN.select{|sdomain|
|
369
|
-
sdomain == domain[-(sdomain.length)..-1]
|
370
|
-
}
|
371
|
-
if ok.empty?
|
372
|
-
cookie_error(SpecialError.new(), override)
|
373
|
-
end
|
374
|
-
end
|
375
|
-
end
|
376
|
-
|
377
|
-
# this implementation does not check RFC2109 4.3.2 case 2;
|
378
|
-
# the portion of host not in domain does not contain a dot.
|
379
|
-
# according to nsCookieService.cpp in Firefox 3.0.4, Firefox 3.0.4
|
380
|
-
# and IE does not check, too.
|
381
|
-
end
|
382
|
-
|
383
|
-
path ||= url.path.sub(%r|/[^/]*\z|, '')
|
384
|
-
domain ||= domainname
|
304
|
+
cookie = nil
|
385
305
|
@cookies.synchronize do
|
386
|
-
cookie =
|
306
|
+
cookie = @cookies.find { |c|
|
307
|
+
c.domain == domain && c.path == path && c.name == given.name
|
308
|
+
}
|
387
309
|
if !cookie
|
388
|
-
cookie = WebAgent::Cookie.new
|
310
|
+
cookie = WebAgent::Cookie.new
|
389
311
|
cookie.use = true
|
390
312
|
@cookies << cookie
|
391
313
|
end
|
392
|
-
check_expired_cookies
|
314
|
+
check_expired_cookies
|
393
315
|
end
|
394
316
|
|
395
|
-
cookie.url = url
|
396
|
-
cookie.name = name
|
397
|
-
cookie.value = value
|
398
|
-
cookie.expires = expires
|
399
317
|
cookie.domain = domain
|
400
318
|
cookie.path = path
|
401
|
-
|
402
|
-
|
403
|
-
cookie.
|
404
|
-
cookie.
|
405
|
-
cookie.
|
406
|
-
cookie.
|
407
|
-
|
319
|
+
cookie.url = given.url
|
320
|
+
cookie.name = given.name
|
321
|
+
cookie.value = given.value
|
322
|
+
cookie.expires = given.expires
|
323
|
+
cookie.secure = given.secure?
|
324
|
+
cookie.http_only = given.http_only?
|
325
|
+
cookie.domain_orig = given.domain
|
326
|
+
cookie.path_orig = given.path
|
327
|
+
|
328
|
+
if cookie.discard? || cookie.expires == nil
|
408
329
|
cookie.discard = true
|
409
330
|
else
|
410
331
|
cookie.discard = false
|
@@ -412,13 +333,13 @@ class WebAgent
|
|
412
333
|
end
|
413
334
|
end
|
414
335
|
|
415
|
-
def load_cookies
|
336
|
+
def load_cookies
|
416
337
|
return if !File.readable?(@cookies_file)
|
417
338
|
@cookies.synchronize do
|
418
339
|
@cookies.clear
|
419
340
|
File.open(@cookies_file,'r'){|f|
|
420
341
|
while line = f.gets
|
421
|
-
cookie = WebAgent::Cookie.new
|
342
|
+
cookie = WebAgent::Cookie.new
|
422
343
|
@cookies << cookie
|
423
344
|
col = line.chomp.split(/\t/)
|
424
345
|
cookie.url = HTTPClient::Util.urify(col[0])
|
@@ -437,6 +358,7 @@ class WebAgent
|
|
437
358
|
end
|
438
359
|
end
|
439
360
|
|
361
|
+
# Who use it?
|
440
362
|
def check_cookie_accept_domain(domain)
|
441
363
|
unless domain
|
442
364
|
return false
|
@@ -453,121 +375,64 @@ class WebAgent
|
|
453
375
|
}
|
454
376
|
return true
|
455
377
|
end
|
456
|
-
end
|
457
|
-
end
|
458
|
-
|
459
|
-
__END__
|
460
|
-
|
461
|
-
=begin
|
462
|
-
|
463
|
-
== WebAgent::CookieManager Class
|
464
|
-
|
465
|
-
Load, save, parse and send cookies.
|
466
|
-
|
467
|
-
=== Usage
|
468
|
-
|
469
|
-
## initialize
|
470
|
-
cm = WebAgent::CookieManager.new("/home/foo/bar/cookie")
|
471
|
-
|
472
|
-
## load cookie data
|
473
|
-
cm.load_cookies()
|
474
|
-
|
475
|
-
## parse cookie from string (maybe "Set-Cookie:" header)
|
476
|
-
cm.parse(str)
|
477
378
|
|
478
|
-
|
479
|
-
f.write(cm.find(url))
|
379
|
+
private
|
480
380
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
=== Class Methods
|
486
|
-
|
487
|
-
-- CookieManager::new(file=nil)
|
488
|
-
|
489
|
-
create new CookieManager. If a file is provided,
|
490
|
-
use it as cookies' file.
|
491
|
-
|
492
|
-
=== Methods
|
493
|
-
|
494
|
-
-- CookieManager#save_cookies(force = nil)
|
495
|
-
|
496
|
-
save cookies' data into file. if argument is true,
|
497
|
-
save data although data is not modified.
|
498
|
-
|
499
|
-
-- CookieManager#parse(str, url)
|
500
|
-
|
501
|
-
parse string and store cookie (to parse HTTP response header).
|
502
|
-
|
503
|
-
-- CookieManager#find(url)
|
504
|
-
|
505
|
-
get cookies and make into string (to send as HTTP request header).
|
506
|
-
|
507
|
-
-- CookieManager#add(cookie)
|
508
|
-
|
509
|
-
add new cookie.
|
510
|
-
|
511
|
-
-- CookieManager#load_cookies()
|
512
|
-
|
513
|
-
load cookies' data from file.
|
514
|
-
|
515
|
-
|
516
|
-
== WebAgent::CookieUtils Module
|
517
|
-
|
518
|
-
-- CookieUtils::head_match?(str1, str2)
|
519
|
-
-- CookieUtils::tail_match?(str1, str2)
|
520
|
-
-- CookieUtils::domain_match(host, domain)
|
521
|
-
-- CookieUtils::total_dot_num(str)
|
522
|
-
|
523
|
-
|
524
|
-
== WebAgent::Cookie Class
|
525
|
-
|
526
|
-
=== Class Methods
|
527
|
-
|
528
|
-
-- Cookie::new()
|
529
|
-
|
530
|
-
create new cookie.
|
531
|
-
|
532
|
-
=== Methods
|
533
|
-
|
534
|
-
-- Cookie#match?(url)
|
535
|
-
|
536
|
-
match cookie by url. if match, return true. otherwise,
|
537
|
-
return false.
|
381
|
+
def make_cookie_str(cookie_list)
|
382
|
+
if cookie_list.empty?
|
383
|
+
return nil
|
384
|
+
end
|
538
385
|
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
-- Cookie#expires
|
548
|
-
-- Cookie#expires=(expires)
|
549
|
-
-- Cookie#url
|
550
|
-
-- Cookie#url=(url)
|
386
|
+
ret = ''
|
387
|
+
c = cookie_list.shift
|
388
|
+
ret += "#{c.name}=#{c.value}"
|
389
|
+
cookie_list.each{|cookie|
|
390
|
+
ret += "; #{cookie.name}=#{cookie.value}"
|
391
|
+
}
|
392
|
+
return ret
|
393
|
+
end
|
551
394
|
|
552
|
-
|
395
|
+
# for conformance to http://wp.netscape.com/newsref/std/cookie_spec.html
|
396
|
+
attr_accessor :netscape_rule
|
397
|
+
SPECIAL_DOMAIN = [".com",".edu",".gov",".mil",".net",".org",".int"]
|
553
398
|
|
554
|
-
|
555
|
-
|
556
|
-
-- Cookie#use?
|
557
|
-
-- Cookie#use=(use)
|
558
|
-
-- Cookie#secure?
|
559
|
-
-- Cookie#secure=(secure)
|
560
|
-
-- Cookie#http_only?
|
561
|
-
-- Cookie#http_only=(http_only)
|
562
|
-
-- Cookie#domain_orig?
|
563
|
-
-- Cookie#domain_orig=(domain_orig)
|
564
|
-
-- Cookie#path_orig?
|
565
|
-
-- Cookie#path_orig=(path_orig)
|
566
|
-
-- Cookie#override?
|
567
|
-
-- Cookie#override=(override)
|
568
|
-
-- Cookie#flag
|
569
|
-
-- Cookie#set_flag(flag_num)
|
399
|
+
def check_domain(domain, hostname, override)
|
400
|
+
return unless domain
|
570
401
|
|
571
|
-
|
402
|
+
# [DRAFT 12] s. 4.2.2 (does not apply in the case that
|
403
|
+
# host name is the same as domain attribute for version 0
|
404
|
+
# cookie)
|
405
|
+
# I think that this rule has almost the same effect as the
|
406
|
+
# tail match of [NETSCAPE].
|
407
|
+
if domain !~ /^\./ && hostname != domain
|
408
|
+
domain = '.'+domain
|
409
|
+
end
|
410
|
+
# [NETSCAPE] rule
|
411
|
+
if @netscape_rule
|
412
|
+
n = domain.scan(/\./).length
|
413
|
+
if n < 2
|
414
|
+
cookie_error(SpecialError.new, override)
|
415
|
+
elsif n == 2
|
416
|
+
## [NETSCAPE] rule
|
417
|
+
ok = SPECIAL_DOMAIN.select{|sdomain|
|
418
|
+
sdomain == domain[-(sdomain.length)..-1]
|
419
|
+
}
|
420
|
+
if ok.empty?
|
421
|
+
cookie_error(SpecialError.new, override)
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
# this implementation does not check RFC2109 4.3.2 case 2;
|
426
|
+
# the portion of host not in domain does not contain a dot.
|
427
|
+
# according to nsCookieService.cpp in Firefox 3.0.4, Firefox 3.0.4
|
428
|
+
# and IE does not check, too.
|
429
|
+
end
|
572
430
|
|
573
|
-
=
|
431
|
+
# not tested well; used only netscape_rule = true.
|
432
|
+
def cookie_error(err, override)
|
433
|
+
if !err.kind_of?(ErrorOverrideOK) || !override
|
434
|
+
raise err
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|