Closed warmbook closed 1 year ago
This is configurable - please read the user guide: https://www.codeigniter.com/user_guide/libraries/curlrequest.html#config-for-curlrequest
This is configurable - please read the user guide: https://www.codeigniter.com/user_guide/libraries/curlrequest.html#config-for-curlrequest
I had read about this config, it's set to decide whether to share "request options" in different request. When it's set to true, the program only clear "headers of CURLRequest instance",but the old "headers of response" were still there.
This is configurable - please read the user guide: https://www.codeigniter.com/user_guide/libraries/curlrequest.html#config-for-curlrequest
Excuse me for my broken English! I mean: I want to "get the correct headers from server in each request", not "send the correct headers to server in each request". AS you replied,the latter works correctly, but the former seems not.
Oh, no problem, the fault is on my side. We will have to look into it.
Oh, no problem, the fault is on my side. We will have to look into it.
Thanks! I'm a Chinese, and I used CodeIgniter since 2.X, I mean ,I like it very much! I even revised it to support swoole. I wish one day it would support swoole officially,beacuse I like swoole very much too. Anyway, thank you very much!
This is a bug. I don't see any reason to share the Response object between requests.
PHP Version
8.1
CodeIgniter4 Version
4.3.3
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
fpm-fcgi
Database
No response
What happened?
When I send more than one requests by same instance of CURLRequest class, some headers of responses in front will exist in the later responses. For example: At the first time,I requested 'http://domain.com/URI/A' successfully, then I can get some headers such as 'expires' or 'etag' by method 'getHeaderLine'. At the second time, I requested 'http://domain.com/URI/B' by the same instance, it failed and the server doesn't response the header 'etag'. But when I call the 'hasHeader' method, I call still get it.
Steps to Reproduce
Send more than one requests by same instance of CURLRequest class, and the server responses different header names.
Expected Output
Headers of responses in front should be cleared before the later request.
Anything else?
My way to solve this problem is just setting two properties of response instance (a property of CURLRequest instance) to empty array before parsing output of curl: $break = strpos($output, $breakString); $this->response->headers = []; $this->response->headerMap = []; ... I‘m a green hand,maybe there are some better ways?