0

I have the strangest problem:

if i try to post a cookie with curl i get a http_code 500, when i leave the cookie out it works normally?!

i added the cookie like this:

curl_setopt($curl, CURLOPT_COOKIE, 'someCookie=' . $_COOKIE['someCookie'] . '; path=/');

Any ideas? Just hints, bounce ideas..anything

curl_info:

Array (
     [url] => valid url
     [content_type] => text/html; charset=utf-8
     [http_code] => 500
     [header_size] => 279
     [request_size] => 270
     [filetime] => -1
     [ssl_verify_result] => 0
     [redirect_count] => 0
     [total_time] => 0.345595
     [namelookup_time] => 2.3E-5
     [connect_time] => 0.000122
     [pretransfer_time] => 0.000126
     [size_upload] => 1026
     [size_download] => 52106
     [speed_download] => 150771
     [speed_upload] => 2968
     [download_content_length] => -1
     [upload_content_length] => 1026
     [starttransfer_time] => 0.000814
     [redirect_time] => 0
     [certinfo] => Array ( )
     [redirect_url] =>
)

Note: no errors happen and i see everything in access log (http_code 500 though)

I can successfully execute the command from the command line so are there any ideas as to what may be preventing php from executing it?

7
  • Do you have access to that server's logs? The error log will contain more details about the 500. Commented Aug 18, 2012 at 20:46
  • i thought the "/" should be a file name like "/cookie.txt" which you have permission to write to Commented Aug 18, 2012 at 20:50
  • Marc B: yeah i do...which one? access log and error log are clean, omoabobade: thats cookie-jar Commented Aug 18, 2012 at 20:50
  • whichever server you're sending this cookie to that's giving you the 500 error. y Commented Aug 18, 2012 at 20:52
  • yeah but which specific log? i have access to them all Commented Aug 18, 2012 at 20:54

1 Answer 1

1

the most idiotic problem i had ever seen was happening because of the path

i dont know why or how...but when i removed it, it worked just fine

edit: so after about 4 hours of research an do-try-redo testing i figured it out: path in combination with an internal server error...

of course the error was not logged in any log, anyway tnx 4 the help

Sign up to request clarification or add additional context in comments.

2 Comments

Because cookie headers in HTTP requests do not contain paths. Paths are used when setting cookies (in HTTP responses); if a cookie's path does not match the request URI, it is simply not sent. Not having to send a list of cookies and paths for the server to parse is the reason the path attribute exists in the spec.
i know only the key,value pair is sent, but the funny thing is that i shoud then get a custom 403 code not a 500... now i have a new problem...again i get a http 500 code but this time with the path left out?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.