msgbartop
PHP语言, PHP扩展, Zend引擎相关的研究,技术,新闻分享 – 左手代码 右手诗
msgbarbottom

20 Jan 11 Expect:100-continue

在使用curl做POST的时候, 当要POST的数据大于1024字节的时候, curl并不会直接就发起POST请求, 而是会分为俩步,

  1. 发送一个请求, 包含一个Expect:100-continue, 询问Server使用愿意接受数据
  2. 接收到Server返回的100-continue应答以后, 才把数据POST给Server
  

这是libcurl的行为.

具体的RFC相关描述: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3

于是,这样就有了一个问题, 并不是所有的Server都会正确应答100-continue, 比如lighttpd, 就会返回417 “Expectation Failed”, 则会造成逻辑出错,,

要解决的办法也挺容易:

 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
               // Disable Expect: header (lighttpd does not support it)
 


分享到:



Related Posts:

Tags: , , ,

13 Responses to “Expect:100-continue”

  1. スーパーコピー エルメス |

    IWC時計コピールイヴィトン時計コピー,オーデマ ピゲ時計コピー,ブライトリング時計コピーコピーブランド、ブランド激安、人気ブランドの販売、通販、オークション、新作のスーパーコピーブランドコピー、韓国スーパーコピー、ブランド激安、偽物ブランド、ブランドバッグ、激安かばん、ルイヴィトン偽物、財布激安.商品は全く写真の通りです。
    スーパーコピー エルメス http://www.eevance.com/tokei/ap

  2. slither.io hacked game online |

    My brother suggested I would possibly like this blog.
    He used to be entirely right. This submit truly made my day.
    You cann’t consider just how much time I had spent for this info!
    Thank you!

  3. It’s About The Gay Couple |

    Μу wweb blog; It’s About The Gay Couple

  4. internet phone number |

    Gay And Cam

    LOCAL MATCHESControl thе space between yoou and ʏour profile
    matches using tapping update Yοur recommendation.
    Youll automatically time close bү profipes eearly ߋn, then nicely ρresent ʏοu еveryone еlse а little additional aѡay.

    Youll scoff ɑ make ɑ raacket tryung оut apiece
    tһe ɡreat QuestChat singles!
    Aree yоu bored ᴡith tɦе usual courting gimmicks?

    Aге ʏоu uninterested іn fixed blind dates ѡhich find үourself іn unappetizing dates?

    Αге уⲟu tired of spending а fortune locket оut in gollf equipment ϳust tⲟ ɡᥱt to satisfy ɑ neew person оr tο arrange a brand neew ԁate?
    Arе youu uninterested іn աaiting fοr that individual to lastly
    find уοu? іf уօu аге uneasy ⲟn tҺe subject ⲟf
    the ԝay in աhich things arе going ᴡith ʏοur social
    life aand үοur honoring life, then үߋu һave tо barn dance
    іѕ take management! No, ʏօu Ԁо not neеɗ tto hold tremendous wealthy noг ԁօ youu should
    adhere tо ɑ superstar tߋ gain dates
    nowadays. ᥱѵery оne үοu want
    іѕ a pc оr a phone sο ʏоu may meet іnteresting folks anytime,
    anywhere. bby means ⲟff tһе usage ⲟf spinster
    banter lines ⲟr telephone dating companies, уοu’ll ƅe ɑble tо simply attain dates
    anytime ʏou ѡant tߋ.
    Teligence. еvery Ꮢights hesitant *all fashons аnd members օf tһіѕ web site
    aге 18 years οr ancient -mеn’ѕ single Chatline

    How tⲟ block gossip rule Numbers
    оn ʏⲟur cellphone

    Chat traces ɑге a enjoyable strategy tο sᥱt
    ᥙр neա friends or rack upp business
    clients. they offer voice-tⲟ-voice real- slaughter іn ɑn period…

    Ԍet knowledgeable answers ƅegin a 1-bү tһe side οf-1 goswip noԝ!doctors lawyers Tech hel MechanicsMore Veterinarians private
    Finanxe Professionals Handymen equipment rewpair Specialist collect
    Advisors Ԍеt аn ɑnswer
    Online chatting is ɑn effective ᴡay
    tⲟ cross tһe Ьeing.
    yoou cаn chst with household and pals, аnd
    meet people ԝһо might…

    Free local banter Numbers -

    mʏ һomepage :: internet phone number

  5. operabily |

    Ther&#6513′s tҺ&#6513 bаг neхt
    ԁoоr ɑnd tҺе ǥгοсerү ѕtοге
    neҳt tо that t&#1086 nam&#6513 ϳust tԝߋ.
    Үοսr c&#6489ѕtοmer, աҺօ ѡɑѕ рreѵі&#11423սѕly ǥօіng tօ &#7456iѕіt у&#11423uг геstaսrаnt ѕрotѕ a niсе гeϲі&#1088&#6513 іn ѕtore ɑnd ԁеϲіԀeѕ
    tο ѕtаү іn fοг t&#1211eіг
    meаl. &#5026Һat,mу fгiеnd, іѕ c&#1086mρеtіtіоn.

    Ηеге iѕ mʏ ԝеb Ƅ&#8572&#1086ǥ;
    operabily

  6. CURL慢导致超时的可能性 | Sinfey's Blog |

    [...] Expect:问题转载于:http://www.laruence.com/2011/01/20/1840.html [...]

  7. PHP在使用CURL进行POST请求时“Expect:100-continue”处理 – 学者@李双琳 |

    [...] PHP在使用CURL进行POST请求时“Expect:100-continue”处理 PHP Ringo 23小时前 10浏览 0评论 var sogou_ad_id=283210; var sogou_ad_height=18; var sogou_ad_width=760;     今天在开发九游游戏平台相关接口是,打算采用PHP的CURL执行HTTP的POST请求,但是根据说明文档,不管怎么修改总是提示500错误,返回的结果是,invalid_request_io_exception。因此,根据FAQ说明,要求不能指定“Expect:100-continue”参数。于是,在网上搜索了相关教程,根据《Expect:100-continue》一文,进行修改,顺利通过测试。下面将转载该文对其原理的分析: [...]

  8. curl的header参数 « 沈二铺子 |

    [...] 鸟哥曾经在博客中介绍过这个: http://www.laruence.com/2011/01/20/1840.html [...]

  9. jobs_lee |

    本地用curl post数据 errno为18,找了半天,才找到这个原因,这个玩意整死人了,另外hessianphp中post数据有同样的问题,解决办法是设置http协议的版本,1.1改为1.0,测试了下,加了个curl_setopt($ch, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_0);
    这个方法也有效

  10. iterse |

    很强大,顶!

  11. 132CC.com » Blog Archive » Compilation failed: support for P, p, and X has not been compiled |

    [...] Expect:100-continue [...]

  12. php |

    终于又看到鸟哥的新文章了

  13. silentime |

    鸟哥是怎么发现这个问题的?

Leave a Reply

*