login about faq

I am using the code from the (Delphi DLL) HTTP multipart/form-data Upload example (slightly modified) and get this error on the Protocol Violation Report. "Content-Length mismatch. Request Header indicated 403 bytes, but client sent 0 bytes".
Fiddler shows Content-Length: 403 Content-Type: multipart/form-data: boundary=---etc but no data in the HexView after : 403...

Any suggestions would be appreciated.

This is the code...

     ckHTTP := CkHttp_Create();
     ckHTTPRequest := ckHttpRequest_Create();
     try
      {---  any string unlocks the component for the 1st 30-days.}
        blnResult := ckHTTP_UnlockComponent(CkHttp,cChilkatUnlockHTTP);
        if (not blnResult) then
           begin
           ShowMessage (ckHTTPLastErrorText(ckHTTP));
           strResponse := strResponse + ckHTTPLastErrorText(ckHTTP) + cCrLf;
           Exit;
           end;

    CkHttpRequest_putVerboseLogging (ckHTTPRequest, true);
    CkHttp_putUseIEProxy (ckHTTP, true);
    CkHttpRequest_putDebugLogFilePath (ckHTTPRequest,
                                       PChar(ExtractFilePath (Application.ExeName) + '\SessionLogFile.txt'));

    CkHttpRequest_putHttpVerb    (ckHTTPRequest, 'POST');
    CkHTTPRequest_putContentType (ckHttpRequest, PWideChar('multipart/form-data'));
    CkHTTPRequest_putCharset     (ckHttpRequest, PWideChar('utf-8'));
    CkHTTPRequest_putPath        (ckHttpRequest, PWideChar('/restapi/1/accounts/xxxxxxxx/envelopes.xml'));

   CkHttpRequest_AddHeader (ckHTTPRequest, 'Expect', '100-continue');

    strXML := '<abc>This is the test.xml content</abc>';
    blnResult := CkHttpRequest_AddStringForUpload
                                (ckHTTPRequest,
                                 'part1',
                                 'part1',
                                 PWideChar(strXML),
                                 'utf-8');
    if (not blnResult) then
       begin
       ShowMessage (ckHTTP__LastErrorText(ckHTTP));
       strResponse := strResponse + ckHTTP__LastErrorText(ckHTTP) + cCrLf;
       Exit;
       end;

    blnResult := CkHttpRequest_AddFileForUpload (ckHTTPRequest,
                                                 'part2',
                                                 PWideChar(pstrUNCPdfFileName));
    if (not blnResult) then
       begin
       ShowMessage (ckHTTP__LastErrorText(ckHTTP));
       strResponse := strResponse + ckHTTP__LastErrorText(ckHTTP) + cCrLf;
       Exit;
       end;

    CkHttp_putKeepEventLog(ckHTTP,true);
    CkHTTPResponse := ckHTTP_SynchronousRequest(ckHTTP,
                                                cEndpointDomain,
                                                cEndpointPort,
                                                cEndpointSsl,
                                                ckHTTPRequest);

This is the log contents...

Path:
    DllDate: Aug 27 2015
    ChilkatVersion: 9.5.0.52
    UnlockPrefix: BRIANDHttp
    Username: RS2010-DEV1:DEV1
    Architecture: Little Endian; 32-bit
    Language: Delphi/C++ Builder XE2/XE3
    VerboseLogging: 1
    path: [/restapi/1/accounts/1170991/envelopes.xml]
    (leaveContext 16ms)
AddHeader:
    DllDate: Aug 27 2015
    ChilkatVersion: 9.5.0.52
    UnlockPrefix: BRIANDHttp
    Username: RS2010-DEV1:DEV1
    Architecture: Little Endian; 32-bit
    Language: Delphi/C++ Builder XE2/XE3
    VerboseLogging: 1
    name: Expect
    value: 100-continue
    (leaveContext)
AddStringForUpload:
    DllDate: Aug 27 2015
    ChilkatVersion: 9.5.0.52
    UnlockPrefix: BRIANDHttp
    Username: RS2010-DEV1:DEV1
    Architecture: Little Endian; 32-bit
    Language: Delphi/C++ Builder XE2/XE3
    VerboseLogging: 1
    (leaveContext)
AddFileForUpload:
    DllDate: Aug 27 2015
    ChilkatVersion: 9.5.0.52
    UnlockPrefix: BRIANDHttp
    Username: RS2010-DEV1:DEV1
    Architecture: Little Endian; 32-bit
    Language: Delphi/C++ Builder XE2/XE3
    VerboseLogging: 1
    name: part2
    localFilePath: C:\Delphi_2010\Temp Progs\DocuSign RestAPI Chillkat\SendToDocuSign.txt
    Success.
    (leaveContext 16ms)

asked Sep 12 '15 at 23:33

bryanw's gravatar image

bryanw
26223


Solved it. The problem was this line... CkHttp_putUseIEProxy (ckHTTP, true); This set the proxy to 127.0.0.1:8888. When I removed the line it all worked. Maybe there is something that need to set for the proxy, like allow HTTPS or something. I will hunt around. Would be nice if anyone has a work around for this as it would still be nice to be able to use fiddler.

link

answered Sep 13 '15 at 00:55

bryanw's gravatar image

bryanw
26223

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×2
×2

Asked: Sep 12 '15 at 23:33

Seen: 698 times

Last updated: Sep 13 '15 at 00:55

powered by OSQA