Welcome Guest, Not a member yet? Register   Sign In
Capturing post data from C++ application in Codeigniter 4
#11

(05-10-2022, 07:52 AM)junosapien Wrote: However - Posting from the app 1) tells me the request method is GET

The request method should be POST, but it is GET. It is something wrong.

These words suggest it is a POST request.
CHttpConnection::HTTP_VERB_POST
application/x-www-form-urlencoded
Reply
#12

OK, so - I know I commented these lines in .htaccess the other day and it made no difference...
   
Code:
# Redirect Trailing Slashes...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]
so either I made the change and neglected to push it to the server OR there was a caching issue, because I tried again this morning, and lo and behold, I get the proper response:

CI4 - original .htaccess

Code:
Array
(
    [REDIRECT_UNIQUE_ID] => Yo5S1RURL_PRU7907pX_7gAAAAU
    [REDIRECT_SCRIPT_URL] => /verification/activation
    [REDIRECT_SCRIPT_URI] => http://test.mysite.com/verification/activation
    [REDIRECT_STATUS] => 200
    [UNIQUE_ID] => Yo5S1RURL_PRU7907pX_7gAAAAU
    [SCRIPT_URL] => /verification/activation
    [SCRIPT_URI] => http://test.mysite.com/verification/activation
    [HTTP_AUTHORIZATION] => Basic XXXXXXXXXXXXXXXXXXXXX
    [HTTP_HOST] => test.mysite.com
    [HTTP_CACHE_CONTROL] => no-cache
    [HTTP_COOKIE] => ci_session418=in9nd1155tk5qvf72u8dp914sm1vhnjb; ci_session=f4g49781l5503dprd6l9kp5uk4k7msb8
    [HTTP_USER_AGENT] => SubscriptionCheck
    [HTTP_X_FORWARDED_FOR] => 96.68.149.126
    [HTTP_X_FORWARDED_PORT] => 443
    [HTTP_X_FORWARDED_PROTO] => https
    [HTTP_CONNECTION] => keep-alive
    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
    [SERVER_SIGNATURE] =>
    [SERVER_SOFTWARE] => Apache/2.4.53 () PHP/7.4.28
    [SERVER_NAME] => test.mysite.com
    [SERVER_ADDR] => 172.30.1.69
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 172.30.4.42
    [DOCUMENT_ROOT] => /var/www/public
    [REQUEST_SCHEME] => http
    [CONTEXT_PREFIX] =>
    [CONTEXT_DOCUMENT_ROOT] => /var/www/public
    [SERVER_ADMIN] => [email protected]
    [SCRIPT_FILENAME] => /var/www/public/index.php
    [REMOTE_PORT] => 40424
    [REMOTE_USER] => MyUser
    [AUTH_TYPE] => Basic
    [REDIRECT_URL] => /verification/activation
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] =>
    [REQUEST_URI] => /verification/activation
    [SCRIPT_NAME] => /index.php
    [PATH_INFO] => /verification/activation
    [PATH_TRANSLATED] => redirect:/index.php/verification/activation/activation
    [PHP_SELF] => /index.php/verification/activation
    [PHP_AUTH_USER] => MyUser
    [PHP_AUTH_PW] => MyPassword
    [REQUEST_TIME_FLOAT] => 1653494485.0647
    [REQUEST_TIME] => 1653494485
    [CI_ENVIRONMENT] => development
)

RESULTS:
Subscription number:
Activation: No
Error: No parameters sent.


CI4 - Removed # Redirect Trailing Slashes... directives in .htaccess

Code:
Array
(
    [REDIRECT_UNIQUE_ID] => Yo5XSGhqtIeAir6UX6zOqwAAAAg
    [REDIRECT_SCRIPT_URL] => /verification/activation/
    [REDIRECT_SCRIPT_URI] => http://test.mysite.com/verification/activation/
    [REDIRECT_STATUS] => 200
    [UNIQUE_ID] => Yo5XSGhqtIeAir6UX6zOqwAAAAg
    [SCRIPT_URL] => /verification/activation/
    [SCRIPT_URI] => http://test.mysite.com/verification/activation/
    [HTTP_AUTHORIZATION] => Basic XXXXXXXXXXXXXXXXXXXXX
    [HTTP_HOST] => test.mysite.com
    [HTTP_CACHE_CONTROL] => no-cache
    [CONTENT_TYPE] => application/x-www-form-urlencoded
    [HTTP_COOKIE] => ci_session418=fbmt81ebsdc0bimcha0sjgmp7mpahaqf; ci_session=dodrcv30dilioko3m15ttu0p7acgpeaq
    [HTTP_USER_AGENT] => SubscriptionCheck
    [HTTP_X_FORWARDED_FOR] => 96.68.149.126
    [HTTP_X_FORWARDED_PORT] => 443
    [HTTP_X_FORWARDED_PROTO] => https
    [CONTENT_LENGTH] => 170
    [HTTP_CONNECTION] => keep-alive
    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
    [SERVER_SIGNATURE] =>
    [SERVER_SOFTWARE] => Apache/2.4.53 () PHP/7.4.28
    [SERVER_NAME] => test.mysite.com
    [SERVER_ADDR] => 172.30.1.69
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 172.30.4.42
    [DOCUMENT_ROOT] => /var/www/public
    [REQUEST_SCHEME] => http
    [CONTEXT_PREFIX] =>
    [CONTEXT_DOCUMENT_ROOT] => /var/www/public
    [SERVER_ADMIN] => [email protected]
    [SCRIPT_FILENAME] => /var/www/public/index.php
    [REMOTE_PORT] => 41564
    [REMOTE_USER] => MyUser
    [AUTH_TYPE] => Basic
    [REDIRECT_URL] => /verification/activation/
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => POST
    [QUERY_STRING] =>
    [REQUEST_URI] => /verification/activation/
    [SCRIPT_NAME] => /index.php
    [PATH_INFO] => /verification/activation/
    [PATH_TRANSLATED] => redirect:/index.php/verification/activation//activation/
    [PHP_SELF] => /index.php/verification/activation/
    [PHP_AUTH_USER] => MyUser
    [PHP_AUTH_PW] => MyPassword
    [REQUEST_TIME_FLOAT] => 1653495624.0889
    [REQUEST_TIME] => 1653495624
    [CI_ENVIRONMENT] => development
)

RESULTS:
Subscription number: 9999999999999999
Activation: No
Error: Activation Key does not exist.

Thank you to all who responded. But now my question is, how will it affect the Codeigniter base if those lines are removed from the .htaccess file? First passes seem to indicate that it all still works just fine, but.... what issues might arise?
Reply
#13

There were two requests, and you saw 2. Check your apache log.

Code:
1. C++ POST --> /verification/activation/ (will be redirected because it is not a directory and ends with /)
2. C++ GET  --> /verification/activation
Reply




Theme © iAndrew 2016 - Forum software by © MyBB