Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to access a body of POST request using fastcgi C/C++ application
    primarykey
    data
    text
    <p>I am using a library from <a href="http://fastcgi.com/">http://fastcgi.com/</a> in C++ application as a backend and nginx web-server as a front-end.</p> <p>Posting files from HTML-form successfully and can see the temporary files on nginx server side. But I can't figure out how to access a body of multipart POST request using fastcgi_stdio. This is my HTML-form.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Test Server&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="upload-form" method="post" target="upload_target" enctype="multipart/form-data" action="/upload"&gt; &lt;input name="file" id="file" size="27" type="file" /&gt;&lt;br /&gt; &lt;input type="submit" name="action" value="Upload" /&gt;&lt;br /&gt; &lt;iframe id="upload_target" name="upload_target" src="" style="width:100%;height:100px;border:0px solid #fff;"&gt;&lt;/iframe&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My nginx conf file:</p> <pre><code>location /upload { # Pass altered request body to this location upload_pass @test; # Store files to this directory # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist upload_store /www/test; # Allow uploaded files to be read only by user upload_store_access user:rw group:r all:r; # Set specified fields in request body upload_set_form_field $upload_field_name.name $upload_file_name; upload_set_form_field $upload_field_name.content_type "$upload_content_type"; upload_set_form_field $upload_field_name.path "$upload_tmp_path"; # Inform backend about hash and size of a file upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5"; upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size"; upload_pass_form_field "^submit$|^description$"; upload_cleanup 400 404 499 500-505; } include fastcgi.conf; # Pass altered request body to a backend location @test { fastcgi_pass localhost:8080 } </code></pre> <p>Now, how can handle/get the POST request body in my fastcgi c++ application and how to write it in proper file at the fastcgi app side ?</p> <p>Is there any better fast module to achieve this? </p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload