@@ -85,7 +85,7 @@ function set_ssl_status() {
85
85
* Set verify ssl in case you are using an unsigned cert.
86
86
*/
87
87
function set_ssl () {
88
- $ this ->curl_connect ->sslVersion = 3 ;
88
+ // let tuque figure it out $this->curl_connect->sslVersion = 3;
89
89
$ this ->curl_connect ->verifyHost = $ this ->ssl_status ;
90
90
$ this ->curl_connect ->verifyPeer = $ this ->ssl_status ;
91
91
}
@@ -116,27 +116,41 @@ function send_Message($message) {
116
116
/**
117
117
* replacement for pecl parse headers
118
118
* taken from php.net
119
- * @param string $header
119
+ * @param string $raw_headers
120
120
* @return array
121
121
*/
122
- function http_parse_headers ($ header ) {
123
- $ retVal = array ();
124
- $ fields = explode ("\r\n" , preg_replace ('/\x0D\x0A[\x09\x20]+/ ' , ' ' , $ header ));
125
- foreach ($ fields as $ field ) {
126
- if (preg_match ('/([^:]+): (.+)/m ' , $ field , $ match )) {
127
- $ match [1 ] = preg_replace ('/(?<=^|[\x09\x20\x2D])./e ' , 'strtoupper("\0") ' , strtolower (trim ($ match [1 ])));
128
- if (isset ($ retVal [$ match [1 ]])) {
129
- $ retVal [$ match [1 ]] = array ($ retVal [$ match [1 ]], $ match [2 ]);
122
+ function http_parse_headers ($ raw_headers ) {
123
+ $ headers = array ();
124
+ $ key = '' ;
125
+
126
+ foreach (explode ("\n" , $ raw_headers ) as $ i => $ h ) {
127
+ $ h = explode (': ' , $ h , 2 );
128
+
129
+ if (isset ($ h [1 ])) {
130
+ if (!isset ($ headers [$ h [0 ]]))
131
+ $ headers [$ h [0 ]] = trim ($ h [1 ]);
132
+ elseif (is_array ($ headers [$ h [0 ]])) {
133
+ $ headers [$ h [0 ]] = array_merge ($ headers [$ h [0 ]], array (trim ($ h [1 ])));
130
134
}
131
135
else {
132
- $ retVal [ $ match [ 1 ]] = trim ($ match [ 2 ] );
136
+ $ headers [ $ h [ 0 ]] = array_merge ( array ( $ headers [ $ h [ 0 ]]), array ( trim ($ h [ 1 ])) );
133
137
}
138
+
139
+ $ key = $ h [0 ];
140
+ }
141
+ else {
142
+ if (substr ($ h [0 ], 0 , 1 ) == "\t" )
143
+ $ headers [$ key ] .= "\r\n\t" .trim ($ h [0 ]);
144
+ elseif (!$ key )
145
+ $ headers [0 ] = trim ($ h [0 ]);
134
146
}
135
147
}
136
- return $ retVal ;
148
+
149
+ return $ headers ;
137
150
}
138
151
139
152
153
+
140
154
/**
141
155
* This function is to parse uuid from the feedback message.
142
156
* There must have full url of the t2flow on taverna server.
0 commit comments